Github user mbeckerle commented on a diff in the pull request:
https://github.com/apache/incubator-daffodil/pull/5#discussion_r150628084
--- Diff:
daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/ChoiceGroup.scala
---
@@ -78,29 +77,48 @@ import edu.illinois.ncsa.daffodil.api.WarnID
*
*/
-final class Choice(xmlArg: Node, parent: SchemaComponent, position: Int)
- extends ModelGroup(xmlArg, parent, position)
- with Choice_AnnotationMixin
- with RawDelimitedRuntimeValuedPropertiesMixin // initiator and
terminator (not separator)
- with ChoiceGrammarMixin {
+trait ChoiceLikeMixin
+ extends AnnotatedSchemaComponent
+ with DFDLStatementMixin {
- requiredEvaluations(branchesAreNonOptional)
- requiredEvaluations(branchesAreNotIVCElements)
- requiredEvaluations(modelGroupRuntimeData.preSerialization)
+ protected def isMyFormatAnnotation(a: DFDLAnnotation) =
a.isInstanceOf[DFDLChoice]
- protected final override lazy val myPeers = choicePeers
-
- protected final override def annotationFactory(node: Node):
Option[DFDLAnnotation] = {
+ protected override def annotationFactory(node: Node):
Option[DFDLAnnotation] = {
node match {
case <dfdl:choice>{ contents @ _* }</dfdl:choice> => Some(new
DFDLChoice(node, this))
case _ => annotationFactoryForDFDLStatement(node, this)
}
}
- protected final def emptyFormatFactory = new
DFDLChoice(newDFDLAnnotationXML("choice"), this)
- protected final def isMyFormatAnnotation(a: DFDLAnnotation) =
a.isInstanceOf[DFDLChoice]
+ protected def emptyFormatFactory: DFDLFormatAnnotation = new
DFDLChoice(newDFDLAnnotationXML("choice"), this)
+
+ lazy val xmlChildren = xml match {
+ case <choice>{ c @ _* }</choice> => c
+ case <group>{ _* }</group> => {
+ val ch = this match {
+ case cgr: ChoiceGroupRef => cgr.groupDef.xml \\ "choice"
+ case cgd: GlobalChoiceGroupDef => cgd.xml \\ "choice"
--- End diff --
Changed to "\". Once I fixed the inheritance to get ChoiceLikeMixin out of
ChoiceBase, this now gets a "fruitless type test warning". So removed the first
case.
---