KickJava   Java API By Example, From Geeks To Geeks.

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


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, S. Chassande-Barrioz, 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.util.Date JavaDoc;
32
33 /**
34  * This class represents the Modulo operator.
35  */

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 JavaDoc evaluate(BigDecimal JavaDoc op1, BigDecimal JavaDoc op2) {
151         return new BigDecimal JavaDoc(0);
152     }
153
154     public BigInteger JavaDoc evaluate(BigInteger JavaDoc op1, BigInteger JavaDoc op2) {
155         BigInteger JavaDoc result = op1.divide(op2);
156         return result;
157     }
158
159     public String JavaDoc evaluate(String JavaDoc op1, String JavaDoc op2) throws TypingException {
160         throw new TypingException("mod(String, String)?");
161     }
162
163     public String JavaDoc evaluate(String JavaDoc op1, char op2) throws TypingException {
164         throw new TypingException("mod(String, Char)?");
165     }
166
167     public String JavaDoc evaluate(char op1, String JavaDoc op2) throws TypingException {
168         throw new TypingException("mod(char, String)?");
169     }
170
171     public Date JavaDoc evaluate(Date JavaDoc op1, Date JavaDoc op2) throws TypingException {
172         throw new TypingException("mod(Date, Date)?");
173     }
174
175     public String JavaDoc getOperatorString() {
176         return Operator.MOD;
177     }
178 }
179
Popular Tags