org.eclipse.jface.text.source
Interface ICharacterPairMatcher
-
All Known Implementing Classes:
-
DefaultCharacterPairMatcher
-
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. |
RIGHT
static final int RIGHT
- Indicates the anchor value "right".
-
See Also:
-
Constant Field Values
LEFT
static final int LEFT
- Indicates the anchor value "left".
-
See Also:
-
Constant Field Values
dispose
void dispose()
- Disposes this pair matcher.
-
clear
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
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
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
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.