|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ASTPlSqlMultiplicativeExpression.java | 0% | 0% | 0% | 0% |
|
1 |
/* JJT: 0.2.2 */
|
|
2 |
|
|
3 |
package mobisnap.mobile_trx;
|
|
4 |
|
|
5 |
import java.util.*;
|
|
6 |
|
|
7 |
/**
|
|
8 |
* Implements multiplicative expression
|
|
9 |
*/
|
|
10 |
public class ASTPlSqlMultiplicativeExpression extends mobisnap.mobile_trx.SimpleNode { |
|
11 |
public static final byte OP_MULTI = 0; |
|
12 |
public static final byte OP_DIVI = 1; |
|
13 |
|
|
14 |
public ASTPlSqlExpotentExpression first;
|
|
15 |
public Vector ands;
|
|
16 |
|
|
17 | 0 |
public ASTPlSqlMultiplicativeExpression(int id) { |
18 | 0 |
super(id);
|
19 | 0 |
ands = new Vector();
|
20 |
} |
|
21 |
|
|
22 | 0 |
public ASTPlSqlMultiplicativeExpression( MobisnapSQL p, int i) { |
23 | 0 |
super( p, i);
|
24 | 0 |
id = i; |
25 | 0 |
ands = new Vector();
|
26 |
} |
|
27 |
|
|
28 |
/** Accept the visitor. **/
|
|
29 | 0 |
public Object jjtAccept(MobisnapSQLVisitor visitor, Object data) {
|
30 | 0 |
return visitor.visit(this, data); |
31 |
} |
|
32 |
|
|
33 |
public class term { |
|
34 |
public byte opType; |
|
35 |
public ASTPlSqlExpotentExpression expr;
|
|
36 |
|
|
37 | 0 |
public term( byte opType, ASTPlSqlExpotentExpression expr) { |
38 | 0 |
this.opType = opType;
|
39 | 0 |
this.expr = expr;
|
40 |
} |
|
41 |
}; |
|
42 |
|
|
43 | 0 |
public void insert( byte opType, ASTPlSqlExpotentExpression expr) { |
44 | 0 |
ands.addElement( new term( opType, expr));
|
45 |
} |
|
46 |
|
|
47 |
/**
|
|
48 |
* Returns the value of the expression
|
|
49 |
*
|
|
50 |
* @param msql_type Specifies which type of processing should be performed
|
|
51 |
* MobisnapConstants.MSQL_SERVER = 1
|
|
52 |
* MobisnapConstants.MSQL_TENTATIVE_CLIENT = 2
|
|
53 |
* MobisnapConstants.MSQL_STABLE_CLIENT = 3
|
|
54 |
* MobisnapConstants.MSQL_RESERVATION_CLIENT = 4
|
|
55 |
* @param cond True if reservations associated iwth transaction should be
|
|
56 |
* propagated to the current transaction
|
|
57 |
*/
|
|
58 | 0 |
public Object value( int msql_type, boolean cond) throws Exception { |
59 | 0 |
Object val = first.value( msql_type, cond); |
60 | 0 |
for( int i = 0; i < ands.size(); i++) { |
61 | 0 |
term t = (term)ands.elementAt( i); |
62 | 0 |
if( t.opType == OP_MULTI)
|
63 | 0 |
val = MSQLTypeUtil.multiply( val, t.expr.value( msql_type, cond)); |
64 |
else
|
|
65 | 0 |
val = MSQLTypeUtil.divide( val, t.expr.value( msql_type, cond)); |
66 |
} |
|
67 | 0 |
return val;
|
68 |
} |
|
69 |
|
|
70 |
} |
|
71 |
|
|