public override ScalarValue Decode(Stream inStream) { ScalarValue subtractionLength = Integer.Decode(inStream); ScalarValue difference = Ascii.Decode(inStream); return(new TwinValue(subtractionLength, difference)); }
public override ScalarValue Decode(Stream inStream) { int exponent = ((IntegerValue)Integer.Decode(inStream)).Value; if (Math.Abs(exponent) > 63) { Global.ErrorHandler.OnError(null, RepError.LargeDecimal, "Encountered exponent of size {0}", exponent); } long mantissa = Integer.Decode(inStream).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return(decimalValue); }
public override ScalarValue Decode(Stream inStream) { ScalarValue exp = NullableInteger.Decode(inStream); if ((exp == null) || exp.IsNull) { return(null); } int exponent = exp.ToInt(); long mantissa = Integer.Decode(inStream).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return(decimalValue); }
public override ScalarValue Decode(Stream inStream) { var numericValue = (NumericValue)Integer.Decode(inStream); long value = numericValue.ToLong(); if (value == 0) { return(null); } if (value > 0) { return(numericValue.Decrement()); } return(numericValue); }
/// <summary> /// Gets the value associated with this name /// </summary> /// <param name="name"></param> /// <returns></returns> public int GetInt(string name) { var s4PropWrapper = GetProperty <S4Integer>(name); var s4Integer = (S4Integer)s4PropWrapper.Annotation; if (_propValues[name] == null) { var isDefDefined = (s4Integer.DefaultValue != S4Integer.NotDefined); if (s4Integer.Mandatory) { if (!isDefDefined) { throw new InternalConfigurationException(_instanceName, name, Strings.MANDATORY_PROPERTY_NOT_SET); } } else if (!isDefDefined) { throw new InternalConfigurationException(_instanceName, name, "no default value for non-mandatory property"); } _propValues.Put(name, s4Integer.DefaultValue); } var propObject = _propValues.Get(name); var propValue = propObject is int?(int)propObject : (int)Integer.Decode(FlattenProp(name)); var range = s4Integer.Range; if (range.Length != 2) { throw new InternalConfigurationException(_instanceName, name, range + " is not of expected range type, which is {minValue, maxValue)"); } if (propValue < range[0] || propValue > range[1]) { throw new InternalConfigurationException(_instanceName, name, " is not in range (" + range + ')'); } return(propValue); }
public override ScalarValue Decode(Stream inStream) { var tempAux = new DateTime(Integer.Decode(inStream).ToLong()); return(new DateValue(tempAux)); }
public override ScalarValue Decode(Stream inStream) { int millisecondsSinceMidnight = Integer.Decode(inStream).ToInt(); return new DateValue(new DateTime(millisecondsSinceMidnight*TimeSpan.TicksPerMillisecond)); }