|
|||||||||||||||||||
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 | |||||||||||||||
ASTSQLUnaryLogicalExpression.java | 0% | 0% | 0% | 0% |
|
1 |
/* JJT: 0.2.2 */
|
|
2 |
|
|
3 |
package mobisnap.mobile_trx;
|
|
4 |
|
|
5 |
/**
|
|
6 |
* Implements unary logical expression
|
|
7 |
*/
|
|
8 |
public class ASTSQLUnaryLogicalExpression extends mobisnap.mobile_trx.SimpleNode { |
|
9 |
public boolean not = false; |
|
10 |
public boolean existsExpr = false; |
|
11 |
public SimpleNode expr;
|
|
12 |
|
|
13 | 0 |
public ASTSQLUnaryLogicalExpression(int id) { |
14 | 0 |
super(id);
|
15 |
} |
|
16 |
|
|
17 | 0 |
public ASTSQLUnaryLogicalExpression( MobisnapSQL p, int i) { |
18 | 0 |
super( p, i);
|
19 | 0 |
id = i; |
20 |
} |
|
21 |
|
|
22 |
/** Accept the visitor. **/
|
|
23 | 0 |
public Object jjtAccept(MobisnapSQLVisitor visitor, Object data) {
|
24 | 0 |
return visitor.visit(this, data); |
25 |
} |
|
26 |
|
|
27 |
/**
|
|
28 |
* Returns the value of the expression
|
|
29 |
*
|
|
30 |
* @param msql_type Specifies which type of processing should be performed
|
|
31 |
* MobisnapConstants.MSQL_SERVER = 1
|
|
32 |
* MobisnapConstants.MSQL_TENTATIVE_CLIENT = 2
|
|
33 |
* MobisnapConstants.MSQL_STABLE_CLIENT = 3
|
|
34 |
* MobisnapConstants.MSQL_RESERVATION_CLIENT = 4
|
|
35 |
* MobisnapConstants.MSQL_STATIC = 10
|
|
36 |
* @param cond True if reservations associated iwth transaction should be
|
|
37 |
* propagated to the current transaction
|
|
38 |
*/
|
|
39 | 0 |
public Object value( int msql_type, boolean cond) throws Exception { |
40 | 0 |
if( existsExpr)
|
41 | 0 |
throw new UnknownValueException( "exists expression in SQLUnaryLocicalExpression"); |
42 | 0 |
Object val = expr.value( msql_type, cond); |
43 | 0 |
if( ! not)
|
44 | 0 |
return val;
|
45 | 0 |
return MSQLTypeUtil.not( val);
|
46 |
|
|
47 |
} |
|
48 |
|
|
49 |
/**
|
|
50 |
* Returns a simplified node, if possible (usefull in expressions)
|
|
51 |
*
|
|
52 |
* @param msql_type Specifies which type of processing should be performed
|
|
53 |
* MobisnapConstants.MSQL_SERVER = 1
|
|
54 |
* MobisnapConstants.MSQL_TENTATIVE_CLIENT = 2
|
|
55 |
* MobisnapConstants.MSQL_STABLE_CLIENT = 3
|
|
56 |
* MobisnapConstants.MSQL_RESERVATION_CLIENT = 4
|
|
57 |
* MobisnapConstants.MSQL_STATIC = 10
|
|
58 |
* @param cond True if reservations associated iwth transaction should be
|
|
59 |
* propagated to the current transaction
|
|
60 |
*/
|
|
61 | 0 |
public SimpleNode simplify( int msql_type, boolean cond) { |
62 | 0 |
expr = (SimpleNode)expr.simplify( msql_type, cond); |
63 | 0 |
if( existsExpr)
|
64 | 0 |
return this; |
65 | 0 |
try {
|
66 | 0 |
return new SimpleNodeValue( value( msql_type, cond)); |
67 |
} catch( Exception e) {
|
|
68 | 0 |
if( ! not)
|
69 | 0 |
return expr;
|
70 |
else
|
|
71 | 0 |
return this; |
72 |
} |
|
73 |
} |
|
74 |
} |
|
75 |
|
|