git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] stevedlawrence commented on a change in pull request #70: Adding property binaryCalendarRep with values "binarySeconds" and "bi…


stevedlawrence commented on a change in pull request #70: Adding property binaryCalendarRep with values "binarySeconds" and "bi…
URL: https://github.com/apache/incubator-daffodil/pull/70#discussion_r189955339
 
 

 ##########
 File path: daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/PrimitivesDateTime1.scala
 ##########
 @@ -188,3 +189,83 @@ object TextCalendarConstants {
     }
   }
 }
+
+case class ConvertBinaryCalendarParser(erd: ElementRuntimeData,
+  xsdType: String,
+  prettyType: String,
+  pattern: String,
+  hasTZ: Boolean,
+  localeEv: CalendarLanguageEv,
+  calendarEv: CalendarEv,
+  infosetPattern: String,
+  firstDay: Int,
+  calendarDaysInFirstWeek: Int,
+  calendarCheckPolicy: Boolean,
+  calendarTz: Option[TimeZone],
+  tz: TimeZone,
+  binCalRep: BinaryCalendarRep,
+  binCalEpoch: String,
+  lengthInBits: Int)
+  extends ConvertTextCalendarProcessorBase(erd,
+    xsdType, prettyType, pattern, hasTZ, localeEv, calendarEv, infosetPattern, firstDay, calendarDaysInFirstWeek,
+    calendarCheckPolicy, calendarTz, tz)
+  with TextPrimParser {
+
+  override lazy val runtimeDependencies = List(localeEv, calendarEv)
+
+  def parse(start: PState): Unit = {
+
+    val dis = start.dataInputStream
+    val int: BigInt = dis.getSignedBigInt(lengthInBits, start)
 
 Review comment:
   The lengthInBits can only be 32 or 64. So getting a BigInt, which is a bit heavier, isn't really needed. We can just use getSignedLong instead.

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


With regards,
Apache Git Services