mbeckerle commented on a change in pull request #88: Daffodil 1919 separators
URL: https://github.com/apache/incubator-daffodil/pull/88#discussion_r209017031
 
 

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/dsom/SequenceGroup.scala
 ##########
 @@ -339,8 +337,89 @@ class Sequence(xmlArg: Node, parent: SchemaComponent, 
position: Int)
   }.value
 }
 
-final class UnorderedSequence(xmlArg: Node, xmlContents: Seq[Node], parent: 
SchemaComponent, position: Int)
-  extends Sequence(xmlArg, parent, position) {
-  // A shell, the actual XML representation is passed in
-  // from Sequence
+/**
+ * A choice branch can be an element with multiple occurrances, or varying 
occurrences.
+ *
+ * There can't be separators, but the driving of the iteration for the 
occurences, is
+ * in the sequence parsers/unparsers. So this implements that, leveraging the
+ * sequence machinery, but specifying the properties needed to insure it is
+ * handled as a degenerate sequence having only one element decl within it.
+ */
+final class ChoiceBranchImpliedSequence(rawGM: Term)
+  extends SequenceTermBase(rawGM.xml, rawGM.parent, rawGM.position)
+  with GroupDefLike {
+
+  override def separatorSuppressionPolicy: SeparatorSuppressionPolicy = 
SeparatorSuppressionPolicy.TrailingEmptyStrict
+
+  override def sequenceKind: SequenceKind = SequenceKind.Ordered
+
+  override def separatorPosition: SeparatorPosition = SeparatorPosition.Infix
+
+  override def isLayered: Boolean = false
+
+  override lazy val hasSeparator = false
+  override lazy val hasTerminator = false
+  override lazy val hasInitiator = false
+
+  override def separatorParseEv: SeparatorParseEv = Assert.usageError("Not to 
be called on choice branches.")
+
+  override def separatorUnparseEv: SeparatorUnparseEv = Assert.usageError("Not 
to be called on choice branches.")
+
+  override def layerLengthUnits: LayerLengthUnits = LayerLengthUnits.Bytes
+
+  override def isOrdered = true
+
+  override def maybeLayerTransformerEv: Maybe[LayerTransformerEv] = Maybe.Nope
 
 Review comment:
   Done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to