Beispiel #1
0
            public ExpAtom(string source, ExpAtomType type)
            {
                _type      = type;
                _value     = EDecimal.NaN;
                _operation = OperationType.None;

                if (ExpAtomType.Numeric == type)
                {
                    try {
                        _value = EDecimal.FromString(source);
                    } catch {
                        _type = ExpAtomType.None;
                    }
                }
                else if (1 != source.Length)
                {
                    _type = ExpAtomType.None;
                }
                else
                {
                    switch (source[0])
                    {
                    case '+': _operation = OperationType.Addition; break;

                    case '-': _operation = OperationType.Substraction; break;

                    case '/': _operation = OperationType.Division; break;

                    case '*': _operation = OperationType.Multiplication; break;

                    default: _operation = OperationType.None; _type = ExpAtomType.None; break;
                    }
                }
            }
Beispiel #2
0
 public ExpAtom(EDecimal value)
 {
     _type      = ExpAtomType.Numeric;
     _value     = value;
     _operation = OperationType.None;
 }