コード例 #1
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");
     }
 }
コード例 #2
0
ファイル: IntValue.cs プロジェクト: d074460/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
ファイル: IntValue.cs プロジェクト: bi-tm/openABAP
 public void Set( IfValue v )
 {
     this.Value = v.GetInt();
 }
コード例 #4
0
ファイル: IntValue.cs プロジェクト: d074460/openABAP
 public void Set(IfValue v)
 {
     this.Value = v.GetInt();
 }