## org.eclipse.datatools.sqltools.sqleditor.internal.matching
Class GenericSQLPairMatcher

    java.lang.Object
      org.eclipse.datatools.sqltools.sqleditor.internal.matching.AbstractPairMatcher
          org.eclipse.datatools.sqltools.sqleditor.internal.matching.GenericSQLPairMatcher

All Implemented Interfaces:
  org.eclipse.jface.text.source.ICharacterPairMatcher

    public class GenericSQLPairMatcher

extends AbstractPairMatcher

The class intends for generic SQL token matching.

Author:
  juewu

Field Summary

Fields inherited from interface org.eclipse.jface.text.source.ICharacterPairMatcher
`LEFT, RIGHT`

Constructor Summary
`GenericSQLPairMatcher(IMatchingPairs matchingPairs)`

Method Summary
`int` `getMatchingTokenLength()` Getting the token of the token which matches with the selected token.
`int` `getMatchingTokenStartOffset(java.lang.String token, int start, boolean forward, java.lang.String text)` Getting the start offset of the matching token.
`java.lang.String` `getOriginalToken(java.lang.String text, int offset)` Getting the token according to selected position.
`int` `getOriginalTokenEndOffset(java.lang.String text, int offset)` Getting the end offset of selected token.
`int` `getOriginalTokenLength()` Getting the length of the token which is get from getOriginalToken method.
`void` `setSQLEditor(SQLEditor editor)`

Methods inherited from class org.eclipse.datatools.sqltools.sqleditor.internal.matching.AbstractPairMatcher
`clear, dispose, getAnchor, getSQLEditor, match`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GenericSQLPairMatcher

    public GenericSQLPairMatcher(IMatchingPairs matchingPairs)

Method Detail

### getMatchingTokenLength

    public int getMatchingTokenLength()

  Description copied from class: `AbstractPairMatcher`
  Getting the token of the token which matches with the selected token.

  Specified by:
    `getMatchingTokenLength` in class `AbstractPairMatcher`
  Returns:
    a `int` represents the matching token length.

### getMatchingTokenStartOffset

    public int getMatchingTokenStartOffset(java.lang.String token,
                                           int start,
                                           boolean forward,
                                           java.lang.String text)

  Description copied from class: `AbstractPairMatcher`
  Getting the start offset of the matching token.

  Specified by:
    `getMatchingTokenStartOffset` in class `AbstractPairMatcher`
  Parameters:
    `token` - is a `String` represents the selected token.
    `start` - is the selected token end offset.
    `forward` - represents searching forward or back ward.
    `text` - is the document text.
  Returns:
    If the matching token exists, return its start offset. Otherwise, return -1;

### getOriginalToken

    public java.lang.String getOriginalToken(java.lang.String text,
                                             int offset)

  Description copied from class: `AbstractPairMatcher`
  Getting the token according to selected position.

  Specified by:
    `getOriginalToken` in class `AbstractPairMatcher`
  Parameters:
    `text` - is the document text.
    `offset` - is the selected position.
  Returns:
    If supported token exists, return this token. Otherwise return null.

### getOriginalTokenEndOffset

    public int getOriginalTokenEndOffset(java.lang.String text,
                                         int offset)

  Description copied from class: `AbstractPairMatcher`
  Getting the end offset of selected token.

  Specified by:
    `getOriginalTokenEndOffset` in class `AbstractPairMatcher`
  Parameters:
    `text` - is the document text.
    `offset` - is the selected position.
  Returns:
    a `int` which is end offset of selected token.

### getOriginalTokenLength

    public int getOriginalTokenLength()

  Description copied from class: `AbstractPairMatcher`
  Getting the length of the token which is get from getOriginalToken method.

  Specified by:
    `getOriginalTokenLength` in class `AbstractPairMatcher`
  Returns:
    the token length.

### setSQLEditor

    public void setSQLEditor(SQLEditor editor)

  Overrides:
    `setSQLEditor` in class `AbstractPairMatcher`