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_r189945311
 
 

 ##########
 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,
 
 Review comment:
   The base class probably needs to be split out with a ConvertCalendarProcessorBase. I would think that handling text and handling binary would share very little code aside from the parts related to filling out the infoset. For example, the pattern member shouldn't be necessary, since that is only use for parsing text data. I'm actually a little surprised there are so many parameters to ConvertBinaryCalendarParser/Unparse. Likewise, I wouldn't think this should mixin TextPrimUnparser since this isn't creating any text.

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