1 23 24 27 package org.objectweb.medor.expression.lib; 28 29 import org.objectweb.medor.expression.api.Expression; 30 import org.objectweb.medor.expression.api.Operator; 31 import org.objectweb.medor.expression.api.TypingException; 32 33 import java.math.BigDecimal ; 34 import java.math.BigInteger ; 35 import java.sql.Time ; 36 import java.sql.Timestamp ; 37 import java.util.Date ; 38 39 43 public class Plus extends BasicBinaryArithmeticOperator { 44 45 public Plus() { 46 } 47 48 public Plus(Expression l, Expression r) { 49 super(l, r); 50 } 51 52 public int evaluate(int op1, int op2) { 53 int result = op1 + op2; 54 return result; 55 } 56 57 public int evaluate(int op1, short op2) { 58 int result = op1 + op2; 59 return result; 60 } 61 62 public long evaluate(int op1, long op2) { 63 long result = op1 + op2; 64 return result; 65 } 66 67 public float evaluate(int op1, float op2) { 68 float result = op1 + op2; 69 return result; 70 } 71 72 public double evaluate(int op1, double op2) { 73 double result = op1 + op2; 74 return result; 75 } 76 77 public float evaluate(float op1, float op2) { 78 float result = op1 + op2; 79 return result; 80 } 81 82 public float evaluate(float op1, short op2) { 83 float result = op1 + op2; 84 return result; 85 } 86 87 public float evaluate(float op1, int op2) { 88 float result = op1 + op2; 89 return result; 90 } 91 92 public float evaluate(float op1, long op2) { 93 float result = op1 + op2; 94 return result; 95 } 96 97 public double evaluate(float op1, double op2) { 98 double result = op1 + op2; 99 return result; 100 } 101 102 public int evaluate(char op1, char op2) { 103 int result = op1 + op2; 104 return result; 105 } 106 107 public String evaluate(char op1, String op2) throws TypingException { 108 return op1 + op2; 109 } 110 111 public long evaluate(long op1, long op2) { 112 long result = op1 + op2; 113 return result; 114 } 115 116 public long evaluate(long op1, short op2) { 117 long result = op1 + op2; 118 return result; 119 } 120 121 public long evaluate(long op1, int op2) { 122 long result = op1 + op2; 123 return result; 124 } 125 126 public float evaluate(long op1, float op2) { 127 float result = op1 + op2; 128 return result; 129 } 130 131 public double evaluate(long op1, double op2) { 132 double result = op1 + op2; 133 return result; 134 } 135 136 public double evaluate(double op1, double op2) { 137 double result = op1 + op2; 138 return result; 139 } 140 141 public double evaluate(double op1, short op2) { 142 double result = op1 + op2; 143 return result; 144 } 145 146 public double evaluate(double op1, int op2) { 147 double result = op1 + op2; 148 return result; 149 } 150 151 public double evaluate(double op1, float op2) { 152 double result = op1 + op2; 153 return result; 154 } 155 156 public double evaluate(double op1, long op2) { 157 double result = op1 + op2; 158 return result; 159 } 160 161 public BigDecimal evaluate(BigDecimal op1, BigDecimal op2) { 162 BigDecimal result = op1.add(op2); 163 return result; 164 } 165 166 public BigInteger evaluate(BigInteger op1, BigInteger op2) { 167 BigInteger result = op1.add(op2); 168 return result; 169 } 170 171 public String evaluate(String op1, String op2) throws TypingException { 172 return op1 + op2; 173 } 174 175 public String evaluate(String op1, char op2) throws TypingException { 176 return op1 + op2; 177 } 178 179 public Timestamp evaluate(Timestamp op1, Timestamp op2) 180 throws TypingException { 181 throw new TypingException("Mult(Timestamp, Timestamp)"); 182 } 183 184 public Time evaluate(Time op1, Time op2) throws TypingException { 185 throw new TypingException("Mult(Time, Time)"); 186 } 187 188 public Date evaluate(Date op1, Date op2) throws TypingException { 189 throw new TypingException("Mult(Date, Date)"); 190 } 191 192 public String getOperatorString() { 193 return Operator.PLUS; 194 } 195 } 196 | Popular Tags |