mbeckerle commented on a change in pull request #88: Daffodil 1919 separators URL: https://github.com/apache/incubator-daffodil/pull/88#discussion_r209057403
########## File path: daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/ElementKindUnparsers.scala ########## @@ -240,71 +154,71 @@ class DynamicEscapeSchemeUnparser(escapeScheme: EscapeSchemeUnparseEv, ctxt: Ter } } -class ArrayCombinatorUnparser(erd: ElementRuntimeData, bodyUnparser: Unparser) - extends CombinatorUnparser(erd) { - override def nom = "Array" - override lazy val runtimeDependencies = Nil - override lazy val childProcessors = Seq(bodyUnparser) - - def unparse(state: UState) { - state.arrayIndexStack.push(1L) // one-based indexing - state.occursBoundsStack.push(state.tunable.maxOccursBounds) - - var event = state.advanceOrError - Assert.invariant(event.isStart && event.node.isInstanceOf[DIArray]) - - bodyUnparser.unparse1(state) - - event = state.advanceOrError - if (!(event.isEnd && event.node.isInstanceOf[DIArray])) { - UnparseError(One(erd.schemaFileLocation), One(state.currentLocation), "Expected array end event for %s, but received %s.", erd.namedQName, event) - } - - val shouldValidate = - (state.dataProc.isDefined) && state.dataProc.value.getValidationMode != ValidationMode.Off - - val actualOccurs = state.arrayIndexStack.pop() - state.occursBoundsStack.pop() - - if (shouldValidate) { - (erd.minOccurs, erd.maxOccurs) match { - case (Some(minOccurs), Some(maxOccurs)) => { - val isUnbounded = maxOccurs == -1 - val occurrence = actualOccurs - 1 - if (isUnbounded && occurrence < minOccurs) - state.validationError("%s occurred '%s' times when it was expected to be a " + - "minimum of '%s' and a maximum of 'UNBOUNDED' times.", erd.diagnosticDebugName, - occurrence, minOccurs) - else if (!isUnbounded && (occurrence < minOccurs || occurrence > maxOccurs)) - state.validationError("%s occurred '%s' times when it was expected to be a " + - "minimum of '%s' and a maximum of '%s' times.", erd.diagnosticDebugName, - occurrence, minOccurs, maxOccurs) - } - case _ => // ok - } - } - } -} - -class OptionalCombinatorUnparser(erd: ElementRuntimeData, bodyUnparser: Unparser) - extends CombinatorUnparser(erd) { - override def nom = "Optional" - override lazy val childProcessors = Seq(bodyUnparser) - - override lazy val runtimeDependencies = Nil - - def unparse(state: UState) { - - state.arrayIndexStack.push(1L) // one-based indexing - state.occursBoundsStack.push(1L) - - val event = state.inspectOrError - Assert.invariant(event.isStart && !event.node.isInstanceOf[DIArray]) - - bodyUnparser.unparse1(state) - - state.arrayIndexStack.pop() - state.occursBoundsStack.pop() - } -} +//class ArrayCombinatorUnparser(erd: ElementRuntimeData, bodyUnparser: Unparser) Review comment: There's more than one thing, but deleted commented code, and renamed anyway. ---------------------------------------------------------------- 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