Package de.xima.fc.utils.range
Enum EndpointTypeComparators
- java.lang.Object
-
- java.lang.Enum<EndpointTypeComparators>
-
- de.xima.fc.utils.range.EndpointTypeComparators
-
- All Implemented Interfaces:
EndpointTypeComparator
,Serializable
,Comparable<EndpointTypeComparators>
public enum EndpointTypeComparators extends Enum<EndpointTypeComparators> implements EndpointTypeComparator
An enumeration with implementations ofEndpointTypeComparator
.- Since:
- 6.5.0
- Author:
- XIMA MEDIA GmbH
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CANONICAL
Default comparator that compares end point types in the following order)[](
.CANONICAL_INVERTED
Comparator that compares end point types in the opposite orderCANONICAL
, that is(][)
.END_START
Comparator that sort end points before start points, that is)][(
.START_END
Comparator that sort start points before end points, that is[()]
.UNORDERED
Comparator that treats all end point types as equal.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(EndpointDirection lhsDirection, com.google.common.collect.BoundType lhsBoundType, EndpointDirection rhsDirection, com.google.common.collect.BoundType rhsBoundType)
Compares two end points.static EndpointTypeComparator
createComparator(EndpointTypes... order)
Creates a new end point comparator that compares end points in the given order.static EndpointTypeComparators
valueOf(String name)
Returns the enum constant of this type with the specified name.static EndpointTypeComparators[]
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, toString, valueOf
-
Methods inherited from interface de.xima.fc.utils.range.EndpointTypeComparator
compare
-
-
-
-
Enum Constant Detail
-
CANONICAL
public static final EndpointTypeComparators CANONICAL
Default comparator that compares end point types in the following order)[](
.
-
CANONICAL_INVERTED
public static final EndpointTypeComparators CANONICAL_INVERTED
Comparator that compares end point types in the opposite orderCANONICAL
, that is(][)
.
-
END_START
public static final EndpointTypeComparators END_START
Comparator that sort end points before start points, that is)][(
.
-
START_END
public static final EndpointTypeComparators START_END
Comparator that sort start points before end points, that is[()]
.
-
UNORDERED
public static final EndpointTypeComparators UNORDERED
Comparator that treats all end point types as equal.
-
-
Method Detail
-
values
public static EndpointTypeComparators[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (EndpointTypeComparators c : EndpointTypeComparators.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static EndpointTypeComparators valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
compare
public int compare(EndpointDirection lhsDirection, com.google.common.collect.BoundType lhsBoundType, EndpointDirection rhsDirection, com.google.common.collect.BoundType rhsBoundType)
Description copied from interface:EndpointTypeComparator
Compares two end points.- Specified by:
compare
in interfaceEndpointTypeComparator
- Parameters:
lhsDirection
- The direction of the first end point.lhsBoundType
- The bound type of the first end point.rhsDirection
- The direction of the second end point.rhsBoundType
- The bound type of the second end point.- Returns:
-1
if the first end point is less than the second end point,0
if both end points are equals, or+1
otherwise.
-
createComparator
public static EndpointTypeComparator createComparator(EndpointTypes... order)
Creates a new end point comparator that compares end points in the given order.- Parameters:
order
- Target order of the end points.- Returns:
- A comparator for end points that compares in the given order.
-
-