Package de.xima.fc.utils.range
Interface EndpointAccessor<T,C extends Comparable>
- Type Parameters:
T- Type of the object that contains or holds an endpoint.C- Type of the endpoint of the range, i.e.Range.lowerEndpoint()orRange.upperEndpoint().
- All Known Implementing Classes:
Endpoint,EndpointAccessorsIdentity,EndpointAccessorsRange
public interface EndpointAccessor<T,C extends Comparable>
Interface for a handler that allows accessing a
Range endpoint of some object.- Since:
- 6.5.0
- Author:
- XIMA MEDIA GmbH
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault intcompareByEndpoint(T lhs, T rhs) Compares the given items by the end points they hold.default intcompareByEndpoint(T lhs, T rhs, EndpointTypeComparator comparator) Compares the given items by the end points they hold.default Comparator<T>default Comparator<T>createByEndpointComparator(EndpointTypeComparator comparator) com.google.common.collect.BoundTypegetBoundType(T item) getDirection(T item) booleandefault <R extends Comparable>
EndpointAccessor<T,R> default EndpointDescriptortoDescriptor(T item) Creates an endpoint descriptor describing the endpoint of held by the given item.toEndpoint(T item)
-
Method Details
-
compareByEndpoint
Compares the given items by the end points they hold. The default comparatorEndpointTypeComparators.UNORDEREDfor endpoints is used.- Parameters:
lhs- First item with an end point to compare.rhs- Second item with an end point to compare.- Returns:
-1if the first item is less than the second,0if both are equal, or+1otherwise.
-
compareByEndpoint
Compares the given items by the end points they hold.- Parameters:
lhs- First item with an end point to compare.rhs- Second item with an end point to compare.comparator- The comparator to use for comparing the end points.- Returns:
-1if the first item is less than the second,0if both are equal, or+1otherwise.
-
createByEndpointComparator
- Returns:
- A comparator for the items holding an endpoint, that compares the items the endpoint they hold. The
default comparator
EndpointTypeComparators.UNORDEREDfor endpoints is used.
-
createByEndpointComparator
- Parameters:
comparator- Comparator to use for comparing the endpoints.- Returns:
- A comparator for the items holding an endpoint, that compares the items the endpoint they hold.
-
getBoundType
- Parameters:
item- An item with an endpoint to check.- Returns:
- Whether the endpoint describes by the given item is closed or open.
-
getDirection
- Parameters:
item- An item with an endpoint to check.- Returns:
- Whether the end point described by the given item is a lower or upper end point.
-
getPoint
- Parameters:
item- An item with an endpoint to process.- Returns:
- The endpoint described by the given item.
-
hasBound
- Parameters:
item- An item with an endpoint to check.- Returns:
- Whether the range defined by the item has a bound (or describes positive or negative infinity).
-
mapping
- Type Parameters:
R- Type of the mapped point.- Parameters:
mapper- Mapping function that converts thegetPoint(Object)to another object.- Returns:
- A new endpoint accessor with the same
getBoundType(Object)andgetDirection(Object), but with thegetPoint(Object)mapped via the given mapping function.
-
toDescriptor
Creates an endpoint descriptor describing the endpoint of held by the given item.- Parameters:
item- An item holding an endpoint.- Returns:
- An endpoint descriptor for the endpoint of the given item.
-
toEndpoint
- Parameters:
item- An item holding an endpoint.- Returns:
- The endpoint held by the given item.
-