Class StructuredTextDelims

java.lang.Object
org.eclipse.equinox.bidi.custom.StructuredTextTypeHandler
org.eclipse.equinox.bidi.internal.StructuredTextDelims
Direct Known Subclasses:
StructuredTextDelimsEsc

public abstract class StructuredTextDelims extends StructuredTextTypeHandler
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 Details

    • StructuredTextDelims

      public StructuredTextDelims()
    • StructuredTextDelims

      public StructuredTextDelims(String separators)
  • 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 class StructuredTextTypeHandler
      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 current environment.
      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 by StructuredTextTypeHandler.getSpecialsCount(org.eclipse.equinox.bidi.advanced.IStructuredTextExpert) for this handler. The meaning of this number is internal to the class implementing indexOfSpecial.
      fromIndex - the index within text to start the search from.
      Returns:
      the position starting from offset fromIndex in text of the first occurrence of the start delimiter corresponding to caseNumber (first start delimiter if caseNumber equals 1, second delimiter if caseNumber 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 position separLocation which corresponds to a start delimiter, and skips until after the matching end delimiter.
      Overrides:
      processSpecial in class StructuredTextTypeHandler
      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 current environment.
      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 by StructuredTextTypeHandler.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 to IStructuredTextExpert.leanToFullText(java.lang.String) and other methods of IStructuredTextExpert which set a non-null final state, processSpecial is called when initializing the processing with value of separLocation equal to -1.
      Returns:
      the position after the matching end delimiter, or the length of text if no end delimiter is found.
    • getDelimiters

      protected abstract String 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.