Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.jface.text.source
Interface ICharacterPairMatcher

public interface ICharacterPairMatcher

A character pair matcher finds to a character at a certain document offset the matching peer character. It is the matchers responsibility to define the concepts of "matching" and "peer". The matching process starts at a given offset. Starting of this offset, the matcher chooses a character close to this offset. The anchor defines whether the chosen character is left or right of the initial offset. The matcher then searches for the matching peer character of the chosen character and if it finds one, delivers the minimal region of the document that contains both characters.

Since:
  2.1

Field Summary
`static int` | `LEFT` Indicates the anchor value "left".
`static int` | `RIGHT` Indicates the anchor value "right".

Method Summary
`void` | `clear()` Clears this pair matcher.
`void` | `dispose()` Disposes this pair matcher.
`int` | `getAnchor()` Returns the anchor for the region of the matching peer characters.
`IRegion` | `match(IDocument iDocument, int i)` Starting at the given offset, the matcher chooses a character close to this offset.

Field Detail

### RIGHT

    public static final int RIGHT

  Indicates the anchor value "right".

  See Also:
    Constant Field Values

### LEFT

    public static final int LEFT

  Indicates the anchor value "left".

  See Also:
    Constant Field Values

Method Detail

### dispose

    public void dispose()

  Disposes this pair matcher.

### clear

    public void clear()

  Clears this pair matcher. I.e. the matcher throws away all state it might remember and prepares itself for a new call of the `match` method.

### match

    public IRegion match(IDocument iDocument,
                         int i)

  Starting at the given offset, the matcher chooses a character close to this offset. The matcher then searches for the matching peer character of the chosen character and if it finds one, returns the minimal region of the document that contains both characters. It returns `null` if there is no peer character.

  Parameters:
    `iDocument` - the document to work on
    `i` - the start offset
  Returns:
    the minimal region containing the peer characters

### getAnchor

    public int getAnchor()

  Returns the anchor for the region of the matching peer characters. The anchor says whether the character that has been chosen to search for its peer character has been left or right of the initial offset.

  Returns:
    `RIGHT` or `LEFT`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.