Class StructuredTextSingle
java.lang.Object
org.eclipse.equinox.bidi.custom.StructuredTextTypeHandler
org.eclipse.equinox.bidi.internal.StructuredTextSingle
A base handler for structured text composed of two parts separated by a
separator. The first occurrence of the separator delimits the end of the
first part and the start of the second part. Further occurrences of the
separator, if any, are treated like regular characters of the second text
part. The handler makes sure that the text be presented in the form (assuming
that the equal sign is the separator):
part1 = part2The string returned by
getSeparators for this handler should contain exactly one character.
Additional characters will be ignored.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns 1 as number of special cases handled by this handler.intindexOfSpecial(IStructuredTextExpert expert, String text, StructuredTextCharTypes charTypes, StructuredTextOffsets offsets, int caseNumber, int fromIndex) Locates occurrences of the separator.intprocessSpecial(IStructuredTextExpert expert, String text, StructuredTextCharTypes charTypes, StructuredTextOffsets offsets, int caseNumber, int separLocation) Inserts a mark before the separator if needed and skips to the end of the source string.Methods inherited from class org.eclipse.equinox.bidi.custom.StructuredTextTypeHandler
getDirection, getDirection, getSeparators, insertMark, processSeparator, skipProcessing, toString
-
Constructor Details
-
StructuredTextSingle
-
-
Method Details
-
indexOfSpecial
public int indexOfSpecial(IStructuredTextExpert expert, String text, StructuredTextCharTypes charTypes, StructuredTextOffsets offsets, int caseNumber, int fromIndex) Locates occurrences of the separator.- Overrides:
indexOfSpecialin classStructuredTextTypeHandler- Parameters:
expert- IStructuredTextExpert instance through which this handler is invoked. The handler can use IStructuredTextExpert methods to query items stored in the expert instance, like the currentenvironment.text- the structured text string before addition of any directional formatting characters.charTypes- an object whose methods can be useful to the handler.offsets- an object whose methods can be useful to the handler.caseNumber- number of the special case to locate. This number varies from 1 to the number of special cases returned byStructuredTextTypeHandler.getSpecialsCount(org.eclipse.equinox.bidi.advanced.IStructuredTextExpert)for this handler. The meaning of this number is internal to the class implementingindexOfSpecial.fromIndex- the index withintextto start the search from.- Returns:
- the position where the start of the special case corresponding to
caseNumberwas located. The method must return the first occurrence of whatever identifies the start of the special case starting fromfromIndex. The method does not have to check if this occurrence appears within the scope of another special case (e.g. a comment starting delimiter within the scope of a literal or vice-versa).
If no occurrence is found, the method must return -1. - See Also:
-
processSpecial
public int processSpecial(IStructuredTextExpert expert, String text, StructuredTextCharTypes charTypes, StructuredTextOffsets offsets, int caseNumber, int separLocation) Inserts a mark before the separator if needed and skips to the end of the source string.- Overrides:
processSpecialin classStructuredTextTypeHandler- Parameters:
expert- IStructuredTextExpert instance through which this handler is invoked. The handler can use IStructuredTextExpert methods to query items stored in the expert instance, like the currentenvironment.text- the structured text string before addition of any directional formatting characters.charTypes- an object whose methods can be useful to the handler.offsets- an object whose methods can be useful to the handler.caseNumber- number of the special case to handle.separLocation- the position returned byStructuredTextTypeHandler.indexOfSpecial(org.eclipse.equinox.bidi.advanced.IStructuredTextExpert, java.lang.String, org.eclipse.equinox.bidi.custom.StructuredTextCharTypes, org.eclipse.equinox.bidi.custom.StructuredTextOffsets, int, int). After calls toIStructuredTextExpert.leanToFullText(java.lang.String)and other methods ofIStructuredTextExpertwhich set a non-null final state,processSpecialis called when initializing the processing with value ofseparLocationequal to-1.- Returns:
- the length of
text.
-
getSpecialsCount
Returns 1 as number of special cases handled by this handler.- Overrides:
getSpecialsCountin classStructuredTextTypeHandler- Parameters:
expert- IStructuredTextExpert instance through which this handler is invoked. The handler can use IStructuredTextExpert methods to query items stored in the expert instance, like the currentenvironment.- Returns:
- 1.
-