|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<Comparator>
net.sf.mmm.util.lang.api.Comparator
public enum Comparator
A Comparator represents a function that compares two given values.
| Enum Constant Summary | |
|---|---|
EQUAL
Comparator to check if objects are equal. |
|
GREATER_OR_EQUAL
Comparator to check if some value is greater or equal to another. |
|
GREATER_THAN
Comparator to check if some value is greater than another. |
|
LESS_OR_EQUAL
Comparator to check if some value is less or equal than another. |
|
LESS_THAN
Comparator to check if some value is less than another. |
|
NOT_EQUAL
Comparator to check if objects are NOT
equal. |
|
| Field Summary | |
|---|---|
private boolean |
evalTrueIfEquals
|
private Boolean |
less
|
private String |
title
|
private String |
value
|
| Method Summary | |
|---|---|
private Object |
convert(Object object,
Class<?> otherType)
This method converts the given value to a more common type. |
abstract boolean |
eval(double arg1,
double arg2)
This method evaluates this Comparator for the given arguments. |
boolean |
eval(Object arg1,
Object arg2)
This method evaluates this Comparator for the given arguments. |
private boolean |
evalComparable(Comparable arg1,
Comparable arg2)
This method handles eval(Object, Object) for two
Comparables. |
static Comparator |
fromValue(String value)
This method gets the Comparator for the given symbol. |
String |
getTitle()
This method gets the title of this datatype. |
String |
getValue()
This method gets the symbol of the Comparator. |
String |
toString()
This method needs to return the same result a Datatype.getTitle(). |
static Comparator |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static Comparator[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final Comparator GREATER_THAN
Comparator to check if some value is greater than another.
public static final Comparator GREATER_OR_EQUAL
Comparator to check if some value is greater or equal to another.
public static final Comparator LESS_THAN
Comparator to check if some value is less than another.
public static final Comparator LESS_OR_EQUAL
Comparator to check if some value is less or equal than another.
public static final Comparator EQUAL
Comparator to check if objects are equal.
public static final Comparator NOT_EQUAL
Comparator to check if objects are NOT
equal.
| Field Detail |
|---|
private final String value
getValue()private final String title
getTitle()private final boolean evalTrueIfEquals
eval(Object, Object)private final Boolean less
evalComparable(Comparable, Comparable)| Method Detail |
|---|
public static Comparator[] values()
for (Comparator c : Comparator.values()) System.out.println(c);
public static Comparator valueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant
with the specified name
NullPointerException - if the argument is nullpublic String getValue()
Comparator. E.g. "==", ">",
">=", etc.
getValue in interface Datatype<String>public String getTitle()
NlsMessage).Datatype.toString() is quite weak, this
method is added to explicitly express the presence of the title and to
ensure implementors of this interface can NOT miss to implement this.
getTitle in interface Datatype<String>Datatype.toString()
public abstract boolean eval(double arg1,
double arg2)
Comparator for the given arguments.
arg1 - is the first argument.arg2 - is the second argument.
Comparator applied to the given
arguments.
private Object convert(Object object,
Class<?> otherType)
Calendar or XMLGregorianCalendar will be converted to
Date.
object - is the value to convert.otherType - the type of the value to compare that differs from the
type
value or the same
value if on simpler type is known.
private boolean evalComparable(Comparable arg1,
Comparable arg2)
eval(Object, Object) for two
Comparables.
arg1 - is the first argument.arg2 - is the second argument.
Comparator applied to the given
arguments.
public boolean eval(Object arg1,
Object arg2)
Comparator for the given arguments.
arg1 - is the first argument.arg2 - is the second argument.
Comparator applied to the given
arguments.public String toString()
Datatype.getTitle().
toString in interface Datatype<String>toString in class Enum<Comparator>public static Comparator fromValue(String value)
Comparator for the given symbol.
value - is the symbol of the requested
Comparator.
Comparator or null if no such
Comparator exists.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||