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