KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > medor > expression > lib > DivideBy


1 /**
2  * MEDOR: Middleware Enabling Distributed Object Requests
3  *
4  * Copyright (C) 2001-2003 France Telecom R&D
5  * Contact: alexandre.lefebvre@rd.francetelecom.com
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  *
21  * Initial developers: M. Alia, A. Lefebvre
22  */

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 JavaDoc;
30 import java.math.BigInteger JavaDoc;
31 import java.sql.Time JavaDoc;
32 import java.sql.Timestamp JavaDoc;
33 import java.util.Date JavaDoc;
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 JavaDoc evaluate(BigDecimal JavaDoc op1, BigDecimal JavaDoc op2) {
150         BigDecimal JavaDoc result = op1.divide(op2, BigDecimal.ROUND_UNNECESSARY);
151         return result;
152     }
153
154     public BigInteger JavaDoc evaluate(BigInteger JavaDoc op1, BigInteger JavaDoc op2) {
155         BigInteger JavaDoc result = op1.mod(op2);
156         return result;
157     }
158
159     public String JavaDoc evaluate(String JavaDoc op1, String JavaDoc op2) throws TypingException {
160         throw new TypingException("div(String, String)?");
161     }
162
163     public String JavaDoc evaluate(String JavaDoc op1, char op2) throws TypingException {
164         throw new TypingException("div(String, Char)?");
165     }
166
167     public String JavaDoc evaluate(char op1, String JavaDoc op2) throws TypingException {
168         throw new TypingException("div(char, String)?");
169     }
170
171     public Timestamp JavaDoc evaluate(Timestamp JavaDoc op1, Timestamp JavaDoc op2)
172             throws TypingException {
173         throw new TypingException("div(Timestamp, Timestamp)?");
174     }
175
176     public Time JavaDoc evaluate(Time JavaDoc op1, Time JavaDoc op2) throws TypingException {
177         throw new TypingException("div(Time, Time)?");
178     }
179
180     public Date JavaDoc evaluate(Date JavaDoc op1, Date JavaDoc op2) throws TypingException {
181         throw new TypingException("div(Date, Date)?");
182     }
183
184     public String JavaDoc getOperatorString() {
185         return Operator.DIV;
186     }
187
188 }
189
Popular Tags