Beispiel #1
0
        public override StringBuilder StringVhdlRealization(KeyValuePair <string, TimeInterval> param)
        {
            StringBuilder res = new StringBuilder();

            res.Append("\n").Append(param.Key).Append(" <= ");
            switch (genValue)
            {
            case GeneratorSettings.GeneratedValue.EnumerableValue:
                res.Append('\'' + EnumerableValue.ToString() + '\'');
                break;

            case GeneratorSettings.GeneratedValue.IntegerValue:
                res.Append(IntegerValue.ToString(System.Globalization.CultureInfo.InvariantCulture));
                break;

            case GeneratorSettings.GeneratedValue.DoubleValue:
                res.Append(DoubleValue.ToString(System.Globalization.CultureInfo.InvariantCulture));
                break;

            default:
                break;
            }
            res.Append(" ; ").Append("\n");
            return(res);
        }
        protected override string ConvertValue(string newValue)
        {
            base.ConvertValue(newValue);
            DoubleValue = DoubleValue < 0 ? 0 : Math.Abs(DoubleValue);

            return(DoubleValue.ToString());
        }
Beispiel #3
0
 public override string ToString()
 {
     if (StrValue != null)
     {
         return(StrValue);
     }
     if (IntValue != null)
     {
         return(IntValue.ToString());
     }
     if (LongValue != null)
     {
         return(LongValue.ToString());
     }
     if (DoubleValue != null)
     {
         return(DoubleValue.ToString());
     }
     if (DateValue != null)
     {
         return(DateValue.Value.ToShortDateString());
     }
     if (DecimalValue != null)
     {
         return(DecimalValue.Value.ToString(CultureInfo.InvariantCulture));
     }
     if (ArrayValue != null)
     {
         return(string.Join(", ", ArrayValue));
     }
     return(string.Empty);
 }
Beispiel #4
0
        private void UpdateXmlDocument()
        {
            xmlDocument.RemoveAll();

            XmlNode root = xmlDocument.CreateElement(typeof(CLRDataItem).Name);

            xmlDocument.AppendChild(root);

            XmlElement stringProperty = xmlDocument.CreateElement("StringValue");

            stringProperty.InnerText = StringValue;
            root.AppendChild(stringProperty);

            XmlElement intProperty = xmlDocument.CreateElement("IntegerValue");

            intProperty.InnerText = IntegerValue.ToString();
            root.AppendChild(intProperty);

            XmlAttribute boolAttribute = xmlDocument.CreateAttribute("BooleanValue");

            boolAttribute.Value = BooleanValue.ToString();
            root.Attributes.Append(boolAttribute);

            XmlAttribute doubleAttribute = xmlDocument.CreateAttribute("DoubleValue");

            doubleAttribute.Value = DoubleValue.ToString();
            root.Attributes.Append(doubleAttribute);

            XmlAttribute floatAttribute = xmlDocument.CreateAttribute("FloatValue");

            floatAttribute.Value = FloatValue.ToString();
            root.Attributes.Append(floatAttribute);
        }
Beispiel #5
0
        void ShowValue()
        {
            textBox.Foreground = _ForeBrush;

            if (DataMode == LynxUpDownDataMode.LongMode)
            {
                textBox.Text = LongValue.ToString();
                return;
            }
            string s = "0";

            if (DataMode == LynxUpDownDataMode.DecimalMode)
            {
                s = DecimalValue.ToString();
            }
            if (DataMode == LynxUpDownDataMode.DoubleMode)
            {
                s = DoubleValue.ToString();
            }
            int f = s.LastIndexOf('.');

            if (f == -1)
            {
                textBox.Text = s;
            }
            else
            {
                int l = f + _floatNum + 1;
                if (l > s.Length)
                {
                    l = s.Length;
                }
                textBox.Text = s.Substring(0, l);
            }
        }
Beispiel #6
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("O numero : ");
            sb.AppendLine(Value.ToString("F2", CultureInfo.InvariantCulture));
            sb.AppendLine(Even);
            sb.AppendLine(Odds);
            if (Value > 10)
            {
                sb.AppendLine("O Numero é maior que 10!!");
            }
            else if (Value == 10)
            {
                sb.AppendLine("O numero é igual a 10");
            }
            else
            {
                sb.AppendLine("O Numero é menor que 10!!");
            }
            sb.Append("O Dobro de " + Value.ToString("F2", CultureInfo.InvariantCulture) + " é ");
            sb.AppendLine(DoubleValue.ToString("F2", CultureInfo.InvariantCulture));
            sb.AppendLine(Prime);
            return(sb.ToString());
        }
Beispiel #7
0
 public override string ToString()
 {
     if (IsInteger)
     {
         return(IntValue.ToString());
     }
     return(DoubleValue.ToString("N2"));
 }
Beispiel #8
0
            private void ResolveSubtraction()
            {
                if (Arguments.Count != 2)
                {
                    return;
                }

                DoubleValue = ResolveArgumentValue(Arguments[0]) - ResolveArgumentValue(Arguments[1]);
                Value       = DoubleValue.ToString();
            }
Beispiel #9
0
            private void ResolveMultipy()
            {
                if (Arguments.Count != 2)
                {
                    return;
                }

                DoubleValue = ResolveArgumentValue(Arguments[0]) * ResolveArgumentValue(Arguments[1]);
                Value       = DoubleValue.ToString();
            }
Beispiel #10
0
        public override string ToString()
        {
            try
            {
                Type propType = !IsTie ? AnchorAttributePropertyInfo.PropertyType
                    : TieValueType;

                if (propType.Equals(typeof(int)) || propType.Equals(typeof(long))
                    || propType.Equals(typeof(byte)))
                {
                    return LongValue.ToString();
                }
                else
                    if (propType.Equals(typeof(float)) || propType.Equals(typeof(double)))
                {
                    return DoubleValue.ToString();
                }
                else
                    if (propType.Equals(typeof(decimal)))
                {
                    return DecimalValue.ToString();
                }
                else
                    if (propType.Equals(typeof(string)))
                {
                    return StringValue;
                }
                else
                    if (propType.Equals(typeof(bool)))
                {
                    return BoolValue.ToString();
                }
                else
                    if (propType.Equals(typeof(DateTime)))
                {
                    return TimeValue.ToString();
                }
                else
                    if (propType.Equals(typeof(Guid)))
                {
                    return TimeValue.ToString();
                }
                else
                {
                    return base.ToString();
                }
            }
            catch
            {
                //TODO : write to logger
                return null;
            }
        }
 public override string ToString()
 {
     if (typeOf == typeof(System.DateTime))
     {
         return(DateValue.ToString());
     }
     else if (typeOf == typeof(System.Double))
     {
         return(DoubleValue.ToString());
     }
     return(StringValue);
 }
Beispiel #12
0
        string IConvertible.ToString(IFormatProvider provider)
        {
            switch (IntPtr.Size)
            {
            case 4:
                return(SingleValue.ToString(provider));

            case 8:
                return(DoubleValue.ToString(provider));

            default:
                throw GetError();
            }
        }
Beispiel #13
0
        public override string ToString()
        {
            switch (IntPtr.Size)
            {
            case 4:
                return(SingleValue.ToString());

            case 8:
                return(DoubleValue.ToString());

            default:
                throw GetError();
            }
        }
Beispiel #14
0
        public override string ToString()
        {
            var    type = _typesStrings[(int)Type];
            string value;

            switch (Type)
            {
            case IndexValueType.String:
                value = StringValue;
                break;

            case IndexValueType.StringArray:
                throw new NotSupportedException();

            case IndexValueType.Bool:
                value = BooleanValue ? IndexValue.Yes : IndexValue.No;
                break;

            case IndexValueType.Int:
                value = IntegerValue.ToString(CultureInfo.InvariantCulture);
                break;

            case IndexValueType.IntArray:
                //throw new NotSupportedException();
                //UNDONE: Investigate this modification because it can cause deserialization- or parsing errors.
                value = $"[{string.Join(",", IntegerArrayValue.Select(x => x.ToString()))}]";
                break;

            case IndexValueType.Long:
                value = LongValue.ToString(CultureInfo.InvariantCulture);
                break;

            case IndexValueType.Float:
                value = SingleValue.ToString(CultureInfo.InvariantCulture);
                break;

            case IndexValueType.Double:
                value = DoubleValue.ToString(CultureInfo.InvariantCulture);
                break;

            case IndexValueType.DateTime:
                value = DateTimeValue.ToString("yyyy-MM-dd HH:mm:ss.ffff");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return($"{value}:{type}");
        }
Beispiel #15
0
        public override string ToString()
        {
            string valueSring = "";

            if (scale > 0)
            {
                valueSring = DoubleValue.ToString("0.".PadRight(scale + 2, '0'));
            }
            else
            {
                valueSring = DoubleValue.ToString("0");
            }

            return(string.Format("{0} {1}", valueSring, unitOfMeasure));
        }
Beispiel #16
0
        public string ToStringWithoutUnitOfMeasure()
        {
            string valueSring = "";

            if (scale > 0)
            {
                valueSring = DoubleValue.ToString("0.".PadRight(scale + 2, '0'));
            }
            else
            {
                valueSring = DoubleValue.ToString("0");
            }

            return(valueSring);
        }
Beispiel #17
0
 public override string ToString()
 {
     if (IsSymbol)
     {
         return(Value.ToString());
     }
     if (IsString)
     {
         return(StringValue);
     }
     if (IsInt)
     {
         return(IntValue.ToString(CultureInfo.InvariantCulture));
     }
     if (IsDouble)
     {
         return(DoubleValue.ToString(CultureInfo.InvariantCulture));
     }
     if (IsBool)
     {
         return(BoolValue ? "#t" : "#f");
     }
     if (IsNil)
     {
         return(LispToken.Nil);
     }
     if (IsList)
     {
         return(ExpandContainerToString(ListValue));
     }
     if (IsFunction)
     {
         return("function " + (FunctionValue.Signature != null ? FunctionValue.Signature : "<unknown>"));
     }
     if (IsNativeObject)
     {
         return(NativeObjectStringRepresentation);
     }
     if (IsUndefined)
     {
         return("<undefined>");
     }
     if (IsError)
     {
         return("Error: " + Value);
     }
     return("?");
 }
Beispiel #18
0
 /// <summary>
 /// Comverts this value into a string representation used by the compiler module.
 /// </summary>
 /// <returns>The string representation</returns>
 public string ToStringCompiler()
 {
     if (IsBool)
     {
         return(BoolValue ? "true" : "false");
     }
     if (IsDouble)
     {
         return(DoubleValue.ToString("F", CultureInfo.InvariantCulture));
     }
     if (IsString)
     {
         return("\"" + StringValue + "\"");
     }
     return(ToString());
 }
Beispiel #19
0
        public override string ToString()
        {
            switch (Type)
            {
            case UniversalClassType.Numeric:
                return(DoubleValue.ToString(CultureInfo.InvariantCulture));

            case UniversalClassType.TimeSpan:
                return(TimespanValue.ToString());

            case UniversalClassType.String:
                return(StringValue);

            default:
                throw new Exception("Unknown type " + Type);
            }
        }
Beispiel #20
0
        public override string ToString()
        {
            switch (genValue)
            {
            case GeneratorSettings.GeneratedValue.EnumerableValue:
                return("Constant" + '\'' + EnumerableValue.ToString() + '\'');

            case GeneratorSettings.GeneratedValue.IntegerValue:
                return("Constant" + IntegerValue.ToString());

            case GeneratorSettings.GeneratedValue.DoubleValue:
                return("Constant" + DoubleValue.ToString());

            default:
                return(string.Empty);
            }
        }
Beispiel #21
0
        public override string GetStringStartValue()
        {
            switch (genValue)
            {
            case GeneratorSettings.GeneratedValue.EnumerableValue:
                return('\'' + EnumerableValue.ToString() + '\'');

            case GeneratorSettings.GeneratedValue.IntegerValue:
                return(IntegerValue.ToString());

            case GeneratorSettings.GeneratedValue.DoubleValue:
                return(DoubleValue.ToString());

            default:
                return(string.Empty);
            }
        }
Beispiel #22
0
        public override string ToString()
        {
            var    type = "SABILFDT"[(int)Type];
            string value;

            switch (Type)
            {
            case IndexValueType.String:
                value = StringValue;
                break;

            case IndexValueType.StringArray:
                throw new NotSupportedException();

            case IndexValueType.Bool:
                value = BooleanValue ? IndexValue.Yes : IndexValue.No;
                break;

            case IndexValueType.Int:
                value = IntegerValue.ToString(CultureInfo.InvariantCulture);
                break;

            case IndexValueType.Long:
                value = LongValue.ToString(CultureInfo.InvariantCulture);
                break;

            case IndexValueType.Float:
                value = SingleValue.ToString(CultureInfo.InvariantCulture);
                break;

            case IndexValueType.Double:
                value = DoubleValue.ToString(CultureInfo.InvariantCulture);
                break;

            case IndexValueType.DateTime:
                value = DateTimeValue.ToString("yyyy-MM-dd HH:mm:ss.ffff");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return($"{value}:{type}");
        }
Beispiel #23
0
            private void ResolveDivide()
            {
                if (Arguments.Count != 2)
                {
                    return;
                }

                double v = ResolveArgumentValue(Arguments[1]);

                if (v == 0)
                {
                    DoubleValue = 0;
                }
                else
                {
                    DoubleValue = ResolveArgumentValue(Arguments[0]) / v;
                }

                Value = DoubleValue.ToString();
            }
Beispiel #24
0
        public override string ToString()
        {
            switch (Type)
            {
            case SQLiteColumnType.BLOB:
                return("0x" + Conversions.ToHexa(BlobValue));

            case SQLiteColumnType.REAL:
                return(DoubleValue.ToString(CultureInfo.CurrentCulture));

            case SQLiteColumnType.INTEGER:
                return(Int64Value.ToString(CultureInfo.CurrentCulture));

            case SQLiteColumnType.NULL:
                return("<NULL>");

            default:
                return(StringValue);
            }
        }
        private void IBDoubleBox_LostFocus(object sender, RoutedEventArgs e)
        {
            double value;

            if (double.TryParse(Text, out value))
            {
                if (value > Maximum)
                {
                    value = Maximum;
                }
                else if (value < 0.0)
                {
                    value = 0.0;
                }

                string temp = value.ToString(Format);
                DoubleValue = double.Parse(temp);
            }

            Text = DoubleValue.ToString(Format);
        }
Beispiel #26
0
        private string GetValue()
        {
            if (IntValue.HasValue)
            {
                return(IntValue.ToString());
            }

            if (DoubleValue.HasValue)
            {
                return(DoubleValue.ToString());
            }

            if (!string.IsNullOrEmpty(VariableName))
            {
                return(VariableName);
            }

            if (!string.IsNullOrEmpty(BoolValue))
            {
                return((BoolValue == Constants.TRUE_VALUE ? 1 : 0).ToString());
            }
            return("");
        }
Beispiel #27
0
 public string GetStringValue()
 {
     if (BoolValue != null)
     {
         return(BoolValue.ToString());
     }
     if (IntValue.HasValue)
     {
         return(IntValue.ToString());
     }
     if (DoubleValue.HasValue)
     {
         return(DoubleValue.ToString());
     }
     if (!string.IsNullOrEmpty(StringValue))
     {
         return(StringValue);
     }
     else
     {
         return("None");
     }
 }
Beispiel #28
0
        public override string ToString()
        {
            StringBuilder resultBuilder = new StringBuilder(PublisherName);

            resultBuilder.Append(" -- ");

            if (ObjectValue != null)
            {
                resultBuilder.Append("obj=").Append(ObjectValue.ToString());
            }
            if (StringValue != null)
            {
                resultBuilder.Append("str=").Append(StringValue.ToString());
            }
            if (DoubleValue != null)
            {
                resultBuilder.Append("dbl=").Append(DoubleValue.ToString());
            }
            if (MatrixValue != null)
            {
                resultBuilder.Append("mtx").Append(MatrixValue.ToString());
            }

            if (_headers != null)
            {
                resultBuilder.Append("\t{");
                foreach (KeyValuePair <string, object> header in _headers)
                {
                    // TODO null-checks
                    // TODO recursivly dive into headers ??? possibly change to string,string
                    resultBuilder.Append(" {").Append(header.Key).Append(" ").Append(header.Value.ToString()).Append("}");
                }
                resultBuilder.Append(" }");
            }

            return(resultBuilder.ToString());
        }
Beispiel #29
0
        public override string ToString()
        {
            if (IsNull)
            {
                return("");
            }
            switch (DataTypeName)
            {
            case "System.Int32":
                return(IntValue.ToString());

            case "System.String":
                return(StringValue);

            case "System.Double":
                return(DoubleValue.ToString());

            case "System.DateTime":
                return(DateTimeValue.ToString());

            default:
                return(ObjectValue.ToString());
            }
        }
Beispiel #30
0
 public string ToString_()
 {
     return(DoubleValue.ToString("g"));
 }