-
Notifications
You must be signed in to change notification settings - Fork 0
/
CondExpr.java
executable file
·60 lines (59 loc) · 1.44 KB
/
CondExpr.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package iterator.sm_join_assign_src;
import global.*;
/**
* This clas will hold single select condition
* It is an element of linked list which is logically
* connected by OR operators.
*/
public class CondExpr
{
/**
* Operator like "<"
*/
public AttrOperator op;
/**
* Types of operands, Null AttrType means that operand is not a
* literal but an attribute name
*/
public AttrType type1;
public AttrType type2;
/**
*the left operand and right operand
*/
public Operand operand1;
public Operand operand2;
/**
* Pointer to the next element in linked list
*/
public CondExpr next;
/**
*constructor
*/
public CondExpr()
{
operand1 = new Operand();
operand2 = new Operand();
operand1.integer = 0;
operand2.integer = 0;
next = null;
}
public String toString()
{
StringBuilder b = new StringBuilder();
b.append("Operand1: ").append(operand1.string).append("; ");
b.append("operator: ").append(op.toString()).append("; ");
b.append("Operand2: ");
switch(type2.attrType)
{
case AttrType.attrInteger:
b.append(operand2.integer).append(" (").append(type2.toString()).append(");");
break;
case AttrType.attrReal:
b.append(operand2.real).append(" (").append(type2.toString()).append(");");
break;
default:
b.append(operand2.string).append(" (").append(type2.toString()).append(");");
}
return b.toString();
}
}