|
Eclipse Platform Release 3.4 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.compare.contentmergeviewer.TokenComparator
Implements the ITokenComparator interface for words (or tokens)
in a string.
A TokenComparator is used as the input for the RangeDifferencer
engine to perform a token oriented compare on strings.
This class may be instantiated by clients but is not intended to be subclassed.
| Constructor Summary | |
TokenComparator(String text)
Creates a TokenComparator for the given string. |
|
| Method Summary | |
int |
getRangeCount()
Returns the number of comparable entities. |
int |
getTokenLength(int index)
Returns the character length of the token with the given index. |
int |
getTokenStart(int index)
Returns the start character position of the token with the given index. |
boolean |
rangesEqual(int thisIndex,
IRangeComparator other,
int otherIndex)
Returns whether the comparable entity given by the first index matches an entity specified by the other IRangeComparator and index. |
boolean |
skipRangeComparison(int length,
int max,
IRangeComparator other)
Returns whether a comparison should be skipped because it would be too costly (or lengthy). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TokenComparator(String text)
TokenComparator for the given string.
text - the string that is split into token| Method Detail |
public int getRangeCount()
IRangeComparator
getRangeCount in interface IRangeComparatorpublic int getTokenStart(int index)
ITokenComparator
getTokenStart in interface ITokenComparatorindex - index of the token for which to return the start position
public int getTokenLength(int index)
ITokenComparator
getTokenLength in interface ITokenComparatorindex - index of the token for which to return the start position
public boolean rangesEqual(int thisIndex,
IRangeComparator other,
int otherIndex)
IRangeComparatorIRangeComparator and index.
rangesEqual in interface IRangeComparatorthisIndex - the index of the comparable entity within this IRangeComparatorother - the IRangeComparator to compare this withotherIndex - the index of the comparable entity within the other IRangeComparator
true if the comparable entities are equal
public boolean skipRangeComparison(int length,
int max,
IRangeComparator other)
IRangeComparator
skipRangeComparison in interface IRangeComparatorlength - a number on which to base the decision whether to return
true or falsemax - another number on which to base the decision whether to return
true or falseother - the other IRangeComparator to compare with
true to avoid a too lengthy range comparison
|
Eclipse Platform Release 3.4 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.