Added
Link Here
|
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
7 |
* |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
10 |
******************************************************************************/ |
11 |
package org.eclipse.equinox.bidi.complexp; |
12 |
|
13 |
import org.eclipse.equinox.bidi.internal.complexp.CxpDoer; |
14 |
|
15 |
/** |
16 |
* This class acts as a mediator between applications and complex |
17 |
* expression processors. |
18 |
* The purpose of complex expression processors is to add directional |
19 |
* formatting characters to ensure correct display. |
20 |
* This class shields applications from the |
21 |
* intricacies of complex expression processors. |
22 |
* <p> |
23 |
* For a general introduction to complex expressions, see |
24 |
* {@link <a href="package-summary.html"> |
25 |
* the package documentation</a>}. |
26 |
* |
27 |
* <h2>Code Sample</h2> |
28 |
* |
29 |
* <p>The following code shows how to instantiate a CxpHelper adapted for a |
30 |
* certain type of complex expression (directory and file paths), and how |
31 |
* to obtain the <i>full</i> text corresponding to the <i>lean</i> text |
32 |
* of such an expression. |
33 |
* |
34 |
* <pre> |
35 |
* |
36 |
* CxpHelper helper = new CxpHelper(IProcessorTypes.FILE); |
37 |
* String leanText = "D:\\\u05d0\u05d1\\\u05d2\\\u05d3.ext"; |
38 |
* String fullText = helper.leanToFullText(leanText); |
39 |
* System.out.println("full text = " + fullText); |
40 |
* |
41 |
* </pre> |
42 |
* This class provides a user-oriented API but does not provides |
43 |
* an actual implementation. The real work is done by the class |
44 |
* {@link CxpDoer}. Users of the API need not be concerned by, and |
45 |
* should not depend upon, details of the implementation by |
46 |
* <code>CxpDoer</code>. |
47 |
* |
48 |
* @author Matitiahu Allouche |
49 |
* |
50 |
*/ |
51 |
public class CxpHelper { |
52 |
/** |
53 |
* Constant to use as <code>initState</code> argument when calling |
54 |
* {@link #leanToFullText(java.lang.String, int) leanToFullText} or |
55 |
* {@link #fullToLeanText(java.lang.String, int) fullToLeanText} |
56 |
* to indicate that there is no context of previous lines which |
57 |
* should be initialized before performing the operation. |
58 |
*/ |
59 |
public static final int STATE_NOTHING_GOING = -1; |
60 |
|
61 |
private static final int[] EMPTY_INT_ARRAY = new int[0]; |
62 |
|
63 |
/** |
64 |
* Reference to the {@link CxpDoer} instance which accomplishes |
65 |
* most of the work. This member should be accessed only by |
66 |
* complex expression processors (implementing {@link ICxpProcessor}). |
67 |
*/ |
68 |
public CxpDoer ced; |
69 |
|
70 |
/** |
71 |
* Create a <code>CxpHelper</code> instance which does nothing tangible |
72 |
* but does it quickly. We will call it a <i>no-op helper</i>. |
73 |
* The {@link #CxpHelper() no-op helper} does not modify text submitted to it, and can be |
74 |
* used when it is known that no complex expression processing |
75 |
* is needed, for instance because no bidi text is expected. With this |
76 |
* helper, the cost of invoking the complex expression API is minimal. |
77 |
*/ |
78 |
public CxpHelper() { |
79 |
// let ced stay null |
80 |
} |
81 |
|
82 |
/** |
83 |
* Create a <code>CxpHelper</code> instance to process expressions |
84 |
* of type <code>type</code> with a |
85 |
* {@link CxpEnv#DEFAULT DEFAULT} environment. |
86 |
* |
87 |
* @param type represents the type of the complex expression. It must |
88 |
* be one of the values in {@link IProcessorTypes}, or a type |
89 |
* added in a plug-in extension. |
90 |
* |
91 |
* @throws IllegalArgumentException if the <code>type</code> is not |
92 |
* supported. |
93 |
*/ |
94 |
public CxpHelper(String type) { |
95 |
this(type, null); |
96 |
} |
97 |
|
98 |
/** |
99 |
* Create a <code>CxpHelper</code> instance to process expressions |
100 |
* of type <code>type</code> operating under the environment |
101 |
* {@link CxpEnv env}. |
102 |
* |
103 |
* @param type represents the type of the complex expression. It must |
104 |
* be one of the values in {@link IProcessorTypes}, or a type |
105 |
* added in a plug-in extension. |
106 |
* |
107 |
* @param env represents the environment where the complex expression |
108 |
* will be displayed. It is better to specify the environment |
109 |
* when instantiating a <code>CxpHelper</code> than to specify |
110 |
* it later using {@link #setEnvironment setEnvironment}.<br> |
111 |
* <code>null</code> can be specified here for a |
112 |
* {@link CxpEnv#DEFAULT DEFAULT} environment. |
113 |
* |
114 |
* @throws IllegalArgumentException if the <code>type</code> is not |
115 |
* supported. |
116 |
*/ |
117 |
public CxpHelper(String type, CxpEnv env) { |
118 |
ICxpProcessor proc = StringProcessor.getProcessor(type); |
119 |
if (proc == null) { |
120 |
throw new IllegalArgumentException("Invalid processor type!"); //$NON-NLS-1$ |
121 |
} |
122 |
ced = new CxpDoer(this, proc, env); |
123 |
} |
124 |
|
125 |
/** |
126 |
* Create a <code>CxpHelper</code> instance to process complex |
127 |
* expressions by means of a given processor <code>proc</code>, |
128 |
* operating under the environment {@link CxpEnv env}. |
129 |
* |
130 |
* @param proc is a complex expression processor. |
131 |
* |
132 |
* @param env represents the environment where the complex expression |
133 |
* will be displayed. It is better to specify the environment |
134 |
* when instantiating a <code>CxpHelper</code> than to specify |
135 |
* it later using {@link #setEnvironment setEnvironment}.<br> |
136 |
* <code>null</code> can be specified here for a |
137 |
* {@link CxpEnv#DEFAULT DEFAULT} environment. |
138 |
*/ |
139 |
public CxpHelper(ICxpProcessor proc, CxpEnv env) { |
140 |
ced = new CxpDoer(this, proc, env); |
141 |
} |
142 |
|
143 |
/** Add directional formatting characters to a complex expression |
144 |
* to ensure correct presentation. |
145 |
* |
146 |
* @param text is the text of the complex expression. |
147 |
* |
148 |
* @return the complex expression with directional formatting |
149 |
* characters added at proper locations to ensure correct |
150 |
* presentation.<br> |
151 |
* The {@link #CxpHelper() no-op helper} returns <code>text</code>. |
152 |
*/ |
153 |
public String leanToFullText(String text) { |
154 |
return leanToFullText(text, STATE_NOTHING_GOING); |
155 |
} |
156 |
|
157 |
/** |
158 |
* Add directional formatting characters to a complex expression |
159 |
* to ensure correct presentation. |
160 |
* |
161 |
* @param text is the text of the complex expression. |
162 |
* |
163 |
* @param initState specifies that the first parameter is the |
164 |
* continuation of text submitted in a previous call. |
165 |
* The <code>initState</code> of the present call must be |
166 |
* the final state obtained by calling |
167 |
* {@link #getFinalState() getFinalState} |
168 |
* after the previous call. |
169 |
* <br>If the present call is not a continuation of |
170 |
* text submitted in a previous call, the value |
171 |
* {@link #STATE_NOTHING_GOING} should be used as argument. |
172 |
* |
173 |
* @return the complex expression with directional formatting |
174 |
* characters added at proper locations to ensure correct |
175 |
* presentation.<br> |
176 |
* The {@link #CxpHelper() no-op helper} returns <code>text</code>. |
177 |
* |
178 |
* @see #getFinalState getFinalState |
179 |
*/ |
180 |
public String leanToFullText(String text, int initState) { |
181 |
if (ced == null) |
182 |
return text; |
183 |
return ced.leanToFullText(text, initState); |
184 |
} |
185 |
|
186 |
/** |
187 |
* Given a complex expression, get the offsets of characters before |
188 |
* which directional formatting characters must be added in order to |
189 |
* ensure correct presentation. |
190 |
* Only LRMs (for an expression with LTR base direction) and RLMs (for |
191 |
* an expression with RTL base direction) are considered. Leading and |
192 |
* trailing LRE, RLE and PDF which might be prefixed or suffixed |
193 |
* depending on the {@link CxpEnv#orientation orientation} of the |
194 |
* GUI component used for display are not reflected in this method. |
195 |
* <p> |
196 |
* This method assumes that a successful call to |
197 |
* {@link #leanToFullText leanToFullText} has been performed, and it |
198 |
* returns the offsets relevant for the last text submitted. |
199 |
* |
200 |
* @return an array of offsets to the characters in the last submitted |
201 |
* complex expression before which directional marks must be |
202 |
* added to ensure correct presentation. |
203 |
* The offsets are sorted in ascending order.<br> |
204 |
* The {@link #CxpHelper() no-op helper} returns an array of 0 elements. |
205 |
*/ |
206 |
public int[] leanBidiCharOffsets() { |
207 |
if (ced == null) |
208 |
return EMPTY_INT_ARRAY; |
209 |
return ced.leanBidiCharOffsets(); |
210 |
} |
211 |
|
212 |
/** |
213 |
* Get the offsets of characters in the <i>full</i> text of a |
214 |
* complex expression corresponding to directional formatting |
215 |
* characters which have been added in order to ensure correct presentation. |
216 |
* LRMs (for an expression with LTR base direction), RLMs (for |
217 |
* an expression with RTL base direction) are considered as well as |
218 |
* leading and trailing LRE, RLE and PDF which might be prefixed or suffixed |
219 |
* depending on the {@link CxpEnv#orientation orientation} of the |
220 |
* GUI component used for display. |
221 |
* <p> |
222 |
* This method assumes that a successful call to |
223 |
* {@link #leanToFullText leanToFullText} has been performed, and it |
224 |
* returns the offsets relevant for the last text submitted. |
225 |
* |
226 |
* @return an array of offsets to the characters in the <i>full</i> |
227 |
* text of the last submitted complex expression which are |
228 |
* directional formatting characters added to ensure correct |
229 |
* presentation. |
230 |
* The offsets are sorted in ascending order.<br> |
231 |
* The {@link #CxpHelper() no-op helper} returns an array of 0 elements. |
232 |
*/ |
233 |
public int[] fullBidiCharOffsets() { |
234 |
if (ced == null) |
235 |
return EMPTY_INT_ARRAY; |
236 |
return ced.fullBidiCharOffsets(); |
237 |
} |
238 |
|
239 |
/** |
240 |
* Remove directional formatting characters which were added to a |
241 |
* complex expression to ensure correct presentation. |
242 |
* |
243 |
* @param text is the text of the complex expression including |
244 |
* directional formatting characters. |
245 |
* |
246 |
* @return the complex expression without directional formatting |
247 |
* characters which might have been added by processing it |
248 |
* with {@link #leanToFullText leanToFullText}.<br> |
249 |
* The {@link #CxpHelper() no-op helper} returns <code>text</code> |
250 |
* |
251 |
*/ |
252 |
public String fullToLeanText(String text) { |
253 |
return fullToLeanText(text, STATE_NOTHING_GOING); |
254 |
} |
255 |
|
256 |
/** |
257 |
* Remove directional formatting characters which were added to a |
258 |
* complex expression to ensure correct presentation. |
259 |
* |
260 |
* @param text is the text of the complex expression including |
261 |
* directional formatting characters. |
262 |
* |
263 |
* @param initState specifies that the first parameter is the |
264 |
* continuation of text submitted in a previous call. |
265 |
* The <code>initState</code> of the present call must be |
266 |
* the final state obtained by calling |
267 |
* {@link #getFinalState getFinalState} after the previous call. |
268 |
* <br>If the present call is not a continuation of |
269 |
* text submitted in a previous call, the value |
270 |
* {@link #STATE_NOTHING_GOING} should be used as argument. |
271 |
* |
272 |
* @return the complex expression without directional formatting |
273 |
* characters which might have been added by processing it |
274 |
* with {@link #leanToFullText leanToFullText}.<br> |
275 |
* The {@link #CxpHelper() no-op helper} returns <code>text</code> |
276 |
* |
277 |
* @see #getFinalState getFinalState |
278 |
*/ |
279 |
public String fullToLeanText(String text, int initState) { |
280 |
if (ced == null) |
281 |
return text; |
282 |
return ced.fullToLeanText(text, initState); |
283 |
} |
284 |
|
285 |
/** |
286 |
* Retrieve the final state achieved in a previous call to |
287 |
* {@link #leanToFullText leanToFullText} or |
288 |
* {@link #fullToLeanText fullToLeanText}. |
289 |
* This state is an opaque value which is meaningful only |
290 |
* within calls to the same complex expression processor. |
291 |
* The only externalized value is |
292 |
* {@link #STATE_NOTHING_GOING} which means that |
293 |
* there is nothing to remember from the last call. |
294 |
* <p> |
295 |
* The state should be used only for complex expressions which come |
296 |
* in parts, like when spanning multiple lines. The user can make |
297 |
* a separate call to |
298 |
* <code>leanToFullText</code> or <code>fullToLeanText</code> for each |
299 |
* line in the expression. The final state value retrieved after the |
300 |
* call for one line should be used as the initial state in the call |
301 |
* which processes the next line. |
302 |
* <p> |
303 |
* If a line within a complex expression has already been processed by |
304 |
* <code>leanToFullText</code> and the <i>lean</i> version of that line has |
305 |
* not changed, and its initial state has not changed either, the user |
306 |
* can be sure that the <i>full</i> version of that line is also |
307 |
* identical to the result of the previous processing. |
308 |
* |
309 |
* @see #leanToFullText(String text, int initState) |
310 |
* @see #fullToLeanText(String text, int initState) |
311 |
* |
312 |
* @return the last final state.<br> |
313 |
* The {@link #CxpHelper() no-op helper} returns {@link #STATE_NOTHING_GOING}. |
314 |
*/ |
315 |
public int getFinalState() { |
316 |
if (ced == null) |
317 |
return STATE_NOTHING_GOING; |
318 |
return ced.getFinalState(); |
319 |
} |
320 |
|
321 |
/** |
322 |
* After transforming a <i>lean</i> string into a <i>full</i> string |
323 |
* using {@link #leanToFullText leanToFullText}, compute the index in the |
324 |
* <i>full</i> string of the character corresponding to the |
325 |
* character with the specified position in the <i>lean</i> string. |
326 |
* |
327 |
* @param pos is the index of a character in the <i>lean</i> string. |
328 |
* It must be a non-negative number smaller than the length |
329 |
* of the <i>lean</i> text. |
330 |
* |
331 |
* @return the index of the corresponding character in the |
332 |
* <i>full</i> string.<br> |
333 |
* The {@link #CxpHelper() no-op helper} returns <code>pos</code>. |
334 |
*/ |
335 |
public int leanToFullPos(int pos) { |
336 |
if (ced == null) |
337 |
return pos; |
338 |
return ced.leanToFullPos(pos); |
339 |
} |
340 |
|
341 |
/** |
342 |
* After transforming a <i>lean</i> string into a <i>full</i> string |
343 |
* using {@link #leanToFullText leanToFullText}, compute the index in the |
344 |
* <i>lean</i> string of the character corresponding to the |
345 |
* character with the specified position in the <i>full</i> string. |
346 |
* |
347 |
* @param pos is the index of a character in the <i>full</i> string. |
348 |
* It must be a non-negative number smaller than the length |
349 |
* of the <i>full</i> text. |
350 |
* |
351 |
* @return the index of the corresponding character in the |
352 |
* <i>lean</i> string. If there is no corresponding |
353 |
* character in the <i>lean</i> string (because the |
354 |
* specified character is a directional formatting character |
355 |
* added when invoking {@link #leanToFullText leanToFullText}), |
356 |
* the value returned will be that corresponding to the |
357 |
* next character which is not a directional formatting |
358 |
* character.<br> |
359 |
* If <code>pos</code> corresponds to a directional formatting |
360 |
* character beyond all characters of the original |
361 |
* <i>lean</i> text, the value returned is the length of the |
362 |
* <i>lean</i> text.<br> |
363 |
* The {@link #CxpHelper() no-op helper} returns <code>pos</code>. |
364 |
*/ |
365 |
public int fullToLeanPos(int pos) { |
366 |
if (ced == null) |
367 |
return pos; |
368 |
return ced.fullToLeanPos(pos); |
369 |
} |
370 |
|
371 |
/** |
372 |
* Get the base direction of the complex expression last |
373 |
* submitted to {@link #leanToFullText leanToFullText}. |
374 |
* This base direction may depend on |
375 |
* whether the expression contains Arabic or Hebrew words |
376 |
* (if it contains both, the first Arabic or Hebrew letter in the |
377 |
* expression determines which is the governing script) and on |
378 |
* whether the GUI is {@link CxpEnv#mirrored mirrored}. |
379 |
* |
380 |
* @return the base direction of the last submitted complex |
381 |
* expression. It must be one of the values |
382 |
* {@link CxpFeatures#DIR_LTR} or {@link CxpFeatures#DIR_RTL}.<br> |
383 |
* The {@link #CxpHelper() no-op helper} returns <code>DIR_LTR</code>. |
384 |
*/ |
385 |
public int getCurDirection() { |
386 |
if (ced == null) |
387 |
return CxpFeatures.DIR_LTR; |
388 |
return ced.getCurDirection(); |
389 |
} |
390 |
|
391 |
/** |
392 |
* Get the current environment under which the <code>CxpHelper</code> |
393 |
* operates. |
394 |
* This environment may have been specified in the constructor or |
395 |
* specified later using {@link #setEnvironment setEnvironment}.<br> |
396 |
* |
397 |
* @return the current environment.<br> |
398 |
* The {@link #CxpHelper() no-op helper} returns a {@link CxpEnv#DEFAULT DEFAULT} |
399 |
* environment. |
400 |
* |
401 |
* @see #setEnvironment setEnvironment |
402 |
*/ |
403 |
public CxpEnv getEnvironment() { |
404 |
if (ced == null) |
405 |
return CxpEnv.DEFAULT; |
406 |
return ced.getEnvironment(); |
407 |
} |
408 |
|
409 |
/** |
410 |
* Specify the environment under which the <code>CxpHelper</code> |
411 |
* must operate. |
412 |
* <p> |
413 |
* <b>Note</b> that calling this method causes the processor |
414 |
* associated with this instance of <code>CxpHelper</code> |
415 |
* to re-initialize its features. The effect of a previous call |
416 |
* to {@link #setFeatures(CxpFeatures) setFeatures} is lost.<br> |
417 |
* The {@link #CxpHelper() no-op helper} does nothing. |
418 |
* |
419 |
* @see #getEnvironment getEnvironment |
420 |
* @see ICxpProcessor#init2 ICxpProcessor.init2 |
421 |
*/ |
422 |
public void setEnvironment(CxpEnv environment) { |
423 |
if (ced == null) { |
424 |
return; // do nothing |
425 |
} |
426 |
ced.setEnvironment(environment); |
427 |
} |
428 |
|
429 |
/** |
430 |
* Get the current features of the processor associated with this |
431 |
* <code>CxpHelper</code> instance. |
432 |
* |
433 |
* @return the current features.<br> |
434 |
* The {@link #CxpHelper() no-op helper} returns {@link CxpFeatures#DEFAULT DEFAULT} |
435 |
* features. |
436 |
* |
437 |
* @see #setFeatures setFeatures |
438 |
*/ |
439 |
public CxpFeatures getFeatures() { |
440 |
if (ced == null) |
441 |
return CxpFeatures.DEFAULT; |
442 |
return ced.getFeatures(); |
443 |
} |
444 |
|
445 |
/** |
446 |
* Specify the features to be applied to the processor associated with this |
447 |
* <code>CxpHelper</code> instance. |
448 |
* Note that the value of {@link CxpFeatures#specialsCount specialsCount} |
449 |
* cannot be changed (the new value will be ignored).<br> |
450 |
* The {@link #CxpHelper() no-op helper} does nothing. |
451 |
* |
452 |
* @see #getFeatures getFeatures |
453 |
*/ |
454 |
public void setFeatures(CxpFeatures features) { |
455 |
if (ced == null) { |
456 |
return; // do nothing |
457 |
} |
458 |
ced.setFeatures(features); |
459 |
} |
460 |
|
461 |
/** |
462 |
* This method can be called from within |
463 |
* {@link ICxpProcessor#indexOfSpecial indexOfSpecial} or |
464 |
* {@link ICxpProcessor#processSpecial processSpecial} in implementations |
465 |
* of {@link ICxpProcessor} to retrieve the bidirectional class of |
466 |
* characters in the <i>lean</i> text. |
467 |
* |
468 |
* @param index position of the character in the <i>lean</i> text. |
469 |
* It must be a non-negative number smaller than the length |
470 |
* of the <i>lean</i> text. |
471 |
* |
472 |
* @return the bidirectional class of the character. It is one of the |
473 |
* values which can be returned by |
474 |
* <code>java.lang.Character#getDirectionality</code>. |
475 |
* However, it is recommended to use <code>getDirProp</code> |
476 |
* rather than <code>java.lang.Character.getDirectionality</code> |
477 |
* since <code>getDirProp</code> manages a cache of character |
478 |
* properties and so can be more efficient than calling the |
479 |
* java.lang.Character method.<br> |
480 |
* The {@link #CxpHelper() no-op helper} returns |
481 |
* <code>Character.DIRECTIONALITY_UNDEFINED</code>. |
482 |
*/ |
483 |
public byte getDirProp(int index) { |
484 |
if (ced == null) |
485 |
return Character.DIRECTIONALITY_UNDEFINED; |
486 |
return ced.getDirProp(index); |
487 |
} |
488 |
|
489 |
/** |
490 |
* This method can be called from within |
491 |
* {@link ICxpProcessor#indexOfSpecial indexOfSpecial} or |
492 |
* {@link ICxpProcessor#processSpecial processSpecial} in implementations |
493 |
* of {@link ICxpProcessor} to set or override the bidirectional |
494 |
* class of characters in the <i>lean</i> text. |
495 |
* |
496 |
* @param index position of the character in the <i>lean</i> text. |
497 |
* It must be a non-negative number smaller than the length |
498 |
* of the <i>lean</i> text. |
499 |
* |
500 |
* @param dirProp bidirectional class of the character. It is one of the |
501 |
* values which can be returned by |
502 |
* <code>java.lang.Character.getDirectionality</code>.<br> |
503 |
* The {@link #CxpHelper() no-op helper} does nothing. |
504 |
*/ |
505 |
public void setDirProp(int index, byte dirProp) { |
506 |
if (ced != null) |
507 |
ced.getDirProp(index); |
508 |
} |
509 |
|
510 |
/** |
511 |
* This method can be called from within |
512 |
* {@link ICxpProcessor#indexOfSpecial indexOfSpecial} or |
513 |
* {@link ICxpProcessor#processSpecial processSpecial} in implementations |
514 |
* of {@link ICxpProcessor} |
515 |
* to specify that a mark character must be added before the character |
516 |
* at the specified position of the <i>lean</i> text when generating the |
517 |
* <i>full</i> text. The mark character will be LRM for complex expressions |
518 |
* with a LTR base direction, and RLM for complex expressions with RTL |
519 |
* base direction. The mark character is not added physically by this |
520 |
* method, but its position is noted and will be used when generating |
521 |
* the <i>full</i> text. |
522 |
* |
523 |
* @param offset position of the character in the <i>lean</i> text. |
524 |
* It must be a non-negative number smaller than the length |
525 |
* of the <i>lean</i> text. |
526 |
* For the benefit of efficiency, it is better to insert |
527 |
* multiple marks in ascending order of the offsets.<br> |
528 |
* The {@link #CxpHelper() no-op helper} does nothing. |
529 |
*/ |
530 |
public void insertMark(int offset) { |
531 |
if (ced != null) |
532 |
ced.insertMark(offset); |
533 |
} |
534 |
|
535 |
/** |
536 |
* This method can be called from within |
537 |
* {@link ICxpProcessor#indexOfSpecial indexOfSpecial} or |
538 |
* {@link ICxpProcessor#processSpecial processSpecial} in |
539 |
* implementations of {@link ICxpProcessor} to add a |
540 |
* directional mark before an |
541 |
* operator if needed for correct display, depending on the |
542 |
* base direction of the expression and on the class of the |
543 |
* characters in the <i>lean</i> text preceding and following |
544 |
* the operator itself.<br> |
545 |
* The {@link #CxpHelper() no-op helper} does nothing. |
546 |
* |
547 |
* @param operLocation offset of the operator in the <i>lean</i> text. |
548 |
* It must be a non-negative number smaller than the length |
549 |
* of the <i>lean</i> text. |
550 |
*/ |
551 |
public void processOperator(int operLocation) { |
552 |
if (ced != null) |
553 |
ced.processOperator(operLocation); |
554 |
} |
555 |
|
556 |
/** |
557 |
* This method can be called from within |
558 |
* {@link ICxpProcessor#indexOfSpecial indexOfSpecial} or |
559 |
* {@link ICxpProcessor#processSpecial processSpecial} in |
560 |
* implementations of {@link ICxpProcessor} to |
561 |
* set the final state which should be used for the next call to |
562 |
* {@link #leanToFullText(java.lang.String, int)}.<br> |
563 |
* The {@link #CxpHelper() no-op helper} does nothing. |
564 |
*/ |
565 |
public void setFinalState(int newState) { |
566 |
if (ced != null) |
567 |
ced.setFinalState(newState); |
568 |
} |
569 |
|
570 |
} |