Revision 1498 branches/pilotoDWG/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/automaton/Girar.java
Girar.java | ||
---|---|---|
11 | 11 |
public int transition(String label){ |
12 | 12 |
switch (status){ |
13 | 13 |
|
14 |
case -1: |
|
15 |
|
|
16 |
break; |
|
17 |
|
|
14 | 18 |
case 0: |
15 | 19 |
|
16 | 20 |
if ("punto".equalsIgnoreCase(label)){ |
... | ... | |
22 | 26 |
|
23 | 27 |
if ("cancel".equalsIgnoreCase(label)){ |
24 | 28 |
previousStatus = status; |
25 |
status = 4;
|
|
29 |
status = -1;
|
|
26 | 30 |
|
27 | 31 |
return com.iver.fsac.Automaton.AUTOMATON_FINISHED; |
28 | 32 |
} |
... | ... | |
47 | 51 |
|
48 | 52 |
if ("cancel".equalsIgnoreCase(label)){ |
49 | 53 |
previousStatus = status; |
50 |
status = 4;
|
|
54 |
status = -1;
|
|
51 | 55 |
|
52 | 56 |
return com.iver.fsac.Automaton.AUTOMATON_FINISHED; |
53 | 57 |
} |
... | ... | |
58 | 62 |
|
59 | 63 |
if ("cancel".equalsIgnoreCase(label)){ |
60 | 64 |
previousStatus = status; |
61 |
status = 4;
|
|
65 |
status = -1;
|
|
62 | 66 |
|
63 | 67 |
return com.iver.fsac.Automaton.AUTOMATON_FINISHED; |
64 | 68 |
} |
... | ... | |
69 | 73 |
|
70 | 74 |
if ("cancel".equalsIgnoreCase(label)){ |
71 | 75 |
previousStatus = status; |
72 |
status = 4;
|
|
76 |
status = -1;
|
|
73 | 77 |
|
74 | 78 |
return com.iver.fsac.Automaton.AUTOMATON_FINISHED; |
75 | 79 |
} |
76 | 80 |
|
77 | 81 |
break; |
78 | 82 |
|
79 |
case 4: |
|
80 |
|
|
81 |
break; |
|
82 |
|
|
83 | 83 |
} |
84 | 84 |
|
85 | 85 |
return com.iver.fsac.Automaton.TRANSITION_FAILED; |
... | ... | |
95 | 95 |
|
96 | 96 |
public boolean checkState(char c){ |
97 | 97 |
|
98 |
if (status == -1){ |
|
99 |
return "".indexOf(c) != -1; |
|
100 |
} |
|
101 |
|
|
98 | 102 |
if (status == 0){ |
99 | 103 |
return "".indexOf(c) != -1; |
100 | 104 |
} |
... | ... | |
111 | 115 |
return "".indexOf(c) != -1; |
112 | 116 |
} |
113 | 117 |
|
114 |
if (status == 4){ |
|
115 |
return "".indexOf(c) != -1; |
|
116 |
} |
|
117 | 118 |
|
118 |
|
|
119 | 119 |
return false; |
120 | 120 |
} |
121 | 121 |
|
122 | 122 |
public String[] getCurrentTransitions(){ |
123 | 123 |
|
124 |
if (status == -1){ |
|
125 |
return new String[]{}; |
|
126 |
} |
|
127 |
|
|
124 | 128 |
if (status == 0){ |
125 | 129 |
return new String[]{"punto", "cancel"}; |
126 | 130 |
} |
... | ... | |
137 | 141 |
return new String[]{"cancel"}; |
138 | 142 |
} |
139 | 143 |
|
140 |
if (status == 4){ |
|
141 |
return new String[]{}; |
|
142 |
} |
|
143 | 144 |
|
144 |
|
|
145 | 145 |
throw new RuntimeException("Bug!"); |
146 | 146 |
} |
147 | 147 |
|
148 | 148 |
public String[] getCurrentTransitionDescriptions(){ |
149 | 149 |
|
150 |
if (status == -1){ |
|
151 |
return new String[]{}; |
|
152 |
} |
|
153 |
|
|
150 | 154 |
if (status == 0){ |
151 | 155 |
return new String[]{null, "Cancelar"}; |
152 | 156 |
} |
... | ... | |
163 | 167 |
return new String[]{"Cancelar"}; |
164 | 168 |
} |
165 | 169 |
|
166 |
if (status == 4){ |
|
167 |
return new String[]{}; |
|
168 |
} |
|
169 | 170 |
|
170 |
|
|
171 | 171 |
throw new RuntimeException("Bug!"); |
172 | 172 |
} |
173 | 173 |
} |
Also available in: Unified diff