You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2018/12/13 18:33:18 UTC

[GitHub] jadams-tresys commented on a change in pull request #155: Don't require binaryNumberRep for hexBinary

jadams-tresys commented on a change in pull request #155: Don't require binaryNumberRep for hexBinary
URL: https://github.com/apache/incubator-daffodil/pull/155#discussion_r241513869
 
 

 ##########
 File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/ElementBase.scala
 ##########
 @@ -653,13 +653,16 @@ trait ElementBase
     }
   }
 
+  private lazy val optionBinaryNubmerRep = findPropertyOption("binaryNumberRep")
+
   private def getImplicitAlignmentInBits(thePrimType: PrimType, theRepresentation: Representation): Int = {
     (theRepresentation, thePrimType) match {
       case (Representation.Text, PrimType.HexBinary) => Assert.impossible("type xs:hexBinary with representation='text'")
       case (Representation.Text, _) => knownEncodingAlignmentInBits
       case (Representation.Binary, PrimType.Float | PrimType.Boolean) => 32
       case (Representation.Binary, PrimType.Double) => 64
-      case (Representation.Binary, _) => binaryNumberRep match {
+      case (Representation.Binary, PrimType.HexBinary) => 8
+      case (Representation.Binary, _) if (optionBinaryNumberRep.isDefined) => binaryNumberRep match {
 
 Review comment:
   I think this rats nest of match cases was made by me, so I took a stab at greatly simplifying the logic here and I think it is much cleaner now.  I ran the test suite with these changes and everything passes, but give it a look to make sure I didn't miss anything obvious.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services