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.util.Date ; 32 33 36 public class Mod extends BasicBinaryArithmeticOperator { 37 38 public Mod() { 39 super(); 40 } 41 42 public Mod(Expression l, Expression r) { 43 super(l, r); 44 } 45 46 public int evaluate(int op1, int op2) { 47 int result = op1 % op2; 48 return result; 49 } 50 51 public int evaluate(int op1, short op2) { 52 int result = op1 % op2; 53 return result; 54 } 55 56 public long evaluate(int op1, long op2) { 57 long result = op1 % op2; 58 return result; 59 } 60 61 public float evaluate(int op1, float op2) { 62 float result = op1 % op2; 63 return result; 64 } 65 66 public double evaluate(int op1, double op2) { 67 double result = op1 % op2; 68 return result; 69 } 70 71 public float evaluate(float op1, float op2) { 72 float result = op1 % op2; 73 return result; 74 } 75 76 public float evaluate(float op1, short op2) { 77 float result = op1 % op2; 78 return result; 79 } 80 81 public float evaluate(float op1, int op2) { 82 float result = op1 % op2; 83 return result; 84 } 85 86 public float evaluate(float op1, long op2) { 87 float result = op1 % op2; 88 return result; 89 } 90 91 public double evaluate(float op1, double op2) { 92 double result = op1 % op2; 93 return result; 94 } 95 96 public int evaluate(char op1, char op2) throws TypingException { 97 throw new TypingException("div(String, String)?"); 98 } 99 100 public long evaluate(long op1, long op2) { 101 long result = op1 % op2; 102 return result; 103 } 104 105 public long evaluate(long op1, short op2) { 106 long result = op1 % op2; 107 return result; 108 } 109 110 public long evaluate(long op1, int op2) { 111 long result = op1 % op2; 112 return result; 113 } 114 115 public float evaluate(long op1, float op2) { 116 float result = op1 % op2; 117 return result; 118 } 119 120 public double evaluate(long op1, double op2) { 121 double result = op1 % op2; 122 return result; 123 } 124 125 public double evaluate(double op1, double op2) { 126 double result = op1 % op2; 127 return result; 128 } 129 130 public double evaluate(double op1, short op2) { 131 double result = op1 % op2; 132 return result; 133 } 134 135 public double evaluate(double op1, int op2) { 136 double result = op1 % op2; 137 return result; 138 } 139 140 public double evaluate(double op1, float op2) { 141 double result = op1 % op2; 142 return result; 143 } 144 145 public double evaluate(double op1, long op2) { 146 double result = op1 % op2; 147 return result; 148 } 149 150 public BigDecimal evaluate(BigDecimal op1, BigDecimal op2) { 151 return new BigDecimal (0); 152 } 153 154 public BigInteger evaluate(BigInteger op1, BigInteger op2) { 155 BigInteger result = op1.divide(op2); 156 return result; 157 } 158 159 public String evaluate(String op1, String op2) throws TypingException { 160 throw new TypingException("mod(String, String)?"); 161 } 162 163 public String evaluate(String op1, char op2) throws TypingException { 164 throw new TypingException("mod(String, Char)?"); 165 } 166 167 public String evaluate(char op1, String op2) throws TypingException { 168 throw new TypingException("mod(char, String)?"); 169 } 170 171 public Date evaluate(Date op1, Date op2) throws TypingException { 172 throw new TypingException("mod(Date, Date)?"); 173 } 174 175 public String getOperatorString() { 176 return Operator.MOD; 177 } 178 } 179 | Popular Tags |