# Class StructuredTextSingle

java.lang.Object
org.eclipse.equinox.bidi.custom.StructuredTextTypeHandler
org.eclipse.equinox.bidi.internal.StructuredTextSingle

public class StructuredTextSingle extends StructuredTextTypeHandler
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 = part2

The string returned by `getSeparators` for this handler should contain exactly one character. Additional characters will be ignored.

## Constructor Summary

Constructors
Constructor
Description
`StructuredTextSingle(String separator)`

## Method Summary

Modifier and Type
Method
Description
`int`
`getSpecialsCount(IStructuredTextExpert expert)`
Returns 1 as number of special cases handled by this handler.
`int`
`indexOfSpecial(IStructuredTextExpert expert, String text, StructuredTextCharTypes charTypes, StructuredTextOffsets offsets, int caseNumber, int fromIndex)`
Locates occurrences of the separator.
`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.

### Methods inherited from class StructuredTextTypeHandler

`getDirection, getDirection, getSeparators, insertMark, processSeparator, skipProcessing, toString`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### StructuredTextSingle

public StructuredTextSingle(String separator)

## Method Details

### indexOfSpecial

public int indexOfSpecial(IStructuredTextExpert expert, String text, StructuredTextCharTypes charTypes, StructuredTextOffsets offsets, int caseNumber, int fromIndex)
Locates occurrences of the separator.

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(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 where the start of the special case corresponding to `caseNumber` was located. The method must return the first occurrence of whatever identifies the start of the special case starting from `fromIndex`. 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:
  - `getSeparators`

### 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:
  `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(IStructuredTextExpert, String, StructuredTextCharTypes, StructuredTextOffsets, int, int)`. After calls to `IStructuredTextExpert.leanToFullText(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 length of `text`.

### getSpecialsCount

public int getSpecialsCount(IStructuredTextExpert expert)
Returns 1 as number of special cases handled by this handler.

Overrides:
  `getSpecialsCount` 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`.
Returns:
  1.