Class StructuredTextDelims
java.lang.Object
org.eclipse.equinox.bidi.custom.StructuredTextTypeHandler
org.eclipse.equinox.bidi.internal.StructuredTextDelims
- Direct Known Subclasses:
StructuredTextDelimsEsc
A base handler for structured text composed of text segments separated by
separators where the text segments may include delimited parts within which
separators are treated like regular characters.
A delimited part is bounded by a start delimiter and an end delimiter.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract String
int
indexOfSpecial
(IStructuredTextExpert expert, String text, StructuredTextCharTypes charTypes, StructuredTextOffsets offsets, int caseNumber, int fromIndex) Locates occurrences of start delimiters.int
processSpecial
(IStructuredTextExpert expert, String text, StructuredTextCharTypes charTypes, StructuredTextOffsets offsets, int caseNumber, int separLocation) Handles the text between start and end delimiters as a token.Methods inherited from class org.eclipse.equinox.bidi.custom.StructuredTextTypeHandler
getDirection, getDirection, getSeparators, getSpecialsCount, insertMark, processSeparator, skipProcessing, toString
-
Constructor Details
-
StructuredTextDelims
public StructuredTextDelims() -
StructuredTextDelims
-
-
Method Details
-
indexOfSpecial
public int indexOfSpecial(IStructuredTextExpert expert, String text, StructuredTextCharTypes charTypes, StructuredTextOffsets offsets, int caseNumber, int fromIndex) Locates occurrences of start delimiters.- Overrides:
indexOfSpecial
in 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 withintext
to start the search from.- Returns:
- the position starting from offset
fromIndex
intext
of the first occurrence of the start delimiter corresponding tocaseNumber
(first start delimiter ifcaseNumber
equals 1, second delimiter ifcaseNumber
equals 2, etc...). - See Also:
-
processSpecial
public int processSpecial(IStructuredTextExpert expert, String text, StructuredTextCharTypes charTypes, StructuredTextOffsets offsets, int caseNumber, int separLocation) Handles the text between start and end delimiters as a token. This method inserts a directional mark if needed at positionseparLocation
which corresponds to a start delimiter, and skips until after the matching end delimiter.- Overrides:
processSpecial
in 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 ofIStructuredTextExpert
which set a non-null final state,processSpecial
is called when initializing the processing with value ofseparLocation
equal to-1
.- Returns:
- the position after the matching end delimiter, or the length of
text
if no end delimiter is found.
-
getDelimiters
- Returns:
- a string containing the delimiters implemented in this class instance. This string must include an even number of characters. The first 2 characters of a string constitute a pair, the next 2 characters are a second pair, etc... In each pair, the first character is a start delimiter and the second character is an end delimiter. In the lean text, any part starting with a start delimiter and ending with the corresponding end delimiter is a delimited part. Within a delimited part, separators are treated like regular characters, which means that they do not define new segments.
-