Exemplo n.º 1
0
        private DoubleVal parseRangeValue(string s0, bool isMin)
        {
            DoubleVal val = new DoubleVal { // empty translates to numeric range boundary
                value   = isMin ? Double.MinValue : Double.MaxValue,
                isValid = true
            };
            string s1 = s0.Trim();

            if (s1.Length > 0)
            {
                bool   isExcluded = false;
                string s2;

                if ((isMin && (s1[0] == '>')) || (!isMin && (s1[0] == '<')))
                {
                    isExcluded = true;
                    s2         = s1.Substring(1);
                }
                else
                {
                    s2 = s1;
                }
                val            = parseValue(s2);
                val.isExcluded = isExcluded;
            }
            return(val);
        }
Exemplo n.º 2
0
            public static TdfDoubleVal Create(string Label, DoubleVal v)
            {
                TdfDoubleVal res = new TdfDoubleVal();

                res.Set(Label, 8);
                res.Value = v;
                return(res);
            }
Exemplo n.º 3
0
        public static DoubleVal ReadDoubleVal(Stream s)
        {
            DoubleVal res = new DoubleVal();

            res.v1 = DecompressInteger(s);
            res.v2 = DecompressInteger(s);
            return(res);
        }
Exemplo n.º 4
0
 protected bool Equals(PrimitivesReferenceModel other)
 {
     return(string.Equals(StringVal, other.StringVal) && IntVal == other.IntVal &&
            BooleanVal == other.BooleanVal && ByteVal == other.ByteVal && LongVal == other.LongVal &&
            FloatVal.Equals(other.FloatVal) && DoubleVal.Equals(other.DoubleVal) &&
            DateTimeVal.Equals(other.DateTimeVal) && ShortVal == other.ShortVal &&
            UShortVal == other.UShortVal && UIntVal == other.UIntVal && ULongVal == other.ULongVal &&
            SByteVal == other.SByteVal && CharVal == other.CharVal);
 }
Exemplo n.º 5
0
        private DoubleVal parseValue(string s0)
        {
            string    s1  = s0.Trim();
            DoubleVal val = new DoubleVal {
                value = 0.0, isValid = false
            };

            val.isValid = Double.TryParse(s1, NumberStyles.Float,
                                          mCommaCulture, out val.value);
            return(val);
        }
Exemplo n.º 6
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("TColumnValue(");

            sb.Append("BoolVal: ");
            sb.Append(BoolVal == null ? "<null>" : BoolVal.ToString());
            sb.Append(",ByteVal: ");
            sb.Append(ByteVal == null ? "<null>" : ByteVal.ToString());
            sb.Append(",I16Val: ");
            sb.Append(I16Val == null ? "<null>" : I16Val.ToString());
            sb.Append(",I32Val: ");
            sb.Append(I32Val == null ? "<null>" : I32Val.ToString());
            sb.Append(",I64Val: ");
            sb.Append(I64Val == null ? "<null>" : I64Val.ToString());
            sb.Append(",DoubleVal: ");
            sb.Append(DoubleVal == null ? "<null>" : DoubleVal.ToString());
            sb.Append(",StringVal: ");
            sb.Append(StringVal == null ? "<null>" : StringVal.ToString());
            sb.Append(")");
            return(sb.ToString());
        }
Exemplo n.º 7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (StringVal != null ? StringVal.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IntVal;
         hashCode = (hashCode * 397) ^ BooleanVal.GetHashCode();
         hashCode = (hashCode * 397) ^ ByteVal.GetHashCode();
         hashCode = (hashCode * 397) ^ LongVal.GetHashCode();
         hashCode = (hashCode * 397) ^ FloatVal.GetHashCode();
         hashCode = (hashCode * 397) ^ DoubleVal.GetHashCode();
         hashCode = (hashCode * 397) ^ DateTimeVal.GetHashCode();
         hashCode = (hashCode * 397) ^ ShortVal.GetHashCode();
         hashCode = (hashCode * 397) ^ UShortVal.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)UIntVal;
         hashCode = (hashCode * 397) ^ ULongVal.GetHashCode();
         hashCode = (hashCode * 397) ^ SByteVal.GetHashCode();
         hashCode = (hashCode * 397) ^ CharVal.GetHashCode();
         return(hashCode);
     }
 }
Exemplo n.º 8
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                if (__isset.boolVal)
                {
                    hashcode = (hashcode * 397) + BoolVal.GetHashCode();
                }
                if (__isset.byteVal)
                {
                    hashcode = (hashcode * 397) + ByteVal.GetHashCode();
                }
                if (__isset.i16Val)
                {
                    hashcode = (hashcode * 397) + I16Val.GetHashCode();
                }
                if (__isset.i32Val)
                {
                    hashcode = (hashcode * 397) + I32Val.GetHashCode();
                }
                if (__isset.i64Val)
                {
                    hashcode = (hashcode * 397) + I64Val.GetHashCode();
                }
                if (__isset.doubleVal)
                {
                    hashcode = (hashcode * 397) + DoubleVal.GetHashCode();
                }
                if (__isset.stringVal)
                {
                    hashcode = (hashcode * 397) + StringVal.GetHashCode();
                }
                if (__isset.binaryVal)
                {
                    hashcode = (hashcode * 397) + BinaryVal.GetHashCode();
                }
            }
            return(hashcode);
        }
Exemplo n.º 9
0
        public void Write(TProtocol oprot)
        {
            TStruct struc = new TStruct("TColumn");

            oprot.WriteStructBegin(struc);
            TField field = new TField();

            if (BoolVal != null && __isset.boolVal)
            {
                field.Name = "boolVal";
                field.Type = TType.Struct;
                field.ID   = 1;
                oprot.WriteFieldBegin(field);
                BoolVal.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (ByteVal != null && __isset.byteVal)
            {
                field.Name = "byteVal";
                field.Type = TType.Struct;
                field.ID   = 2;
                oprot.WriteFieldBegin(field);
                ByteVal.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (I16Val != null && __isset.i16Val)
            {
                field.Name = "i16Val";
                field.Type = TType.Struct;
                field.ID   = 3;
                oprot.WriteFieldBegin(field);
                I16Val.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (I32Val != null && __isset.i32Val)
            {
                field.Name = "i32Val";
                field.Type = TType.Struct;
                field.ID   = 4;
                oprot.WriteFieldBegin(field);
                I32Val.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (I64Val != null && __isset.i64Val)
            {
                field.Name = "i64Val";
                field.Type = TType.Struct;
                field.ID   = 5;
                oprot.WriteFieldBegin(field);
                I64Val.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (DoubleVal != null && __isset.doubleVal)
            {
                field.Name = "doubleVal";
                field.Type = TType.Struct;
                field.ID   = 6;
                oprot.WriteFieldBegin(field);
                DoubleVal.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (StringVal != null && __isset.stringVal)
            {
                field.Name = "stringVal";
                field.Type = TType.Struct;
                field.ID   = 7;
                oprot.WriteFieldBegin(field);
                StringVal.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (BinaryVal != null && __isset.binaryVal)
            {
                field.Name = "binaryVal";
                field.Type = TType.Struct;
                field.ID   = 8;
                oprot.WriteFieldBegin(field);
                BinaryVal.Write(oprot);
                oprot.WriteFieldEnd();
            }
            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
Exemplo n.º 10
0
 private void parseExplicitMapping(string[] valueRepresentation,
                                   ref PlaceholderInfo outInfo)
 {
     if (valueRepresentation.Length == 2)
     {
         string[] rangeStrings = valueRepresentation[0].Split('.');
         if (rangeStrings.Length == 1)
         {
             DoubleVal value = parseValue(rangeStrings[0]);
             if (value.isValid)
             {
                 Mapping mapping = new Mapping  {
                     minValue       = value.value,
                     maxValue       = value.value,
                     representation = valueRepresentation[1]
                 };
                 outInfo.mappings.Add(mapping);
             }
             else
             {
                 outInfo.result.HasError = true;
                 outInfo.result.Message  = "ExplicitMappingInvalidValue";
                 return;
             }
         }
         else if ((rangeStrings.Length == 3) && (rangeStrings[1].Length == 0))
         {
             DoubleVal minValue = parseRangeValue(rangeStrings[0], /* isMin = */ true);
             DoubleVal maxValue = parseRangeValue(rangeStrings[2], /* isMin = */ false);
             if (minValue.isValid && maxValue.isValid)
             {
                 if (minValue.value < maxValue.value)
                 {
                     Mapping mapping = new Mapping {
                         minValue           = minValue.value,
                         isMinValueExcluded = minValue.isExcluded,
                         maxValue           = maxValue.value,
                         isMaxValueExcluded = maxValue.isExcluded,
                         representation     = valueRepresentation[1]
                     };
                     outInfo.mappings.Add(mapping);
                 }
                 else
                 {
                     outInfo.result.HasError = true;
                     outInfo.result.Message  = "ExplicitMappingInvertedRange";
                     return;
                 }
             }
             else
             {
                 outInfo.result.HasError = true;
                 outInfo.result.Message  = "ExplicitMappingInvRngVal";
                 return;
             }
         }
         else
         {
             outInfo.result.HasError = true;
             outInfo.result.Message  = "ExplicitMappingInvalidRange";
             return;
         }
     }
     else
     { // Paranoia; should be checked by caller
         outInfo.result.HasError = true;
         outInfo.result.Message  = "MappingWrongAssignment";
         return;
     }
 }
Exemplo n.º 11
0
 public static void WriteDoubleValue(DoubleVal v, Stream s)
 {
     CompressInteger(v.v1, s);
     CompressInteger(v.v2, s);
 }
Exemplo n.º 12
0
        public override string ToString()
        {
            var  sb      = new StringBuilder("TColumn(");
            bool __first = true;

            if (BoolVal != null && __isset.boolVal)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("BoolVal: ");
                sb.Append(BoolVal == null ? "<null>" : BoolVal.ToString());
            }
            if (ByteVal != null && __isset.byteVal)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("ByteVal: ");
                sb.Append(ByteVal == null ? "<null>" : ByteVal.ToString());
            }
            if (I16Val != null && __isset.i16Val)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("I16Val: ");
                sb.Append(I16Val == null ? "<null>" : I16Val.ToString());
            }
            if (I32Val != null && __isset.i32Val)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("I32Val: ");
                sb.Append(I32Val == null ? "<null>" : I32Val.ToString());
            }
            if (I64Val != null && __isset.i64Val)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("I64Val: ");
                sb.Append(I64Val == null ? "<null>" : I64Val.ToString());
            }
            if (DoubleVal != null && __isset.doubleVal)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("DoubleVal: ");
                sb.Append(DoubleVal == null ? "<null>" : DoubleVal.ToString());
            }
            if (StringVal != null && __isset.stringVal)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("StringVal: ");
                sb.Append(StringVal == null ? "<null>" : StringVal.ToString());
            }
            if (BinaryVal != null && __isset.binaryVal)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("BinaryVal: ");
                sb.Append(BinaryVal == null ? "<null>" : BinaryVal.ToString());
            }
            sb.Append(")");
            return(sb.ToString());
        }
Exemplo n.º 13
0
        public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct("TColumn");
                await oprot.WriteStructBeginAsync(struc, cancellationToken);

                var field = new TField();
                if (BoolVal != null && __isset.boolVal)
                {
                    field.Name = "boolVal";
                    field.Type = TType.Struct;
                    field.ID   = 1;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await BoolVal.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (ByteVal != null && __isset.byteVal)
                {
                    field.Name = "byteVal";
                    field.Type = TType.Struct;
                    field.ID   = 2;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await ByteVal.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (I16Val != null && __isset.i16Val)
                {
                    field.Name = "i16Val";
                    field.Type = TType.Struct;
                    field.ID   = 3;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await I16Val.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (I32Val != null && __isset.i32Val)
                {
                    field.Name = "i32Val";
                    field.Type = TType.Struct;
                    field.ID   = 4;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await I32Val.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (I64Val != null && __isset.i64Val)
                {
                    field.Name = "i64Val";
                    field.Type = TType.Struct;
                    field.ID   = 5;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await I64Val.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (DoubleVal != null && __isset.doubleVal)
                {
                    field.Name = "doubleVal";
                    field.Type = TType.Struct;
                    field.ID   = 6;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await DoubleVal.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (StringVal != null && __isset.stringVal)
                {
                    field.Name = "stringVal";
                    field.Type = TType.Struct;
                    field.ID   = 7;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await StringVal.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (BinaryVal != null && __isset.binaryVal)
                {
                    field.Name = "binaryVal";
                    field.Type = TType.Struct;
                    field.ID   = 8;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await BinaryVal.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                await oprot.WriteFieldStopAsync(cancellationToken);

                await oprot.WriteStructEndAsync(cancellationToken);
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
Exemplo n.º 14
0
        private void parseExplicitNumericMapping(string[] valueRepresentation,
                                                 ref PlaceholderInfo outInfo)
        {
            System.Diagnostics.Trace.Assert(valueRepresentation.Length == 2);

            string[] rangeStrings = valueRepresentation[0].Split('.');
            if (rangeStrings.Length == 1)
            {
                DoubleVal value = parseValue(rangeStrings[0]);
                if (value.isValid)
                {
                    NumericMapping mapping = new NumericMapping  {
                        minValue       = value.value,
                        maxValue       = value.value,
                        representation = valueRepresentation[1]
                    };
                    outInfo.numericMappings.Add(mapping);
                }
                else
                {
                    outInfo.result.HasError = true;
                    outInfo.result.Message  = "ExplicitMappingInvalidValue";
                    return;
                }
            }
            else if ((rangeStrings.Length == 3) && (rangeStrings[1].Length == 0))
            {
                DoubleVal minValue = parseRangeValue(rangeStrings[0], /* isMin = */ true);
                DoubleVal maxValue = parseRangeValue(rangeStrings[2], /* isMin = */ false);
                if (minValue.isValid && maxValue.isValid)
                {
                    if (minValue.value < maxValue.value)
                    {
                        NumericMapping mapping = new NumericMapping {
                            minValue           = minValue.value,
                            isMinValueExcluded = minValue.isExcluded,
                            maxValue           = maxValue.value,
                            isMaxValueExcluded = maxValue.isExcluded,
                            representation     = valueRepresentation[1]
                        };
                        outInfo.numericMappings.Add(mapping);
                    }
                    else
                    {
                        outInfo.result.HasError = true;
                        outInfo.result.Message  = "ExplicitMappingInvertedRange";
                        return;
                    }
                }
                else
                {
                    outInfo.result.HasError = true;
                    outInfo.result.Message  = "ExplicitMappingInvRngVal";
                    return;
                }
            }
            else
            {
                outInfo.result.HasError = true;
                outInfo.result.Message  = "ExplicitMappingInvalidRange";
                return;
            }
        }