mbeckerle commented on a change in pull request #129: Cross Testing Capability 
with IBM DFDL
URL: https://github.com/apache/incubator-daffodil/pull/129#discussion_r230865125
 
 

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/dsom/RuntimePropertyMixins.scala
 ##########
 @@ -381,6 +384,37 @@ trait ElementRuntimeValuedPropertiesMixin
     res
   }
 
+  protected final lazy val optionTextOutputMinLength = 
findPropertyOption("textOutputMinLength")
+
+  /**
+   * We only use textOutputMinLength in a very narrow set of circumstances.
+   * Otherwise we assume 0.
+   */
+  lazy val textOutputMinLength: Long = {
+    val useTextOutputMinLength: Boolean = {
+      decl.isSimpleType &&
+        (decl.simpleType.primType ne PrimType.String) &&
+        (decl.simpleType.primType ne PrimType.HexBinary) &&
+        (decl.impliedRepresentation eq Representation.Text) &&
+        decl.optionTextPadKind.isDefined &&
+        (decl.textPadKind eq TextPadKind.PadChar) &&
+        {
+          import LengthKind._
+          decl.lengthKind match {
+            case Delimited | Prefixed | Pattern | EndOfParent => true
+            case Explicit if (!decl.lengthEv.isConstant) => true
+            case _ => false
+          }
+        }
+    }
+    val res: Long =
+      if (useTextOutputMinLength) {
+        val Found(value, _, _, _) = findProperty("textOutputMinLength")
+        value.toLong
+      } else 0
+    res
+  }
+
 
 Review comment:
   I'll look into this. Might be hard to tease apart such that these can be 
isolated. 

----------------------------------------------------------------
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