Revision 1498 branches/pilotoDWG/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/automaton/Recortar.java

View differences:

Recortar.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
				}
......
65 69
				
66 70
				if ("cancel".equalsIgnoreCase(label)){
67 71
					previousStatus = status;
68
					status = 4;
72
					status = -1;
69 73
					
70 74
					return com.iver.fsac.Automaton.AUTOMATON_FINISHED;
71 75
				}
......
83 87
				
84 88
				if ("cancel".equalsIgnoreCase(label)){
85 89
					previousStatus = status;
86
					status = 4;
90
					status = -1;
87 91
					
88 92
					return com.iver.fsac.Automaton.AUTOMATON_FINISHED;
89 93
				}
90 94
				
91 95
				break;
92 96
		
93
			case 4:
94
				
95
				break;
96
		
97 97
		}
98 98
		
99 99
		return com.iver.fsac.Automaton.TRANSITION_FAILED;
......
109 109
	
110 110
	public boolean checkState(char c){
111 111
		
112
		if (status == -1){
113
			return "".indexOf(c) != -1;
114
		}
115
		
112 116
		if (status == 0){
113 117
			return "".indexOf(c) != -1;
114 118
		}
......
125 129
			return "".indexOf(c) != -1;
126 130
		}
127 131
		
128
		if (status == 4){
129
			return "".indexOf(c) != -1;
130
		}
131 132
		
132
		
133 133
		return false;
134 134
	}
135 135
	
136 136
	public String[] getCurrentTransitions(){
137 137
		
138
		if (status == -1){
139
			return new String[]{};
140
		}
141
		
138 142
		if (status == 0){
139 143
			return new String[]{"punto", "cancel"};
140 144
		}
......
151 155
			return new String[]{"punto", "cancel"};
152 156
		}
153 157
		
154
		if (status == 4){
155
			return new String[]{};
156
		}
157 158
		
158
		
159 159
		throw new RuntimeException("Bug!");
160 160
	}
161 161
	
162 162
	public String[] getCurrentTransitionDescriptions(){
163 163
		
164
		if (status == -1){
165
			return new String[]{};
166
		}
167
		
164 168
		if (status == 0){
165 169
			return new String[]{null, null};
166 170
		}
......
177 181
			return new String[]{null, null};
178 182
		}
179 183
		
180
		if (status == 4){
181
			return new String[]{};
182
		}
183 184
		
184
		
185 185
		throw new RuntimeException("Bug!");
186 186
	}
187 187
}

Also available in: Unified diff