Rev 1006 | Go to most recent revision | Details | 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; |
||
16 | |||
17 | private String name; |
||
18 | private boolean isNew = false; |
||
19 | private List conditions = new ArrayList(); |
||
20 | private PathCondition condition; |
||
21 | private int firstOperandType = OPERAND_NONE; |
||
22 | private String firstOperandValue; |
||
23 | private int secondOperandType; |
||
24 | private String secondOperandValue; |
||
25 | private int operationType; |
||
26 | |||
27 | public String getName() |
||
28 | { |
||
29 | return name; |
||
30 | } |
||
31 | |||
32 | public void setName(String name) |
||
33 | { |
||
34 | this.name = name; |
||
35 | } |
||
36 | |||
37 | public int getFirstOperandType() |
||
38 | { |
||
39 | return firstOperandType; |
||
40 | } |
||
41 | |||
42 | public String getFirstOperandValue() |
||
43 | { |
||
44 | return firstOperandValue; |
||
45 | } |
||
46 | |||
47 | public void setFirstOperand(int operandType, String value) |
||
48 | { |
||
49 | firstOperandType = operandType; |
||
50 | firstOperandValue = value; |
||
51 | } |
||
52 | |||
53 | public int getOperation() |
||
54 | { |
||
55 | return operationType; |
||
56 | } |
||
57 | |||
58 | public void setOperation(int operationType) |
||
59 | { |
||
60 | this.operationType = operationType; |
||
61 | } |
||
62 | |||
63 | public int getSecondOperandType() |
||
64 | { |
||
65 | return secondOperandType; |
||
66 | } |
||
67 | |||
68 | public String getSecondOperandValue() |
||
69 | { |
||
70 | return secondOperandValue; |
||
71 | } |
||
72 | |||
73 | public void setSecondOperand(int operandType, String value) |
||
74 | { |
||
75 | secondOperandType = operandType; |
||
76 | secondOperandValue = value; |
||
77 | } |
||
78 | |||
79 | public void validateOperands() |
||
80 | { |
||
81 | } |
||
82 | |||
83 | public List getConditions() |
||
84 | { |
||
85 | return conditions; |
||
86 | } |
||
87 | |||
88 | public void addCondition() |
||
89 | { |
||
90 | condition = new PathCondition(); |
||
91 | conditions.add(condition); |
||
92 | } |
||
93 | |||
94 | public void setFirstCondition(int operandType, String value) |
||
95 | { |
||
96 | condition.setFirstOperandType(operandType); |
||
97 | condition.setFirstOperandValue(value); |
||
98 | } |
||
99 | |||
100 | public void setConditionOperation(int operationType) |
||
101 | { |
||
102 | condition.setOperation(operationType); |
||
103 | } |
||
104 | |||
105 | public void setSecondCondition(int operandType, String value) |
||
106 | { |
||
107 | condition.setSecondOperandType(operandType); |
||
108 | condition.setSecondOperandValue(value); |
||
109 | } |
||
110 | |||
111 | public void validateCondition() |
||
112 | { |
||
113 | condition.validateCondition(); |
||
114 | } |
||
115 | |||
116 | public boolean getNew() |
||
117 | { |
||
118 | return isNew; |
||
119 | } |
||
120 | |||
121 | public void setNew() |
||
122 | { |
||
123 | isNew = true; |
||
124 | } |
||
125 | |||
126 | public String toString() |
||
127 | { |
||
128 | return "Element [" + name + "]"; |
||
129 | } |
||
130 | } |