Enum Class RangeType
- All Implemented Interfaces:
Serializable,Comparable<RangeType>,Constable
Defines how the bounds of ranges in a
RangeStructure are handled. Ranges in a
RangeStructure are defined by only one value. The RangeType specifies whether
this value is the upper or lower bound of the range. Ranges may thus be boundless/infinite.
Example: In a LOWER_BOUND_EQUAL RangeStructure by calling
put(10, value1) and put(25, value2), two ranges are defined: [10..24]
and [25..infinity]. When using UPPER_BOUND_EQUAL, however, the same calls
define the ranges [-infinity..10] and [11..25].
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDeprecated.Indicates that the keys are meant to be the lower bound of a range including the lower bound.Deprecated.Because using this type in aRangeStructureresults in asymmetrical behavior of theAbstractMapStructure.put(Object, SearchStructure)andRangeStructure.get(Object)methods.Indicates that the keys are meant to be the upper bound of a range including the upper bound. -
Method Summary
Modifier and TypeMethodDescriptionabstract <K extends Comparable<? super K>,V>
Optional<V>Retrieves the matching value from the given map using the given key.abstract <K extends Comparable<? super K>,V>
VRetrieves the matching value from the given map using the given key.static RangeTypeReturns the enum constant of this class with the specified name.static RangeType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
LOWER_BOUND
Deprecated.Because using this type in aRangeStructureresults in asymmetrical behavior of theAbstractMapStructure.put(Object, SearchStructure)andRangeStructure.get(Object)methods. A value that was added by callingput(10, value)can not be retrieved by callingget(10).Indicates that the keys are meant to be the lower bound of a range (not included). -
LOWER_BOUND_EQUAL
Indicates that the keys are meant to be the lower bound of a range including the lower bound. -
UPPER_BOUND
Deprecated.Because using this type in aRangeStructureresults in asymmetrical behavior of theAbstractMapStructure.put(Object, SearchStructure)andRangeStructure.get(Object)methods. A value that was added by callingput(10, value)can not be retrieved by callingget(10).Indicates that the keys are meant to be the upper bound of a range (not included). -
UPPER_BOUND_EQUAL
Indicates that the keys are meant to be the upper bound of a range including the upper bound.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
getValue
Retrieves the matching value from the given map using the given key. The strategy used to retrieve the value depends on the type of key. It differs in how the bounds of ranges are processed.- Returns:
- the matching value in the given
TreeMapornullif no matching value could be found.
-
findValue
public abstract <K extends Comparable<? super K>,V> Optional<V> findValue(TreeMap<K, V> tree, K key) Retrieves the matching value from the given map using the given key. The strategy used to retrieve the value depends on the type of key. It differs in how the bounds of ranges are processed.- Returns:
- the matching value in the given
TreeMapor anempty Optionalif no matching value could be found.
-
RangeStructureresults in asymmetrical behavior of theAbstractMapStructure.put(Object, SearchStructure)andRangeStructure.get(Object)methods.