T
- Type of the object that contains or holds an endpoint.C
- Type of the endpoint of the range, i.e. Range.lowerEndpoint()
or Range.upperEndpoint()
.public interface EndpointAccessor<T,C extends Comparable>
Range
endpoint of some object.EndpointAccessorsIdentity
,
EndpointAccessorsRange
Modifier and Type | Method and Description |
---|---|
default int |
compareByEndpoint(T lhs,
T rhs)
Compares the given items by the end points they hold.
|
default int |
compareByEndpoint(T lhs,
T rhs,
EndpointTypeComparator comparator)
Compares the given items by the end points they hold.
|
default Comparator<T> |
createByEndpointComparator() |
default Comparator<T> |
createByEndpointComparator(EndpointTypeComparator comparator) |
com.google.common.collect.BoundType |
getBoundType(T item) |
EndpointDirection |
getDirection(T item) |
C |
getPoint(T item) |
boolean |
hasBound(T item) |
default <R extends Comparable> |
mapping(Function<C,R> mapper) |
default EndpointDescriptor |
toDescriptor(T item)
Creates an endpoint descriptor describing the endpoint of held by the given item.
|
default Endpoint<C> |
toEndpoint(T item) |
default int compareByEndpoint(T lhs, T rhs)
EndpointTypeComparators.UNORDERED
for endpoints is used.lhs
- First item with an end point to compare.rhs
- Second item with an end point to compare.-1
if the first item is less than the second, 0
if both are equal, or +1
otherwise.default int compareByEndpoint(T lhs, T rhs, EndpointTypeComparator comparator)
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.-1
if the first item is less than the second, 0
if both are equal, or +1
otherwise.default Comparator<T> createByEndpointComparator()
EndpointTypeComparators.UNORDERED
for endpoints is used.default Comparator<T> createByEndpointComparator(EndpointTypeComparator comparator)
comparator
- Comparator to use for comparing the endpoints.com.google.common.collect.BoundType getBoundType(T item)
item
- An item with an endpoint to check.EndpointDirection getDirection(T item)
item
- An item with an endpoint to check.C getPoint(T item)
item
- An item with an endpoint to process.boolean hasBound(T item)
item
- An item with an endpoint to check.default <R extends Comparable> EndpointAccessor<T,R> mapping(Function<C,R> mapper)
R
- Type of the mapped point.mapper
- Mapping function that converts the getPoint(Object)
to another object.getBoundType(Object)
and getDirection(Object)
,
but with the getPoint(Object)
mapped via the given mapping function.default EndpointDescriptor toDescriptor(T item)
item
- An item holding an endpoint.Copyright © 2020 XIMA MEDIA GmbH. All rights reserved.