|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgr.uoa.di.madgik.searchlibrary.operatorlibrary.comparator.CompareTokens
public class CompareTokens
The CompareTokens class exports a single method called compare. It is designed to be used in a static context, meaning that no CompareTokens object is created. The comparisons made for string are case insensitive
| Field Summary | |
|---|---|
static short |
ASCENDING_ORDER
Compare in ascending order |
static short |
COMPARE_EQUAL
The compare operation returned equal |
static short |
COMPARE_GREATER
The compare operation returned greater |
static short |
COMPARE_LOWER
The compare operation returned lower |
static short |
DESCENDING_ORDER
Compare in descending order |
| Constructor Summary | |
|---|---|
CompareTokens()
|
|
| Method Summary | |
|---|---|
static int |
compare(String token1,
String token2)
The compare method compares two tokens. |
static int |
compare(String token1,
String token2,
ComparisonMode mode)
This version of the compare method compares two tokens. |
static ComparisonMode |
getMode()
Gets the stored mode of comparison |
static ComparisonMode |
getMode(String token1,
String token2)
|
static void |
setMode(ComparisonMode mode)
Sets a new value to comparison mode |
static Date |
Str2Date(String dateStr)
The Str2Date method translates a string into its corresponding date representation. |
static ComparisonMode |
updateMode(String token)
Updates the mode of comparison according to the token parameter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final short COMPARE_EQUAL
public static final short COMPARE_GREATER
public static final short COMPARE_LOWER
public static final short ASCENDING_ORDER
public static final short DESCENDING_ORDER
| Constructor Detail |
|---|
public CompareTokens()
| Method Detail |
|---|
public static Date Str2Date(String dateStr)
throws ParseException
dateStr - The date convrt
ParseException - A parsing error occured
public static int compare(String token1,
String token2)
throws InvalidTokenFormatComparison
token1 - First token to be comparedtoken2 - Second token to be compared
0 if token1==token2, 1 if token1>token2, -1 if token1<token2
InvalidTokenFormatComparison - tokens where not valid
public static ComparisonMode getMode(String token1,
String token2)
throws InvalidTokenFormatComparison
token1 - First token to be comparedtoken2 - Second token to be compared
InvalidTokenFormatComparison - if tokens were not valid
public static ComparisonMode getMode()
throws Exception
Exception - if mode is not setpublic static void setMode(ComparisonMode mode)
mode - New comparison mode
public static ComparisonMode updateMode(String token)
throws InvalidTokenFormatComparison
token - token used to update mode
InvalidTokenFormatComparison - tokens where not valid
public static int compare(String token1,
String token2,
ComparisonMode mode)
throws InvalidTokenFormatComparison
token1 - First token to be comparedtoken2 - Second token to be comparedmode - The mode of comparison, one of COMPARE_INTS, COMPARE_DOUBLES and COMPARE_STRINGS
0 if token1==token2, 1 if token1>token2, -1 if token1<token2
InvalidTokenFormatComparison - tokens where not valid
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||