C
- Type of the items of the ranges.public class Endpoint<C extends Comparable> extends Object implements EndpointDescriptor, EndpointAccessor<Void,C>, Comparable<Endpoint<C>>, Serializable
Modifier and Type | Field and Description |
---|---|
protected com.google.common.collect.BoundType |
boundType |
static Comparator<Endpoint<Comparable>> |
CANONICAL_COMPARATOR
Canonical comparator for two end points.
|
protected EndpointDirection |
direction |
static Endpoint<?> |
NEGATIVE_INFINITY
Immutable singleton instance of the end point representing negative infinity.
|
protected C |
point |
static Endpoint<?> |
POSITIVE_INFINITY
Immutable singleton instance of the end point representing positive infinity.
|
Modifier | Constructor and Description |
---|---|
protected |
Endpoint(C point,
com.google.common.collect.BoundType boundType,
EndpointDirection direction) |
protected |
Endpoint(T item,
EndpointAccessor<T,C> endpoint) |
Modifier and Type | Method and Description |
---|---|
static <C extends Comparable> |
closed(C point,
EndpointDirection direction) |
static <C extends Comparable> |
compare(Endpoint<C> lhs,
Endpoint<C> rhs)
|
int |
compareTo(Endpoint<C> rhs) |
static <C extends Comparable> |
createComparator() |
static <C extends Comparable> |
createComparator(EndpointTypeComparator comparator) |
static <C extends Comparable> |
finite(C point,
com.google.common.collect.BoundType boundType,
EndpointDirection direction) |
com.google.common.collect.BoundType |
getBoundType() |
com.google.common.collect.BoundType |
getBoundType(Void item) |
EndpointDirection |
getDirection() |
EndpointDirection |
getDirection(Void item) |
C |
getPoint() |
C |
getPoint(Void item) |
boolean |
hasBound() |
boolean |
hasBound(Void item) |
static <C extends Comparable> |
infinite(EndpointDirection direction) |
static <C extends Comparable> |
lower(C point,
com.google.common.collect.BoundType boundType) |
static <C extends Comparable> |
lowerClosed(C point) |
static <C extends Comparable> |
lowerOpen(C point) |
static <C extends Comparable> |
negativeInfinity() |
static <C extends Comparable> |
of(C point,
EndpointDescriptor descriptor) |
static <T,C extends Comparable> |
of(T item,
EndpointAccessor<T,C> accessor) |
static <C extends Comparable> |
open(C point,
EndpointDirection direction) |
static <C extends Comparable> |
positiveInfinity() |
String |
toString() |
static <C extends Comparable> |
upper(C point,
com.google.common.collect.BoundType boundType) |
static <C extends Comparable> |
upperClosed(C point) |
static <C extends Comparable> |
upperOpen(C point) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isLowerPoint, isUpperPoint, toAcessor, toEndpoint
compareByEndpoint, compareByEndpoint, createByEndpointComparator, createByEndpointComparator, mapping, toDescriptor, toEndpoint
public static Comparator<Endpoint<Comparable>> CANONICAL_COMPARATOR
public static Endpoint<?> NEGATIVE_INFINITY
public static Endpoint<?> POSITIVE_INFINITY
protected final com.google.common.collect.BoundType boundType
protected final EndpointDirection direction
protected final C extends Comparable point
protected Endpoint(C point, com.google.common.collect.BoundType boundType, EndpointDirection direction)
protected Endpoint(T item, EndpointAccessor<T,C> endpoint)
public int compareTo(Endpoint<C> rhs)
compareTo
in interface Comparable<Endpoint<C extends Comparable>>
public com.google.common.collect.BoundType getBoundType()
getBoundType
in interface EndpointDescriptor
getBoundType
in interface EndpointType
public com.google.common.collect.BoundType getBoundType(Void item)
getBoundType
in interface EndpointAccessor<Void,C extends Comparable>
item
- An item with an endpoint to check.public EndpointDirection getDirection()
getDirection
in interface EndpointDescriptor
getDirection
in interface EndpointType
public EndpointDirection getDirection(Void item)
getDirection
in interface EndpointAccessor<Void,C extends Comparable>
item
- An item with an endpoint to check.public C getPoint()
IllegalStateException
- When hasBound()
returns false
.public C getPoint(Void item)
getPoint
in interface EndpointAccessor<Void,C extends Comparable>
item
- An item with an endpoint to process.public boolean hasBound()
hasBound
in interface EndpointDescriptor
public boolean hasBound(Void item)
hasBound
in interface EndpointAccessor<Void,C extends Comparable>
item
- An item with an endpoint to check.public static <C extends Comparable> Endpoint<C> closed(C point, EndpointDirection direction)
C
- Type of the end point object.point
- End point object.direction
- Whether to create a lower or upper end point.public static <C extends Comparable> int compare(Endpoint<C> lhs, Endpoint<C> rhs)
getPoint()
, if hasBound()
, then by the EndpointType
. Uses the
EndpointTypeComparators.UNORDERED
for comparing end point types.C
- Type of the end point object.lhs
- First end point to compare.rhs
- Second end point to compare.public static <C extends Comparable> Comparator<Endpoint<C>> createComparator()
C
- Type of the end point object.getPoint()
, if hasBound()
, then by the
EndpointType
. Uses the EndpointTypeComparators.CANONICAL
for comparing end point types.public static <C extends Comparable> Comparator<Endpoint<C>> createComparator(EndpointTypeComparator comparator)
C
- Type of the end point object.comparator
- Comparator for comparing end point types.getPoint()
, if hasBound()
, then by the
given end point comparator.public static <C extends Comparable> Endpoint<C> finite(C point, com.google.common.collect.BoundType boundType, EndpointDirection direction)
C
- Type of the end point object.point
- End point object.boundType
- Whether to create an open or closed end point.direction
- Whether to create a lower or upper end point.public static <C extends Comparable> Endpoint<C> infinite(EndpointDirection direction)
C
- Type of the end point object.direction
- Whether to create a lower or upper end point.public static <C extends Comparable> Endpoint<C> lower(C point, com.google.common.collect.BoundType boundType)
C
- Type of the end point object.point
- End point object.boundType
- Whether to create an open or closed end point.public static <C extends Comparable> Endpoint<C> lowerClosed(C point)
C
- Type of the end point object.point
- End point object.public static <C extends Comparable> Endpoint<C> lowerOpen(C point)
C
- Type of the end point object.point
- End point object.public static <C extends Comparable> Endpoint<C> negativeInfinity()
C
- Type of the end point object.public static <C extends Comparable> Endpoint<C> of(C point, EndpointDescriptor descriptor)
C
- Type of the end point object.point
- End point object.descriptor
- Meta data about the end point to create-public static <T,C extends Comparable> Endpoint<C> of(T item, EndpointAccessor<T,C> accessor)
T
- Type of the objects holding an end point.C
- Type of the end point object.item
- Object that holds an end point.accessor
- Accessor for accessing the end point on the given object.public static <C extends Comparable> Endpoint<C> open(C point, EndpointDirection direction)
C
- Type of the end point object.point
- End point object.direction
- Whether to create a lower or upper end point.public static <C extends Comparable> Endpoint<C> positiveInfinity()
C
- Type of the end point object.public static <C extends Comparable> Endpoint<C> upper(C point, com.google.common.collect.BoundType boundType)
C
- Type of the end point object.point
- End point object.boundType
- Whether to create an open or closed end poit.public static <C extends Comparable> Endpoint<C> upperClosed(C point)
C
- Type of the end point object.point
- End point object.public static <C extends Comparable> Endpoint<C> upperOpen(C point)
C
- Type of the end point object.point
- End point object.Copyright © 2021 XIMA MEDIA GmbH. All rights reserved.