コード例 #1
0
ファイル: CharValue.cs プロジェクト: bi-tm/openABAP
 public IfValue Calculate(string op, IfValue v=null)
 {
     switch (op) {
         case "+": return new DecValue(this.GetFloat() + v.GetFloat());
         case "-": return new DecValue(this.GetFloat() - v.GetFloat());
         case "*": return new DecValue(this.GetFloat() * v.GetFloat());
         case "/": return new DecValue(this.GetFloat() / v.GetFloat());
         default:  return new DecValue(this.GetFloat());
     }
 }
コード例 #2
0
ファイル: IntValue.cs プロジェクト: bi-tm/openABAP
 public IfValue Calculate(string op, IfValue v=null)
 {
     switch (op) {
         case "+": if (v != null) return new IntValue(this.Value + v.GetInt());
                             else return new IntValue(this.Value);
         case "-": if (v != null) return new IntValue(this.Value - v.GetInt());
                             else return new IntValue(-this.Value);
         case "*": if (v != null) return new IntValue(this.Value * v.GetInt());
                             else throw new RuntimeError("right operand missing in expression");
         case "/": if (v != null) return new IntValue(this.Value / v.GetInt());
                             else throw new RuntimeError("right operand missing in expression");
         default:  throw new RuntimeError("unknown operator " + op + " in expression");
     }
 }
コード例 #3
0
ファイル: CharValue.cs プロジェクト: d074460/openABAP
        public IfValue Calculate(string op, IfValue v = null)
        {
            switch (op)
            {
            case "+": return(new DecValue(this.GetFloat() + v.GetFloat()));

            case "-": return(new DecValue(this.GetFloat() - v.GetFloat()));

            case "*": return(new DecValue(this.GetFloat() * v.GetFloat()));

            case "/": return(new DecValue(this.GetFloat() / v.GetFloat()));

            default:  return(new DecValue(this.GetFloat()));
            }
        }
コード例 #4
0
        public IfValue Calculate(string op, IfValue v = null)
        {
            switch (op)
            {
            case "+": if (v != null)
                {
                    return(new DecValue(this.Value + v.GetFloat()));
                }
                else
                {
                    return(new DecValue(this.Value));
                }

            case "-": if (v != null)
                {
                    return(new DecValue(this.Value - v.GetFloat()));
                }
                else
                {
                    return(new DecValue(-this.Value));
                }

            case "*": if (v != null)
                {
                    return(new DecValue(this.Value * v.GetFloat()));
                }
                else
                {
                    throw new RuntimeError("right operand missing in expression");
                }

            case "/": if (v != null)
                {
                    return(new DecValue(this.Value / v.GetFloat()));
                }
                else
                {
                    throw new RuntimeError("right operand missing in expression");
                }

            default:  throw new RuntimeError("unknown operator " + op + " in expression");
            }
        }
コード例 #5
0
ファイル: Expression.cs プロジェクト: bi-tm/openABAP
 public ExpressionLeaf( IfValue v )
 {
     this.Value = v;
 }
コード例 #6
0
ファイル: CharValue.cs プロジェクト: bi-tm/openABAP
 public void Set( IfValue v )
 {
     this.Text = v.GetString();
 }
コード例 #7
0
 public void Set(IfValue v)
 {
     this.Value = v.GetFloat();
 }
コード例 #8
0
ファイル: IntValue.cs プロジェクト: bi-tm/openABAP
 public void Set( IfValue v )
 {
     this.Value = v.GetInt();
 }
コード例 #9
0
 public ExpressionLeaf(IfValue v)
 {
     this.Value = v;
 }
コード例 #10
0
ファイル: CharValue.cs プロジェクト: d074460/openABAP
 public void Set(IfValue v)
 {
     this.Text = v.GetString();
 }
コード例 #11
0
ファイル: IntValue.cs プロジェクト: d074460/openABAP
 public void Set(IfValue v)
 {
     this.Value = v.GetInt();
 }
コード例 #12
0
ファイル: DecValue.cs プロジェクト: bi-tm/openABAP
 public void Set( IfValue v )
 {
     this.Value = v.GetFloat();
 }