public override byte[] EncodeValue(ScalarValue value_Renamed) { System.DateTime date = ((DateValue)value_Renamed).value_Renamed; int millisecondsSinceMidnight = Util.MillisecondsSinceMidnight(ref date); return(INTEGER.EncodeValue(new IntegerValue(millisecondsSinceMidnight))); }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { ScalarValue subtractionLength = INTEGER.Decode(in_Renamed); ScalarValue difference = ASCII.Decode(in_Renamed); return(new TwinValue(subtractionLength, difference)); }
public override byte[] EncodeValue(ScalarValue v) { if (v == ScalarValue.NULL) { return(NULL_VALUE_ENCODING); } var buffer = new System.IO.MemoryStream(); var value_Renamed = (DecimalValue)v; try { if (Math.Abs(value_Renamed.exponent) > 63) { Global.HandleError(Error.FastConstants.R1_LARGE_DECIMAL, ""); } byte[] temp_byteArray = NULLABLE_INTEGER.Encode(new IntegerValue(value_Renamed.exponent)); buffer.Write(temp_byteArray, 0, temp_byteArray.Length); byte[] temp_byteArray2 = INTEGER.Encode(new LongValue(value_Renamed.mantissa)); buffer.Write(temp_byteArray2, 0, temp_byteArray2.Length); } catch (System.IO.IOException e) { throw new RuntimeException(e); } return(buffer.ToArray()); }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { int exponent = ((IntegerValue)INTEGER.Decode(in_Renamed)).value_Renamed; if (Math.Abs(exponent) > 63) { Global.HandleError(Error.FastConstants.R1_LARGE_DECIMAL, "Encountered exponent of size " + exponent); } long mantissa = INTEGER.Decode(in_Renamed).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return(decimalValue); }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { ScalarValue exp = NULLABLE_INTEGER.Decode(in_Renamed); if ((exp == null) || exp.Null) { return(null); } int exponent = exp.ToInt(); long mantissa = INTEGER.Decode(in_Renamed).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return(decimalValue); }
public override byte[] EncodeValue(ScalarValue value_Renamed) { if (value_Renamed.Null) { return(NULL_VALUE_ENCODING); } var intValue = (NumericValue)value_Renamed; if (intValue.ToLong() >= 0) { return(INTEGER.EncodeValue(intValue.Increment())); } return(INTEGER.EncodeValue(intValue)); }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { var numericValue = ((NumericValue)INTEGER.Decode(in_Renamed)); long value_Renamed = numericValue.ToLong(); if (value_Renamed == 0) { return(null); } if (value_Renamed > 0) { return(numericValue.Decrement()); } return(numericValue); }
public override byte[] EncodeValue(ScalarValue value_Renamed) { if ((value_Renamed == null) || (value_Renamed == ScalarValue.NULL)) { throw new SystemException("Cannot have null values for non-nullable string delta"); } var diff = (TwinValue)value_Renamed; byte[] subtractionLength = INTEGER.Encode(diff.first); byte[] difference = ASCII.Encode(diff.second); var encoded = new byte[subtractionLength.Length + difference.Length]; Array.Copy(subtractionLength, 0, encoded, 0, subtractionLength.Length); Array.Copy(difference, 0, encoded, subtractionLength.Length, difference.Length); return(encoded); }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { int millisecondsSinceMidnight = INTEGER.Decode(in_Renamed).ToInt(); System.Globalization.Calendar cal = new System.Globalization.GregorianCalendar(); int hour = millisecondsSinceMidnight / 3600000; millisecondsSinceMidnight -= hour * 3600000; SupportClass.CalendarManager.manager.Set(cal, SupportClass.CalendarManager.HOUR_OF_DAY, hour); int minute = millisecondsSinceMidnight / 60000; millisecondsSinceMidnight -= minute * 60000; SupportClass.CalendarManager.manager.Set(cal, SupportClass.CalendarManager.MINUTE, minute); int second = millisecondsSinceMidnight / 1000; millisecondsSinceMidnight -= second * 1000; SupportClass.CalendarManager.manager.Set(cal, SupportClass.CalendarManager.SECOND, second); int millisecond = millisecondsSinceMidnight; SupportClass.CalendarManager.manager.Set(cal, SupportClass.CalendarManager.MILLISECOND, millisecond); System.DateTime tempAux = SupportClass.CalendarManager.manager.GetDateTime(cal); return(new DateValue(ref tempAux)); }
public override string ToString() { StringBuilder __sb = new StringBuilder("LogicalType("); bool __first = true; if (STRING != null && __isset.@STRING) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("STRING: "); __sb.Append(STRING == null ? "<null>" : STRING.ToString()); } if (MAP != null && __isset.MAP) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("MAP: "); __sb.Append(MAP == null ? "<null>" : MAP.ToString()); } if (LIST != null && __isset.LIST) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("LIST: "); __sb.Append(LIST == null ? "<null>" : LIST.ToString()); } if (ENUM != null && __isset.@ENUM) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("ENUM: "); __sb.Append(ENUM == null ? "<null>" : ENUM.ToString()); } if (DECIMAL != null && __isset.@DECIMAL) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("DECIMAL: "); __sb.Append(DECIMAL == null ? "<null>" : DECIMAL.ToString()); } if (DATE != null && __isset.DATE) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("DATE: "); __sb.Append(DATE == null ? "<null>" : DATE.ToString()); } if (TIME != null && __isset.TIME) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("TIME: "); __sb.Append(TIME == null ? "<null>" : TIME.ToString()); } if (TIMESTAMP != null && __isset.TIMESTAMP) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("TIMESTAMP: "); __sb.Append(TIMESTAMP == null ? "<null>" : TIMESTAMP.ToString()); } if (INTEGER != null && __isset.INTEGER) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("INTEGER: "); __sb.Append(INTEGER == null ? "<null>" : INTEGER.ToString()); } if (UNKNOWN != null && __isset.UNKNOWN) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("UNKNOWN: "); __sb.Append(UNKNOWN == null ? "<null>" : UNKNOWN.ToString()); } if (JSON != null && __isset.JSON) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("JSON: "); __sb.Append(JSON == null ? "<null>" : JSON.ToString()); } if (BSON != null && __isset.BSON) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("BSON: "); __sb.Append(BSON == null ? "<null>" : BSON.ToString()); } if (UUID != null && __isset.UUID) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("UUID: "); __sb.Append(UUID == null ? "<null>" : UUID.ToString()); } __sb.Append(")"); return(__sb.ToString()); }
public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("LogicalType"); oprot.WriteStructBegin(struc); TField field = new TField(); if (STRING != null && __isset.@STRING) { field.Name = "STRING"; field.Type = TType.Struct; field.ID = 1; oprot.WriteFieldBegin(field); STRING.Write(oprot); oprot.WriteFieldEnd(); } if (MAP != null && __isset.MAP) { field.Name = "MAP"; field.Type = TType.Struct; field.ID = 2; oprot.WriteFieldBegin(field); MAP.Write(oprot); oprot.WriteFieldEnd(); } if (LIST != null && __isset.LIST) { field.Name = "LIST"; field.Type = TType.Struct; field.ID = 3; oprot.WriteFieldBegin(field); LIST.Write(oprot); oprot.WriteFieldEnd(); } if (ENUM != null && __isset.@ENUM) { field.Name = "ENUM"; field.Type = TType.Struct; field.ID = 4; oprot.WriteFieldBegin(field); ENUM.Write(oprot); oprot.WriteFieldEnd(); } if (DECIMAL != null && __isset.@DECIMAL) { field.Name = "DECIMAL"; field.Type = TType.Struct; field.ID = 5; oprot.WriteFieldBegin(field); DECIMAL.Write(oprot); oprot.WriteFieldEnd(); } if (DATE != null && __isset.DATE) { field.Name = "DATE"; field.Type = TType.Struct; field.ID = 6; oprot.WriteFieldBegin(field); DATE.Write(oprot); oprot.WriteFieldEnd(); } if (TIME != null && __isset.TIME) { field.Name = "TIME"; field.Type = TType.Struct; field.ID = 7; oprot.WriteFieldBegin(field); TIME.Write(oprot); oprot.WriteFieldEnd(); } if (TIMESTAMP != null && __isset.TIMESTAMP) { field.Name = "TIMESTAMP"; field.Type = TType.Struct; field.ID = 8; oprot.WriteFieldBegin(field); TIMESTAMP.Write(oprot); oprot.WriteFieldEnd(); } if (INTEGER != null && __isset.INTEGER) { field.Name = "INTEGER"; field.Type = TType.Struct; field.ID = 10; oprot.WriteFieldBegin(field); INTEGER.Write(oprot); oprot.WriteFieldEnd(); } if (UNKNOWN != null && __isset.UNKNOWN) { field.Name = "UNKNOWN"; field.Type = TType.Struct; field.ID = 11; oprot.WriteFieldBegin(field); UNKNOWN.Write(oprot); oprot.WriteFieldEnd(); } if (JSON != null && __isset.JSON) { field.Name = "JSON"; field.Type = TType.Struct; field.ID = 12; oprot.WriteFieldBegin(field); JSON.Write(oprot); oprot.WriteFieldEnd(); } if (BSON != null && __isset.BSON) { field.Name = "BSON"; field.Type = TType.Struct; field.ID = 13; oprot.WriteFieldBegin(field); BSON.Write(oprot); oprot.WriteFieldEnd(); } if (UUID != null && __isset.UUID) { field.Name = "UUID"; field.Type = TType.Struct; field.ID = 14; oprot.WriteFieldBegin(field); UUID.Write(oprot); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }
public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) { oprot.IncrementRecursionDepth(); try { var struc = new TStruct("LogicalType"); await oprot.WriteStructBeginAsync(struc, cancellationToken); var field = new TField(); if (STRING != null && __isset.@STRING) { field.Name = "STRING"; field.Type = TType.Struct; field.ID = 1; await oprot.WriteFieldBeginAsync(field, cancellationToken); await STRING.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (MAP != null && __isset.MAP) { field.Name = "MAP"; field.Type = TType.Struct; field.ID = 2; await oprot.WriteFieldBeginAsync(field, cancellationToken); await MAP.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (LIST != null && __isset.LIST) { field.Name = "LIST"; field.Type = TType.Struct; field.ID = 3; await oprot.WriteFieldBeginAsync(field, cancellationToken); await LIST.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (ENUM != null && __isset.@ENUM) { field.Name = "ENUM"; field.Type = TType.Struct; field.ID = 4; await oprot.WriteFieldBeginAsync(field, cancellationToken); await ENUM.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (DECIMAL != null && __isset.@DECIMAL) { field.Name = "DECIMAL"; field.Type = TType.Struct; field.ID = 5; await oprot.WriteFieldBeginAsync(field, cancellationToken); await DECIMAL.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (DATE != null && __isset.DATE) { field.Name = "DATE"; field.Type = TType.Struct; field.ID = 6; await oprot.WriteFieldBeginAsync(field, cancellationToken); await DATE.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (TIME != null && __isset.TIME) { field.Name = "TIME"; field.Type = TType.Struct; field.ID = 7; await oprot.WriteFieldBeginAsync(field, cancellationToken); await TIME.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (TIMESTAMP != null && __isset.TIMESTAMP) { field.Name = "TIMESTAMP"; field.Type = TType.Struct; field.ID = 8; await oprot.WriteFieldBeginAsync(field, cancellationToken); await TIMESTAMP.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (INTEGER != null && __isset.INTEGER) { field.Name = "INTEGER"; field.Type = TType.Struct; field.ID = 10; await oprot.WriteFieldBeginAsync(field, cancellationToken); await INTEGER.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (UNKNOWN != null && __isset.UNKNOWN) { field.Name = "UNKNOWN"; field.Type = TType.Struct; field.ID = 11; await oprot.WriteFieldBeginAsync(field, cancellationToken); await UNKNOWN.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (JSON != null && __isset.JSON) { field.Name = "JSON"; field.Type = TType.Struct; field.ID = 12; await oprot.WriteFieldBeginAsync(field, cancellationToken); await JSON.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if (BSON != null && __isset.BSON) { field.Name = "BSON"; field.Type = TType.Struct; field.ID = 13; await oprot.WriteFieldBeginAsync(field, cancellationToken); await BSON.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } await oprot.WriteFieldStopAsync(cancellationToken); await oprot.WriteStructEndAsync(cancellationToken); } finally { oprot.DecrementRecursionDepth(); } }
public override byte[] EncodeValue(ScalarValue value_Renamed) { return(INTEGER.EncodeValue(new LongValue(value_Renamed.ToLong()))); }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { var tempAux = new DateTime(INTEGER.Decode(in_Renamed).ToLong()); return(new DateValue(ref tempAux)); }