Mercurial > 510Connectbot
comparison src/org/tn5250j/framework/tn5250/ScreenPlanes.java @ 112:77ac18bc1b2f
cleanup java formatting
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 18 Jun 2014 13:03:01 -0700 |
parents | 044b1a951925 |
children | 446dbcf606eb |
comparison
equal
deleted
inserted
replaced
111:6a0ad4d384ea | 112:77ac18bc1b2f |
---|---|
29 | 29 |
30 import java.util.Properties; | 30 import java.util.Properties; |
31 | 31 |
32 public class ScreenPlanes { | 32 public class ScreenPlanes { |
33 | 33 |
34 private final Screen5250 scr; | 34 private final Screen5250 scr; |
35 private int screenSize; | 35 private int screenSize; |
36 private int numRows; | 36 private int numRows; |
37 private int numCols; | 37 private int numCols; |
38 private int errorLineNum; | 38 private int errorLineNum; |
39 | 39 |
40 private static final int initAttr = 32; | 40 private static final int initAttr = 32; |
41 private static final char initChar = 0; | 41 private static final char initChar = 0; |
42 | 42 |
43 protected char[] screen; // text plane | 43 protected char[] screen; // text plane |
44 private char[] screenAttr; // attribute plane | 44 private char[] screenAttr; // attribute plane |
45 private char[] screenGUI; // gui plane | 45 private char[] screenGUI; // gui plane |
46 private char[] screenIsAttr; | 46 private char[] screenIsAttr; |
47 private char[] fieldExtended; | 47 private char[] fieldExtended; |
48 private char[] screenField; | 48 private char[] screenField; |
49 private char[] screenColor; // color plane | 49 private char[] screenColor; // color plane |
50 protected char[] screenExtended; // extended plane | 50 protected char[] screenExtended; // extended plane |
51 private char[] screenIsChanged; | 51 private char[] screenIsChanged; |
52 | 52 |
53 private char[] initArray; | 53 private char[] initArray; |
54 | 54 |
55 private char[] errorLine; | 55 private char[] errorLine; |
56 private char[] errorLineAttr; | 56 private char[] errorLineAttr; |
57 private char[] errorLineIsAttr; | 57 private char[] errorLineIsAttr; |
58 private char[] errorLineGui; | 58 private char[] errorLineGui; |
59 | 59 |
60 public ScreenPlanes(Screen5250 s5250, int size) { | 60 public ScreenPlanes(Screen5250 s5250, int size) { |
61 | 61 scr = s5250; |
62 scr = s5250; | 62 setSize(size); |
63 setSize(size); | 63 } |
64 } | 64 |
65 | 65 protected void setSize(int newSize) { |
66 protected void setSize(int newSize) { | 66 screenSize = newSize; |
67 | 67 numCols = 80; |
68 screenSize = newSize; | 68 |
69 | 69 switch (newSize) { |
70 numCols = 80; | 70 case 24: |
71 switch (newSize) { | 71 numRows = 24; |
72 case 24: | 72 break; |
73 numRows = 24; | 73 |
74 break; | 74 case 27: |
75 case 27: | 75 numRows = 27; |
76 numRows = 27; | 76 numCols = 132; |
77 numCols = 132; | 77 break; |
78 break; | 78 } |
79 | 79 |
80 } | 80 // this is used here when size changes |
81 | 81 setErrorLine(numRows); |
82 // this is used here when size changes | 82 screenSize = numRows * numCols; |
83 setErrorLine(numRows); | 83 screen = new char[screenSize]; |
84 | 84 screenAttr = new char[screenSize]; |
85 screenSize = numRows * numCols; | 85 screenIsAttr = new char[screenSize]; |
86 screen = new char[screenSize]; | 86 screenGUI = new char[screenSize]; |
87 screenAttr = new char[screenSize]; | 87 screenColor = new char[screenSize]; |
88 screenIsAttr = new char[screenSize]; | 88 screenExtended = new char[screenSize]; |
89 screenGUI = new char[screenSize]; | 89 fieldExtended = new char[screenSize]; |
90 screenColor = new char[screenSize]; | 90 screenIsChanged = new char[screenSize]; |
91 screenExtended = new char[screenSize]; | 91 screenField = new char[screenSize]; |
92 fieldExtended = new char[screenSize]; | 92 initArray = new char[screenSize]; |
93 screenIsChanged = new char[screenSize]; | 93 initalizePlanes(); |
94 screenField = new char[screenSize]; | 94 } |
95 | 95 |
96 initArray = new char[screenSize]; | 96 protected void setErrorLine(int line) { |
97 | 97 // * NOTE * for developers I have changed the send qry to pass different |
98 initalizePlanes(); | 98 // parameters to the host so check setsize for setting error line as well. |
99 } | 99 // |
100 | 100 if (line == 0 || line > numRows) |
101 protected void setErrorLine (int line) { | 101 errorLineNum = numRows; |
102 | 102 else |
103 // * NOTE * for developers I have changed the send qry to pass different | 103 errorLineNum = line; |
104 // parameters to the host so check setsize for setting error line as well. | 104 } |
105 // | 105 |
106 if (line == 0 || line > numRows) | 106 /** |
107 errorLineNum = numRows; | 107 * Returns the current error line number |
108 else | 108 * |
109 errorLineNum = line; | 109 * @return current error line number |
110 } | 110 */ |
111 | 111 protected int getErrorLine() { |
112 /** | 112 return errorLineNum; |
113 * Returns the current error line number | 113 } |
114 * | 114 |
115 * @return current error line number | 115 protected void saveErrorLine() { |
116 */ | 116 // if there is already an error line saved then do not save it again |
117 protected int getErrorLine() { | 117 // This signifies that there was a previous error and the original error |
118 return errorLineNum; | 118 // line was not restored yet. |
119 } | 119 if (errorLine == null) { |
120 | 120 errorLine = new char[numCols]; |
121 protected void saveErrorLine() { | 121 errorLineAttr = new char[numCols]; |
122 | 122 errorLineIsAttr = new char[numCols]; |
123 // if there is already an error line saved then do not save it again | 123 errorLineGui = new char[numCols]; |
124 // This signifies that there was a previous error and the original error | 124 int r = scr.getPos(errorLineNum - 1, 0); |
125 // line was not restored yet. | 125 |
126 if (errorLine == null) { | 126 for (int x = 0; x < numCols; x++) { |
127 errorLine = new char[numCols]; | 127 errorLine[x] = screen[r + x]; |
128 errorLineAttr = new char[numCols]; | 128 errorLineAttr[x] = screenAttr[r + x]; |
129 errorLineIsAttr = new char[numCols]; | 129 errorLineIsAttr[x] = screenIsAttr[r + x]; |
130 errorLineGui = new char[numCols]; | 130 errorLineGui[x] = screenGUI[r + x]; |
131 | 131 } |
132 int r = scr.getPos(errorLineNum-1,0); | 132 } |
133 | 133 } |
134 for (int x = 0;x < numCols; x++) { | 134 |
135 errorLine[x] = screen[r+x]; | 135 /** |
136 errorLineAttr[x] = screenAttr[r+x]; | 136 * Restores the error line characters from the save buffer. |
137 errorLineIsAttr[x] = screenIsAttr[r+x]; | 137 * |
138 errorLineGui[x] = screenGUI[r+x]; | 138 * @see #saveErrorLine() |
139 } | 139 */ |
140 } | 140 protected void restoreErrorLine() { |
141 } | 141 if (errorLine != null) { |
142 | 142 int r = scr.getPos(errorLineNum - 1, 0); |
143 /** | 143 |
144 * Restores the error line characters from the save buffer. | 144 for (int x = 0; x < numCols - 1; x++) { |
145 * | 145 setScreenCharAndAttr(r + x, errorLine[x], errorLineAttr[x], |
146 * @see #saveErrorLine() | 146 (errorLineIsAttr[x] == '1' ? true : false)); |
147 */ | 147 screenGUI[x] = errorLineGui[x]; |
148 protected void restoreErrorLine() { | 148 } |
149 | 149 |
150 if (errorLine != null) { | 150 errorLine = null; |
151 int r = scr.getPos(errorLineNum - 1, 0); | 151 errorLineAttr = null; |
152 | 152 errorLineIsAttr = null; |
153 for (int x = 0; x < numCols - 1; x++) { | 153 errorLineGui = null; |
154 setScreenCharAndAttr(r+x,errorLine[x],errorLineAttr[x], | 154 } |
155 (errorLineIsAttr[x] == '1' ? true : false)); | 155 } |
156 screenGUI[x] = errorLineGui[x]; | 156 |
157 } | 157 protected boolean isErrorLineSaved() { |
158 | 158 return errorLine == null ? false : true; |
159 errorLine = null; | 159 } |
160 errorLineAttr = null; | 160 |
161 errorLineIsAttr = null; | 161 protected void setScreenCharAndAttr(int pos, char c, int attr, boolean isAttr) { |
162 errorLineGui = null; | 162 screen[pos] = c; |
163 } | 163 screenAttr[pos] = (char)attr; |
164 } | 164 disperseAttribute(pos, attr); |
165 | 165 screenIsAttr[pos] = (isAttr ? (char)1 : (char)0); |
166 protected boolean isErrorLineSaved() { | 166 screenGUI[pos] = NO_GUI; |
167 return errorLine == null ? false : true; | 167 } |
168 } | 168 |
169 | 169 protected void setScreenAttr(int pos, int attr, boolean isAttr) { |
170 protected void setScreenCharAndAttr(int pos, char c, int attr, boolean isAttr) { | 170 screenAttr[pos] = (char)attr; |
171 | 171 screenIsAttr[pos] = isAttr ? (char)1 : (char)0; |
172 screen[pos] = c; | 172 disperseAttribute(pos, attr); |
173 screenAttr[pos] = (char)attr; | 173 screenGUI[pos] = initChar; |
174 disperseAttribute(pos,attr); | 174 } |
175 screenIsAttr[pos] = (isAttr ? (char)1 : (char)0); | 175 |
176 screenGUI[pos] = NO_GUI; | 176 protected void setScreenAttr(int pos, int attr) { |
177 | 177 screenAttr[pos] = (char)attr; |
178 } | 178 //screenGUI[pos] = initChar; |
179 | 179 disperseAttribute(pos, attr); |
180 protected void setScreenAttr(int pos, int attr, boolean isAttr) { | 180 } |
181 | 181 |
182 screenAttr[pos] = (char)attr; | 182 protected void setScreenFieldAttr(int pos, int attr) { |
183 screenIsAttr[pos] = isAttr ? (char)1 : (char)0; | 183 screenField[pos] = (char)attr; |
184 disperseAttribute(pos,attr); | 184 } |
185 screenGUI[pos] = initChar; | 185 |
186 | 186 protected final void setChar(int pos, char c) { |
187 } | 187 screenIsChanged[pos] = screen[pos] == c ? '0' : '1'; |
188 | 188 screen[pos] = c; |
189 protected void setScreenAttr(int pos, int attr) { | 189 |
190 | 190 if (screenIsAttr[pos] == 1) |
191 screenAttr[pos] = (char)attr; | 191 setScreenCharAndAttr(pos, c, 32, false); |
192 //screenGUI[pos] = initChar; | 192 } |
193 disperseAttribute(pos,attr); | 193 |
194 | 194 protected final char getChar(int pos) { |
195 } | 195 return screen[pos]; |
196 | 196 } |
197 protected void setScreenFieldAttr(int pos, int attr) { | 197 |
198 | 198 protected final char getCharColor(int pos) { |
199 screenField[pos] = (char)attr; | 199 return screenColor[pos]; |
200 | 200 } |
201 } | 201 |
202 | 202 protected final int getCharAttr(int pos) { |
203 protected final void setChar(int pos, char c) { | 203 return screenAttr[pos]; |
204 screenIsChanged[pos] = screen[pos] == c ? '0' : '1'; | 204 } |
205 screen[pos] = c; | 205 |
206 if (screenIsAttr[pos] == 1) | 206 protected final char getCharExtended(int pos) { |
207 setScreenCharAndAttr(pos,c,32,false); | 207 return screenExtended[pos]; |
208 | 208 } |
209 } | 209 |
210 | 210 protected final boolean isAttributePlace(int pos) { |
211 protected final char getChar(int pos) { | 211 return screenIsAttr[pos] == 1 ? true : false; |
212 return screen[pos]; | 212 } |
213 } | 213 |
214 | 214 public final void setUseGUI(int pos, int which) { |
215 protected final char getCharColor(int pos) { | 215 screenIsChanged[pos] = screenGUI[pos] == which ? '0' : '1'; |
216 return screenColor[pos]; | 216 screenGUI[pos] = (char)which; |
217 } | 217 } |
218 | 218 |
219 protected final int getCharAttr(int pos) { | 219 private void disperseAttribute(int pos, int attr) { |
220 return screenAttr[pos]; | 220 char c = 0; |
221 } | 221 char cs = 0; |
222 | 222 char ul = 0; |
223 protected final char getCharExtended(int pos) { | 223 char nd = 0; |
224 return screenExtended[pos]; | 224 |
225 } | 225 if (attr == 0) |
226 | 226 return; |
227 protected final boolean isAttributePlace(int pos) { | 227 |
228 return screenIsAttr[pos] == 1 ? true : false; | 228 switch (attr) { |
229 } | 229 case 32: // green normal |
230 | 230 c = ATTR_32; |
231 public final void setUseGUI(int pos, int which) { | 231 break; |
232 | 232 |
233 screenIsChanged[pos] = screenGUI[pos] == which ? '0' : '1'; | 233 case 33: // green/revers |
234 screenGUI[pos] = (char)which; | 234 c = ATTR_33; |
235 } | 235 break; |
236 | 236 |
237 private void disperseAttribute(int pos, int attr) { | 237 case 34: // white normal |
238 | 238 c = ATTR_34; |
239 char c = 0; | 239 break; |
240 char cs = 0; | 240 |
241 char ul = 0; | 241 case 35: // white/reverse |
242 char nd = 0; | 242 c = ATTR_35; |
243 | 243 break; |
244 if(attr == 0) | 244 |
245 return; | 245 case 36: // green/underline |
246 | 246 c = ATTR_36; |
247 switch(attr) { | 247 ul = EXTENDED_5250_UNDERLINE; |
248 case 32: // green normal | 248 break; |
249 c = ATTR_32; | 249 |
250 break; | 250 case 37: // green/reverse/underline |
251 | 251 c = ATTR_37; |
252 case 33: // green/revers | 252 ul = EXTENDED_5250_UNDERLINE; |
253 c = ATTR_33; | 253 break; |
254 break; | 254 |
255 | 255 case 38: // white/underline |
256 case 34: // white normal | 256 c = ATTR_38; |
257 c = ATTR_34; | 257 ul = EXTENDED_5250_UNDERLINE; |
258 break; | 258 break; |
259 | 259 |
260 case 35: // white/reverse | 260 case 39: |
261 c = ATTR_35; | 261 nd = EXTENDED_5250_NON_DSP; |
262 break; | 262 break; |
263 | 263 |
264 case 36: // green/underline | 264 case 40: |
265 c = ATTR_36; | 265 case 42: // red/normal |
266 ul = EXTENDED_5250_UNDERLINE; | 266 c = ATTR_40; |
267 break; | 267 break; |
268 | 268 |
269 case 37: // green/reverse/underline | 269 case 41: |
270 c = ATTR_37; | 270 case 43: // red/reverse |
271 ul = EXTENDED_5250_UNDERLINE; | 271 c = ATTR_41; |
272 break; | 272 break; |
273 | 273 |
274 case 38: // white/underline | 274 case 44: |
275 c = ATTR_38; | 275 case 46: // red/underline |
276 ul = EXTENDED_5250_UNDERLINE; | 276 c = ATTR_44; |
277 break; | 277 ul = EXTENDED_5250_UNDERLINE; |
278 | 278 break; |
279 case 39: | 279 |
280 nd = EXTENDED_5250_NON_DSP; | 280 case 45: // red/reverse/underline |
281 break; | 281 c = ATTR_45; |
282 | 282 ul = EXTENDED_5250_UNDERLINE; |
283 case 40: | 283 break; |
284 case 42: // red/normal | 284 |
285 c = ATTR_40; | 285 case 47: |
286 break; | 286 nd = EXTENDED_5250_NON_DSP; |
287 | 287 break; |
288 case 41: | 288 |
289 case 43: // red/reverse | 289 case 48: |
290 c = ATTR_41; | 290 c = ATTR_48; |
291 break; | 291 cs = EXTENDED_5250_COL_SEP; |
292 | 292 break; |
293 case 44: | 293 |
294 case 46: // red/underline | 294 case 49: |
295 c = ATTR_44; | 295 c = ATTR_49; |
296 ul = EXTENDED_5250_UNDERLINE; | 296 cs = EXTENDED_5250_COL_SEP; |
297 break; | 297 break; |
298 | 298 |
299 case 45: // red/reverse/underline | 299 case 50: |
300 c = ATTR_45; | 300 c = ATTR_50; |
301 ul = EXTENDED_5250_UNDERLINE; | 301 cs = EXTENDED_5250_COL_SEP; |
302 break; | 302 break; |
303 | 303 |
304 case 47: | 304 case 51: |
305 nd = EXTENDED_5250_NON_DSP; | 305 c = ATTR_51; |
306 break; | 306 cs = EXTENDED_5250_COL_SEP; |
307 | 307 break; |
308 case 48: | 308 |
309 c = ATTR_48; | 309 case 52: |
310 cs = EXTENDED_5250_COL_SEP; | 310 c = ATTR_52; |
311 break; | 311 // colSep = true; |
312 | 312 ul = EXTENDED_5250_UNDERLINE; |
313 case 49: | 313 break; |
314 c = ATTR_49; | 314 |
315 cs = EXTENDED_5250_COL_SEP; | 315 case 53: |
316 break; | 316 c = ATTR_53; |
317 | 317 // colSep = true; |
318 case 50: | 318 ul = EXTENDED_5250_UNDERLINE; |
319 c = ATTR_50; | 319 break; |
320 cs = EXTENDED_5250_COL_SEP; | 320 |
321 break; | 321 case 54: |
322 | 322 c = ATTR_54; |
323 case 51: | 323 // colSep = true; |
324 c = ATTR_51; | 324 ul = EXTENDED_5250_UNDERLINE; |
325 cs = EXTENDED_5250_COL_SEP; | 325 break; |
326 break; | 326 |
327 | 327 case 55: |
328 case 52: | 328 nd = EXTENDED_5250_NON_DSP; |
329 c = ATTR_52; | 329 break; |
330 // colSep = true; | 330 |
331 ul = EXTENDED_5250_UNDERLINE; | 331 case 56: // pink |
332 break; | 332 c = ATTR_56; |
333 | 333 break; |
334 case 53: | 334 |
335 c = ATTR_53; | 335 case 57: // pink/reverse |
336 // colSep = true; | 336 c = ATTR_57; |
337 ul = EXTENDED_5250_UNDERLINE; | 337 break; |
338 break; | 338 |
339 | 339 case 58: // blue/reverse |
340 case 54: | 340 c = ATTR_58; |
341 c = ATTR_54; | 341 break; |
342 // colSep = true; | 342 |
343 ul = EXTENDED_5250_UNDERLINE; | 343 case 59: // blue |
344 break; | 344 c = ATTR_59; |
345 | 345 break; |
346 case 55: | 346 |
347 nd = EXTENDED_5250_NON_DSP; | 347 case 60: // pink/underline |
348 break; | 348 c = ATTR_60; |
349 | 349 ul = EXTENDED_5250_UNDERLINE; |
350 case 56: // pink | 350 break; |
351 c = ATTR_56; | 351 |
352 break; | 352 case 61: // pink/reverse/underline |
353 | 353 c = ATTR_61; |
354 case 57: // pink/reverse | 354 ul = EXTENDED_5250_UNDERLINE; |
355 c = ATTR_57; | 355 break; |
356 break; | 356 |
357 | 357 case 62: // blue/underline |
358 case 58: // blue/reverse | 358 c = ATTR_62; |
359 c = ATTR_58; | 359 ul = EXTENDED_5250_UNDERLINE; |
360 break; | 360 break; |
361 | 361 |
362 case 59: // blue | 362 case 63: // nondisplay |
363 c = ATTR_59; | 363 nd = EXTENDED_5250_NON_DSP; |
364 break; | 364 cs = EXTENDED_5250_COL_SEP; |
365 | 365 break; |
366 case 60: // pink/underline | 366 |
367 c = ATTR_60; | 367 default: |
368 ul = EXTENDED_5250_UNDERLINE; | 368 c = (COLOR_BG_BLACK << 8 & 0xff00) | |
369 break; | 369 (COLOR_FG_YELLOW & 0xff); |
370 | 370 break; |
371 case 61: // pink/reverse/underline | 371 } |
372 c = ATTR_61; | 372 |
373 ul = EXTENDED_5250_UNDERLINE; | 373 screenColor[pos] = c; |
374 break; | 374 screenExtended[pos] = (char)(ul | cs | nd); |
375 | 375 } |
376 case 62: // blue/underline | 376 |
377 c = ATTR_62; | 377 protected void initalizePlanes() { |
378 ul = EXTENDED_5250_UNDERLINE; | 378 char c = (COLOR_BG_BLACK << 8 & 0xff00) | |
379 break; | 379 (COLOR_FG_GREEN & 0xff); |
380 | 380 |
381 case 63: // nondisplay | 381 for (int y = 0; y < screenSize; y++) { |
382 nd = EXTENDED_5250_NON_DSP; | 382 screenAttr[y] = initAttr; |
383 cs = EXTENDED_5250_COL_SEP; | 383 screenColor[y] = c; |
384 break; | 384 } |
385 default: | 385 |
386 c = ( COLOR_BG_BLACK << 8 & 0xff00) | | 386 // here we will just copy the initialized plane onto the other planes |
387 ( COLOR_FG_YELLOW & 0xff); | 387 // using arraycopy which will be faster. I hope. |
388 break; | 388 System.arraycopy(initArray, 0, screen, 0, screenSize); |
389 | 389 System.arraycopy(initArray, 0, screenGUI, 0, screenSize); |
390 } | 390 System.arraycopy(initArray, 0, screenIsAttr, 0, screenSize); |
391 | 391 System.arraycopy(initArray, 0, screenExtended, 0, screenSize); |
392 screenColor[pos] = c; | 392 System.arraycopy(initArray, 0, fieldExtended, 0, screenSize); |
393 screenExtended[pos] = (char)(ul | cs | nd); | 393 System.arraycopy(initArray, 0, screenField, 0, screenSize); |
394 } | 394 } |
395 | 395 |
396 protected void initalizePlanes () { | 396 protected void initalizeFieldPlanes() { |
397 | 397 System.arraycopy(initArray, 0, fieldExtended, 0, screenSize); |
398 char c = (COLOR_BG_BLACK << 8 & 0xff00) | | 398 System.arraycopy(initArray, 0, screenField, 0, screenSize); |
399 (COLOR_FG_GREEN & 0xff); | 399 } |
400 | 400 |
401 for (int y = 0;y < screenSize; y++) { | 401 protected final int getWhichGUI(int pos) { |
402 | 402 return screenGUI[pos]; |
403 screenAttr[y] = initAttr; | 403 } |
404 screenColor[y] = c; | 404 |
405 | 405 protected final boolean isChanged(int pos) { |
406 } | 406 return screenIsChanged[pos] == 0 ? false : true; |
407 | 407 } |
408 // here we will just copy the initialized plane onto the other planes | 408 |
409 // using arraycopy which will be faster. I hope. | 409 protected final boolean isUseGui(int pos) { |
410 | 410 return screenGUI[pos] == NO_GUI ? false : true; |
411 System.arraycopy(initArray,0,screen,0,screenSize); | 411 } |
412 System.arraycopy(initArray,0,screenGUI,0,screenSize); | 412 |
413 System.arraycopy(initArray,0,screenIsAttr,0,screenSize); | 413 /** |
414 System.arraycopy(initArray,0,screenExtended,0,screenSize); | 414 * Return the data associated with the plane that is passed. |
415 System.arraycopy(initArray,0,fieldExtended,0,screenSize); | 415 * |
416 System.arraycopy(initArray,0,screenField,0,screenSize); | 416 * @param from Position from which to start |
417 } | 417 * @param to Position to end |
418 | 418 * @param plane From which plane to obtain the data |
419 protected void initalizeFieldPlanes () { | 419 * @return Character array containing the data requested |
420 System.arraycopy(initArray,0,fieldExtended,0,screenSize); | 420 */ |
421 System.arraycopy(initArray,0,screenField,0,screenSize); | 421 |
422 } | 422 protected synchronized char[] getPlaneData(int from, int to, int plane) { |
423 | 423 int len = (to - from); |
424 protected final int getWhichGUI(int pos) { | 424 char[] planeChars = new char[len + 1]; |
425 | 425 |
426 return screenGUI[pos]; | 426 switch (plane) { |
427 } | 427 case PLANE_TEXT: |
428 | 428 System.arraycopy(screen, from, planeChars, 0, len); |
429 protected final boolean isChanged(int pos) { | 429 break; |
430 return screenIsChanged[pos] == 0 ? false : true; | 430 |
431 } | 431 case PLANE_ATTR: |
432 | 432 System.arraycopy(screenAttr, from, planeChars, 0, len); |
433 protected final boolean isUseGui(int pos) { | 433 break; |
434 return screenGUI[pos] == NO_GUI ? false : true; | 434 |
435 } | 435 case PLANE_COLOR: |
436 | 436 System.arraycopy(screenColor, from, planeChars, 0, len); |
437 /** | 437 break; |
438 * Return the data associated with the plane that is passed. | 438 |
439 * | 439 case PLANE_EXTENDED: |
440 * @param from Position from which to start | 440 System.arraycopy(screenExtended, from, planeChars, 0, len); |
441 * @param to Position to end | 441 break; |
442 * @param plane From which plane to obtain the data | 442 |
443 * @return Character array containing the data requested | 443 case PLANE_EXTENDED_GRAPHIC: |
444 */ | 444 System.arraycopy(screenGUI, from, planeChars, 0, len); |
445 protected synchronized char[] getPlaneData(int from, int to, int plane) { | 445 break; |
446 | 446 |
447 int len = (to - from); | 447 case PLANE_FIELD: |
448 | 448 System.arraycopy(screenField, from, planeChars, 0, len); |
449 char[] planeChars = new char[len + 1]; | 449 break; |
450 | 450 |
451 switch (plane) { | 451 case PLANE_IS_ATTR_PLACE: |
452 case PLANE_TEXT: | 452 System.arraycopy(screenIsAttr, from, planeChars, 0, len); |
453 System.arraycopy(screen, from, planeChars, 0, len); | 453 break; |
454 break; | 454 |
455 case PLANE_ATTR: | 455 default: |
456 System.arraycopy(screenAttr, from, planeChars, 0, len); | 456 System.arraycopy(screen, from, planeChars, 0, len); |
457 break; | 457 } |
458 case PLANE_COLOR: | 458 |
459 System.arraycopy(screenColor, from, planeChars, 0, len); | 459 return planeChars; |
460 break; | 460 } |
461 case PLANE_EXTENDED: | 461 |
462 System.arraycopy(screenExtended, from, planeChars, 0, len); | 462 /** |
463 break; | 463 * Converts a linear presentation space position to its corresponding row. |
464 case PLANE_EXTENDED_GRAPHIC: | 464 * |
465 System.arraycopy(screenGUI, from, planeChars, 0, len); | 465 * @param pos The position to be converted |
466 break; | 466 * @return The row which corresponds to the position given |
467 case PLANE_FIELD: | 467 * @throws OhioException |
468 System.arraycopy(screenField, from, planeChars, 0, len); | 468 */ |
469 break; | 469 private int convertPosToRow(int pos) { |
470 case PLANE_IS_ATTR_PLACE: | 470 return (pos / numCols) + 1; |
471 System.arraycopy(screenIsAttr, from, planeChars, 0, len); | 471 } |
472 break; | 472 |
473 default: | 473 /** |
474 System.arraycopy(screen, from, planeChars, 0, len); | 474 * Converts a linear presentation space position to its corresponding column. |
475 | 475 * |
476 } | 476 * @param pos The position to be converted |
477 return planeChars; | 477 * @return The column which corresponds to the position given |
478 | 478 * @throws OhioException |
479 } | 479 */ |
480 | 480 private int convertPosToColumn(int pos) { |
481 /** | 481 return (pos % numCols) + 1; |
482 * Converts a linear presentation space position to its corresponding row. | 482 } |
483 * | 483 |
484 * @param pos The position to be converted | 484 /** |
485 * @return The row which corresponds to the position given | 485 * |
486 * @throws OhioException | 486 * Converts a row and column coordinate to its corresponding linear position. |
487 */ | 487 * |
488 private int convertPosToRow(int pos) { | 488 * @param row - The row of the coordinate |
489 | 489 * @param col - The column of the coordinate |
490 return (pos / numCols) + 1; | 490 * @return The linear position which corresponds to the coordinate given. |
491 | 491 * @throws OhioException |
492 } | 492 */ |
493 | 493 private int convertRowColToPos(int row, int col) { |
494 /** | 494 return (row - 1) * numCols + col - 1; |
495 * Converts a linear presentation space position to its corresponding column. | 495 } |
496 * | 496 |
497 * @param pos The position to be converted | 497 |
498 * @return The column which corresponds to the position given | 498 /** |
499 * @throws OhioException | 499 * <p> |
500 */ | 500 * GetScreen retrieves the various planes associated with the presentation |
501 private int convertPosToColumn(int pos) { | 501 * space. The data is returned as a linear array of character values in the |
502 | 502 * array provided. The array is not terminated by a null character except |
503 return (pos % numCols) + 1; | 503 * when data is retrieved from the text plane, in which case a single null |
504 | 504 * character is appended. |
505 } | 505 * </p> |
506 | 506 * <p> |
507 /** | 507 * The application must supply a buffer for the returned data and the length |
508 * | 508 * of the buffer. Data is returned starting from the beginning of the |
509 * Converts a row and column coordinate to its corresponding linear position. | 509 * presentation space and continuing until the buffer is full or the entire |
510 * | 510 * plane has been copied. For text plane data, the buffer must include one |
511 * @param row - The row of the coordinate | 511 * extra position for the terminating null character. |
512 * @param col - The column of the coordinate | 512 * <p> |
513 * @return The linear position which corresponds to the coordinate given. | 513 * |
514 * @throws OhioException | 514 * @param buffer |
515 */ | 515 * @param bufferLength |
516 private int convertRowColToPos(int row, int col) { | 516 * @param plane |
517 | 517 * @return The number of characters copied to the buffer |
518 | 518 * @throws OhioException |
519 return (row - 1) * numCols + col -1; | 519 */ |
520 | 520 |
521 } | 521 public synchronized int GetScreen(char buffer[], int bufferLength, int plane) { |
522 | 522 return GetScreen(buffer, bufferLength, 0, screenSize, plane); |
523 | 523 } |
524 /** | 524 |
525 * <p> | 525 /** |
526 * GetScreen retrieves the various planes associated with the presentation | 526 * <p> |
527 * space. The data is returned as a linear array of character values in the | 527 * GetScreen retrieves the various planes associated with the presentation |
528 * array provided. The array is not terminated by a null character except | 528 * space. The data is returned as a linear array of character values in the |
529 * when data is retrieved from the text plane, in which case a single null | 529 * array provided. The array is not terminated by a null character except |
530 * character is appended. | 530 * when data is retrieved from the text plane, in which case a single null |
531 * </p> | 531 * character is appended. |
532 * <p> | 532 * </p> |
533 * The application must supply a buffer for the returned data and the length | 533 * <p> |
534 * of the buffer. Data is returned starting from the beginning of the | 534 * The application must supply a buffer for the returned data and the length |
535 * presentation space and continuing until the buffer is full or the entire | 535 * of the buffer. Data is returned starting from the given position and |
536 * plane has been copied. For text plane data, the buffer must include one | 536 * continuing until the specified number of characters have been copied, the |
537 * extra position for the terminating null character. | 537 * buffer is full or the entire plane has been copied. For text plane data, |
538 * <p> | 538 * the buffer must include one extra position for the terminating null character. |
539 * | 539 * </p> |
540 * @param buffer | 540 * |
541 * @param bufferLength | 541 * @param buffer |
542 * @param plane | 542 * @param bufferLength |
543 * @return The number of characters copied to the buffer | 543 * @param from |
544 * @throws OhioException | 544 * @param length |
545 */ | 545 * @param plane |
546 public synchronized int GetScreen(char buffer[], int bufferLength, int plane) { | 546 * @return The number of characters copied to the buffer |
547 | 547 * @throws OhioException |
548 return GetScreen(buffer,bufferLength,0,screenSize,plane); | 548 */ |
549 | 549 |
550 } | 550 public synchronized int GetScreen(char buffer[], int bufferLength, int from, |
551 | 551 int length, int plane) { |
552 /** | 552 // if(buffer == null) |
553 * <p> | 553 // throw new OhioException(sessionVT.getSessionConfiguration(), |
554 * GetScreen retrieves the various planes associated with the presentation | 554 // OhioScreen.class.getName(), "osohio.screen.ohio00300", 1); |
555 * space. The data is returned as a linear array of character values in the | 555 if (buffer == null) |
556 * array provided. The array is not terminated by a null character except | 556 return 0; |
557 * when data is retrieved from the text plane, in which case a single null | 557 |
558 * character is appended. | 558 int min = Math.min(Math.min(buffer.length, bufferLength), screenSize); |
559 * </p> | 559 |
560 * <p> | 560 if ((from + min) > screenSize) { |
561 * The application must supply a buffer for the returned data and the length | 561 min = screenSize - from; |
562 * of the buffer. Data is returned starting from the given position and | 562 } |
563 * continuing until the specified number of characters have been copied, the | 563 |
564 * buffer is full or the entire plane has been copied. For text plane data, | 564 char[] pd = getPlaneData(from, from + min, plane); |
565 * the buffer must include one extra position for the terminating null character. | 565 |
566 * </p> | 566 if (pd != null) { |
567 * | 567 System.arraycopy(pd, 0, buffer, 0, min); |
568 * @param buffer | 568 return pd.length; |
569 * @param bufferLength | 569 } |
570 * @param from | 570 |
571 * @param length | 571 return 0; |
572 * @param plane | 572 } |
573 * @return The number of characters copied to the buffer | 573 |
574 * @throws OhioException | 574 /** |
575 */ | 575 * <p> |
576 public synchronized int GetScreen(char buffer[], int bufferLength, int from, | 576 * GetScreen retrieves the various planes associated with the presentation |
577 int length, int plane) | 577 * space. The data is returned as a linear array of character values in the |
578 { | 578 * array provided. The array is not terminated by a null character except |
579 // if(buffer == null) | 579 * when data is retrieved from the text plane, in which case a single null |
580 // throw new OhioException(sessionVT.getSessionConfiguration(), | 580 * character is appended. |
581 // OhioScreen.class.getName(), "osohio.screen.ohio00300", 1); | 581 * </p> |
582 if(buffer == null) | 582 * <p> |
583 return 0; | 583 * The application must supply a buffer for the returned data and the length |
584 | 584 * of the buffer. Data is returned starting from the given coordinates and |
585 int min = Math.min(Math.min(buffer.length, bufferLength), screenSize); | 585 * continuing until the specified number of characters have been copied, |
586 if ((from + min) > screenSize) { | 586 * the buffer is full, or the entire plane has been copied. For text plane |
587 min = screenSize - from; | 587 * data, the buffer must include one extra position for the terminating null |
588 } | 588 * character. |
589 | 589 * </p> |
590 char[] pd = getPlaneData(from,from + min,plane); | 590 * |
591 if(pd != null) { | 591 * @param buffer |
592 System.arraycopy(pd, 0, buffer, 0, min); | 592 * @param bufferLength |
593 return pd.length; | 593 * @param row |
594 } | 594 * @param col |
595 | 595 * @param length |
596 return 0; | 596 * @param plane |
597 } | 597 * @return The number of characters copied to the buffer. |
598 | 598 * @throws OhioException |
599 /** | 599 */ |
600 * <p> | 600 |
601 * GetScreen retrieves the various planes associated with the presentation | 601 public synchronized int GetScreen(char buffer[], int bufferLength, int row, |
602 * space. The data is returned as a linear array of character values in the | 602 int col, int length, int plane) |
603 * array provided. The array is not terminated by a null character except | 603 // throws OhioException { |
604 * when data is retrieved from the text plane, in which case a single null | 604 { |
605 * character is appended. | 605 // Call GetScreen function after converting row and column to |
606 * </p> | 606 // a position. |
607 * <p> | 607 return GetScreen(buffer, bufferLength, convertRowColToPos(row, col), |
608 * The application must supply a buffer for the returned data and the length | 608 length, plane); |
609 * of the buffer. Data is returned starting from the given coordinates and | 609 } |
610 * continuing until the specified number of characters have been copied, | 610 |
611 * the buffer is full, or the entire plane has been copied. For text plane | 611 /** |
612 * data, the buffer must include one extra position for the terminating null | 612 * <p> |
613 * character. | 613 * GetScreenRect retrieves data from the various planes associated with the |
614 * </p> | 614 * presentation space. The data is returned as a linear array of character |
615 * | 615 * values in the buffer provided. |
616 * @param buffer | 616 * </p> |
617 * @param bufferLength | 617 * |
618 * @param row | 618 * <p> |
619 * @param col | 619 * The application supplies two positions that represent opposing corners of |
620 * @param length | 620 * a rectangle within the presentation space. The starting and ending |
621 * @param plane | 621 * positions can have any spatial relationship to each other. The data |
622 * @return The number of characters copied to the buffer. | 622 * returned starts from the row containing the upper-most point to the row |
623 * @throws OhioException | 623 * containing the lower-most point, and from the left-most column to the |
624 */ | 624 * right-most column. |
625 public synchronized int GetScreen(char buffer[], int bufferLength, int row, | 625 * </p> |
626 int col, int length, int plane) | 626 * <p> |
627 // throws OhioException { | 627 * The specified buffer must be at least large enough to contain the number |
628 { | 628 * of characters in the rectangle. If the buffer is too small, no data is |
629 // Call GetScreen function after converting row and column to | 629 * copied and zero is returned by the method. Otherwise, the method returns |
630 // a position. | 630 * the number of characters copied. |
631 return GetScreen(buffer,bufferLength, convertRowColToPos(row,col), | 631 * </p> |
632 length, plane); | 632 * |
633 } | 633 * @param buffer |
634 | 634 * @param bufferLength |
635 /** | 635 * @param startPos |
636 * <p> | 636 * @param endPos |
637 * GetScreenRect retrieves data from the various planes associated with the | 637 * @param plane |
638 * presentation space. The data is returned as a linear array of character | 638 * @return The number of characters copied to the buffer |
639 * values in the buffer provided. | 639 * @throws OhioException |
640 * </p> | 640 */ |
641 * | 641 protected int GetScreenRect(char buffer[], int bufferLength, |
642 * <p> | 642 int startPos, int endPos, int plane) |
643 * The application supplies two positions that represent opposing corners of | 643 // throws OhioException { |
644 * a rectangle within the presentation space. The starting and ending | 644 { |
645 * positions can have any spatial relationship to each other. The data | 645 // We will use the row,col routine here because it is easier to use |
646 * returned starts from the row containing the upper-most point to the row | 646 // row colum than it is for position since I wrote the other first and |
647 * containing the lower-most point, and from the left-most column to the | 647 // am to lazy to implement it here |
648 * right-most column. | 648 // Maybe it would be faster to do it the other way? |
649 * </p> | 649 int startRow = convertPosToRow(startPos); |
650 * <p> | 650 int startCol = convertPosToColumn(startPos); |
651 * The specified buffer must be at least large enough to contain the number | 651 int endRow = convertPosToRow(endPos); |
652 * of characters in the rectangle. If the buffer is too small, no data is | 652 int endCol = convertPosToColumn(endPos); |
653 * copied and zero is returned by the method. Otherwise, the method returns | 653 return GetScreenRect(buffer, bufferLength, startRow, startCol, |
654 * the number of characters copied. | 654 endRow, endCol, plane); |
655 * </p> | 655 } |
656 * | 656 |
657 * @param buffer | 657 /** |
658 * @param bufferLength | 658 * <p> |
659 * @param startPos | 659 * GetScreenRect retrieves data from the various planes associated with the |
660 * @param endPos | 660 * presentation space. The data is returned as a linear array of character |
661 * @param plane | 661 * values in the buffer provided. The buffer is not terminated by a null |
662 * @return The number of characters copied to the buffer | 662 * character. |
663 * @throws OhioException | 663 * </p> |
664 */ | 664 * <p> |
665 protected int GetScreenRect(char buffer[], int bufferLength, | 665 * The application supplies two coordinates that represent opposing corners |
666 int startPos, int endPos, int plane) | 666 * of a rectangle within the presentation space. The starting and ending |
667 // throws OhioException { | 667 * coordinates can have any spatial relationship to each other. The data |
668 { | 668 * returned starts from the row containing the upper-most point to the row |
669 // We will use the row,col routine here because it is easier to use | 669 * containing the lower-most point, and from the left-most column to the |
670 // row colum than it is for position since I wrote the other first and | 670 * right-most column. |
671 // am to lazy to implement it here | 671 * </p> |
672 // Maybe it would be faster to do it the other way? | 672 * <p> |
673 int startRow = convertPosToRow(startPos); | 673 * The specified buffer must be at least large enough to contain the number |
674 int startCol = convertPosToColumn(startPos); | 674 * of characters in the rectangle. If the buffer is too small, no data is |
675 int endRow = convertPosToRow(endPos); | 675 * copied and zero is returned by the method. Otherwise, the method returns |
676 int endCol = convertPosToColumn(endPos); | 676 * the number of characters copied. |
677 return GetScreenRect(buffer, bufferLength, startRow, startCol, | 677 * </p> |
678 endRow, endCol, plane); | 678 * |
679 | 679 * @param buffer |
680 } | 680 * @param bufferLength |
681 | 681 * @param startRow |
682 /** | 682 * @param startCol |
683 * <p> | 683 * @param endRow |
684 * GetScreenRect retrieves data from the various planes associated with the | 684 * @param endCol |
685 * presentation space. The data is returned as a linear array of character | 685 * @param plane |
686 * values in the buffer provided. The buffer is not terminated by a null | 686 * @return The number characters copied to the buffer |
687 * character. | 687 * @throws OhioException |
688 * </p> | 688 */ |
689 * <p> | 689 protected int GetScreenRect(char buffer[], int bufferLength, |
690 * The application supplies two coordinates that represent opposing corners | 690 int startRow, int startCol, |
691 * of a rectangle within the presentation space. The starting and ending | 691 int endRow, int endCol, int plane) |
692 * coordinates can have any spatial relationship to each other. The data | 692 // throws OhioException { |
693 * returned starts from the row containing the upper-most point to the row | 693 { |
694 * containing the lower-most point, and from the left-most column to the | 694 // number of bytes obtained |
695 * right-most column. | 695 int numBytes = 0; |
696 * </p> | 696 |
697 * <p> | 697 // lets check the row range. If they are reversed then we need to |
698 * The specified buffer must be at least large enough to contain the number | 698 // place them in the correct order. |
699 * of characters in the rectangle. If the buffer is too small, no data is | 699 if (startRow > endRow) { |
700 * copied and zero is returned by the method. Otherwise, the method returns | 700 int r = startRow; |
701 * the number of characters copied. | 701 startRow = endRow; |
702 * </p> | 702 endRow = r; |
703 * | 703 } |
704 * @param buffer | 704 |
705 * @param bufferLength | 705 // lets check the column range. If they are reversed then we need to |
706 * @param startRow | 706 // place them in the correct order. |
707 * @param startCol | 707 if (startCol > endCol) { |
708 * @param endRow | 708 int c = startCol; |
709 * @param endCol | 709 startCol = endCol; |
710 * @param plane | 710 endCol = c; |
711 * @return The number characters copied to the buffer | 711 } |
712 * @throws OhioException | 712 |
713 */ | 713 int numCols = (endCol - startCol) + 1; |
714 protected int GetScreenRect(char buffer[], int bufferLength, | 714 int numRows = (endRow - startRow) + 1; |
715 int startRow, int startCol, | 715 |
716 int endRow, int endCol, int plane) | 716 // lets make sure it is within the bounds of the character array passed |
717 // throws OhioException { | 717 // if not the return as zero bytes where read as per documentation. |
718 { | 718 if (numCols * numRows <= bufferLength) { |
719 // number of bytes obtained | 719 // make sure it is one larger. I guess for other languanges to |
720 int numBytes = 0; | 720 // reference like in C which is terminated by a zero byte at the end |
721 | 721 // of strings. |
722 // lets check the row range. If they are reversed then we need to | 722 char cb[] = new char[numCols + 1]; |
723 // place them in the correct order. | 723 int charOffset = 0; |
724 if(startRow > endRow) { | 724 int bytes = 0; |
725 int r = startRow; | 725 |
726 startRow = endRow; | 726 // now let's loop through and get the screen information for |
727 endRow = r; | 727 // each row; |
728 } | 728 for (int row = startRow; row <= endRow;) { |
729 // lets check the column range. If they are reversed then we need to | 729 if ((bytes = GetScreen(cb, cb.length, row, startCol, numCols, plane)) != 0) { |
730 // place them in the correct order. | 730 System.arraycopy(cb, 0, buffer, charOffset, numCols); |
731 if(startCol > endCol) { | 731 } |
732 int c = startCol; | 732 |
733 startCol = endCol; | 733 row++; |
734 endCol = c; | 734 charOffset += numCols; |
735 } | 735 // make sure we count the number of bytes returned |
736 int numCols = (endCol - startCol) + 1; | 736 numBytes += bytes; |
737 int numRows = (endRow - startRow) + 1; | 737 } |
738 | 738 } |
739 // lets make sure it is within the bounds of the character array passed | 739 |
740 // if not the return as zero bytes where read as per documentation. | 740 return numBytes; |
741 if(numCols * numRows <= bufferLength) { | 741 } |
742 | 742 |
743 // make sure it is one larger. I guess for other languanges to | 743 private int isOption(char[] screen, |
744 // reference like in C which is terminated by a zero byte at the end | 744 int x, |
745 // of strings. | 745 int lenScreen, |
746 char cb[] = new char[numCols + 1]; | 746 int numPref, |
747 int charOffset = 0; | 747 int numSuff, |
748 int bytes = 0; | 748 char suff) { |
749 | 749 boolean hs = true; |
750 // now let's loop through and get the screen information for | 750 int sp = x; |
751 // each row; | 751 int os = 0; |
752 for(int row = startRow; row <= endRow;) { | 752 |
753 if((bytes = GetScreen(cb, cb.length, row, startCol, numCols, plane)) != 0) { | 753 // check to the left for option |
754 System.arraycopy(cb, 0, buffer, charOffset, numCols); | 754 while (--sp >= 0 && screen[sp] <= ' ') { |
755 } | 755 if (x - sp > numPref || screen[sp] == suff || |
756 row++; | 756 screen[sp] == '.' || |
757 charOffset += numCols; | 757 screen[sp] == '*') { |
758 // make sure we count the number of bytes returned | 758 hs = false; |
759 numBytes += bytes; | 759 break; |
760 } | 760 } |
761 | 761 } |
762 } | 762 |
763 | 763 // now lets check for how long the option is it has to be numPref or less |
764 return numBytes; | 764 os = sp; |
765 } | 765 |
766 | 766 while (hs && --os > 0 && screen[os] > ' ') { |
767 private int isOption(char[] screen, | 767 if (sp - os >= numPref || screen[os] == suff || |
768 int x, | 768 screen[os] == '.' || |
769 int lenScreen, | 769 screen[os] == '*') { |
770 int numPref, | 770 hs = false; |
771 int numSuff, | 771 break; |
772 char suff) { | 772 } |
773 boolean hs =true; | 773 } |
774 int sp = x; | 774 |
775 int os = 0; | 775 if (sp - os > 1 && !Character.isDigit(screen[os + 1])) { |
776 // check to the left for option | 776 hs = false; |
777 while (--sp >=0 && screen[sp] <= ' ' ) { | 777 } |
778 | 778 |
779 if (x - sp > numPref || screen[sp] == suff|| | 779 sp = x; |
780 screen[sp] == '.' || | 780 |
781 screen[sp] == '*') { | 781 if (Character.isDigit(screen[sp + 1])) |
782 hs =false; | 782 hs = false; |
783 break; | 783 |
784 } | 784 // now lets make sure there are no more than numSuff spaces after option |
785 } | 785 while (hs && (++sp < lenScreen && screen[sp] <= ' ' |
786 | 786 || screen[sp] == suff)) { |
787 // now lets check for how long the option is it has to be numPref or less | 787 if (sp - x >= numSuff || screen[sp] == suff || |
788 os = sp; | 788 screen[sp] == '.' || |
789 while (hs && --os > 0 && screen[os] > ' ' ) { | 789 screen[sp] == '*') { |
790 | 790 hs = false; |
791 if (sp - os >= numPref || screen[os] == suff || | 791 break; |
792 screen[os] == '.' || | 792 } |
793 screen[os] == '*') { | 793 } |
794 hs = false; | 794 |
795 break; | 795 if (hs && !Character.isLetterOrDigit(screen[sp])) |
796 } | 796 hs = false; |
797 } | 797 |
798 if (sp - os > 1 && !Character.isDigit(screen[os+1])) { | 798 if (hs) { |
799 hs = false; | 799 return os; |
800 } | 800 } |
801 | 801 |
802 sp = x; | 802 return -1; |
803 | 803 } |
804 if (Character.isDigit(screen[sp+1])) | |
805 hs = false; | |
806 // now lets make sure there are no more than numSuff spaces after option | |
807 while (hs && (++sp < lenScreen && screen[sp] <= ' ' | |
808 || screen[sp] == suff )) { | |
809 if (sp - x >= numSuff || screen[sp] == suff || | |
810 screen[sp] == '.' || | |
811 screen[sp] == '*') { | |
812 hs =false; | |
813 break; | |
814 } | |
815 } | |
816 if (hs && !Character.isLetterOrDigit(screen[sp])) | |
817 hs = false; | |
818 if (hs) { | |
819 return os; | |
820 } | |
821 return -1; | |
822 } | |
823 | 804 |
824 } | 805 } |