public class CompareTokens extends Object
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
CompareTokens() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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
public static Date Str2Date(String dateStr) throws ParseException
dateStr - The date convrtParseException - A parsing error occuredpublic static int compare(String token1, String token2) throws InvalidTokenFormatComparison
token1 - First token to be comparedtoken2 - Second token to be compared0 if token1==token2, 1 if token1>token2, -1 if token1<token2InvalidTokenFormatComparison - tokens where not validpublic static ComparisonMode getMode(String token1, String token2) throws InvalidTokenFormatComparison
token1 - First token to be comparedtoken2 - Second token to be comparedInvalidTokenFormatComparison - if tokens were not validpublic static ComparisonMode getMode() throws Exception
Exception - if mode is not setpublic static void setMode(ComparisonMode mode)
mode - New comparison modepublic static ComparisonMode updateMode(String token) throws InvalidTokenFormatComparison
token - token used to update modeInvalidTokenFormatComparison - tokens where not validpublic 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_STRINGS0 if token1==token2, 1 if token1>token2, -1 if token1<token2InvalidTokenFormatComparison - tokens where not validCopyright © 2017. All Rights Reserved.