Rev 1006 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1005 | dev | 1 | package ak.zpath; |
2 | |||
3 | import java.util.List; |
||
4 | import java.util.ArrayList; |
||
5 | |||
6 | public class PathElement |
||
7 | { |
||
8 | public static final int OPERAND_NONE = 0; |
||
9 | public static final int OPERAND_TEXT = 1; |
||
10 | public static final int OPERAND_ATTRIBUTE = 2; |
||
11 | public static final int OPERAND_VARIABLE = 3; |
||
12 | public static final int OPERAND_STRING = 4; |
||
13 | public static final int OPERATION_ASSIGN = 5; |
||
14 | public static final int OPERATION_EQUAL = 6; |
||
15 | public static final int OPERATION_APPEND = 7; |
||
1007 | dev | 16 | public static final int OPERATION_EXIST = 8; |
1005 | dev | 17 | |
18 | private String name; |
||
19 | private boolean isNew = false; |
||
1007 | dev | 20 | private int index = 0; |
1005 | dev | 21 | private List conditions = new ArrayList(); |
22 | private PathCondition condition; |
||
23 | private int firstOperandType = OPERAND_NONE; |
||
24 | private String firstOperandValue; |
||
25 | private int secondOperandType; |
||
26 | private String secondOperandValue; |
||
27 | private int operationType; |
||
28 | |||
29 | public String getName() |
||
30 | { |
||
31 | return name; |
||
32 | } |
||
33 | |||
34 | public void setName(String name) |
||
35 | { |
||
36 | this.name = name; |
||
37 | } |
||
38 | |||
39 | public int getFirstOperandType() |
||
40 | { |
||
41 | return firstOperandType; |
||
42 | } |
||
43 | |||
44 | public String getFirstOperandValue() |
||
45 | { |
||
46 | return firstOperandValue; |
||
47 | } |
||
48 | |||
49 | public void setFirstOperand(int operandType, String value) |
||
50 | { |
||
51 | firstOperandType = operandType; |
||
52 | firstOperandValue = value; |
||
53 | } |
||
54 | |||
55 | public int getOperation() |
||
56 | { |
||
57 | return operationType; |
||
58 | } |
||
59 | |||
60 | public void setOperation(int operationType) |
||
61 | { |
||
62 | this.operationType = operationType; |
||
63 | } |
||
64 | |||
65 | public int getSecondOperandType() |
||
66 | { |
||
67 | return secondOperandType; |
||
68 | } |
||
69 | |||
70 | public String getSecondOperandValue() |
||
71 | { |
||
72 | return secondOperandValue; |
||
73 | } |
||
74 | |||
75 | public void setSecondOperand(int operandType, String value) |
||
76 | { |
||
77 | secondOperandType = operandType; |
||
78 | secondOperandValue = value; |
||
79 | } |
||
80 | |||
81 | public void validateOperands() |
||
82 | { |
||
83 | } |
||
84 | |||
85 | public List getConditions() |
||
86 | { |
||
87 | return conditions; |
||
88 | } |
||
89 | |||
90 | public void addCondition() |
||
91 | { |
||
92 | condition = new PathCondition(); |
||
93 | conditions.add(condition); |
||
94 | } |
||
95 | |||
96 | public void setFirstCondition(int operandType, String value) |
||
97 | { |
||
98 | condition.setFirstOperandType(operandType); |
||
99 | condition.setFirstOperandValue(value); |
||
100 | } |
||
101 | |||
102 | public void setConditionOperation(int operationType) |
||
103 | { |
||
104 | condition.setOperation(operationType); |
||
105 | } |
||
106 | |||
107 | public void setSecondCondition(int operandType, String value) |
||
108 | { |
||
109 | condition.setSecondOperandType(operandType); |
||
110 | condition.setSecondOperandValue(value); |
||
111 | } |
||
112 | |||
113 | public void validateCondition() |
||
114 | { |
||
115 | condition.validateCondition(); |
||
116 | } |
||
117 | |||
118 | public boolean getNew() |
||
119 | { |
||
120 | return isNew; |
||
121 | } |
||
122 | |||
123 | public void setNew() |
||
124 | { |
||
125 | isNew = true; |
||
126 | } |
||
127 | |||
1006 | dev | 128 | public int getIndex() |
129 | { |
||
130 | return index; |
||
131 | } |
||
132 | |||
133 | public void setIndex(int index) |
||
134 | { |
||
135 | this.index = index; |
||
136 | } |
||
137 | |||
1005 | dev | 138 | public String toString() |
139 | { |
||
140 | return "Element [" + name + "]"; |
||
141 | } |
||
142 | } |