git.net

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

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


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

 ##########
 File path: daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/ConvertBinaryCalendarUnparser.scala
 ##########
 @@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.processors.unparsers
+
+import java.text.ParsePosition
+
+import scala.math.BigInt.int2bigInt
+
+import org.apache.daffodil.calendar.DFDLCalendar
+import org.apache.daffodil.exceptions.Assert
+import org.apache.daffodil.io.DataOutputStream
+import org.apache.daffodil.io.FormatInfo
+import org.apache.daffodil.processors.CalendarEv
+import org.apache.daffodil.processors.CalendarLanguageEv
+import org.apache.daffodil.processors.ElementRuntimeData
+import org.apache.daffodil.processors.parsers.ConvertTextCalendarProcessorBase
+import org.apache.daffodil.schema.annotation.props.gen.BinaryCalendarRep
+import org.apache.daffodil.util.Maybe.One
+import org.apache.daffodil.util.Misc
+
+import com.ibm.icu.util.Calendar
+import com.ibm.icu.util.TimeZone
+import com.ibm.icu.util.ULocale
+
+case class ConvertBinaryCalendarUnparser(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 TextPrimUnparser {
+
+  /**
+   * Primitive unparsers must override runtimeDependencies
+   */
+  override lazy val runtimeDependencies = Seq(localeEv, calendarEv)
+
+  protected def putNumber(dos: DataOutputStream, value: Int, nBits: Int, finfo: FormatInfo): Boolean = {
 
 Review comment:
   value has to be able to be a Long so that millseconds can use 64 bits.

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