Class Endpoint<C extends Comparable>

    • Field Detail

      • NEGATIVE_INFINITY

        public static final Endpoint<?> NEGATIVE_INFINITY
        Immutable singleton instance of the end point representing negative infinity.
      • POSITIVE_INFINITY

        public static final Endpoint<?> POSITIVE_INFINITY
        Immutable singleton instance of the end point representing positive infinity.
      • boundType

        protected final com.google.common.collect.BoundType boundType
    • Constructor Detail

      • Endpoint

        protected Endpoint​(C point,
                           com.google.common.collect.BoundType boundType,
                           EndpointDirection direction)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getBoundType

        public com.google.common.collect.BoundType getBoundType​(Void item)
        Specified by:
        getBoundType in interface EndpointAccessor<Void,​C extends Comparable>
        Parameters:
        item - An item with an endpoint to check.
        Returns:
        Whether the endpoint describes by the given item is closed or open.
      • getPoint

        public C getPoint​(Void item)
        Specified by:
        getPoint in interface EndpointAccessor<Void,​C extends Comparable>
        Parameters:
        item - An item with an endpoint to process.
        Returns:
        The endpoint described by the given item.
      • hasBound

        public boolean hasBound()
        Specified by:
        hasBound in interface EndpointDescriptor
        Returns:
        Whether this end point has a bound with an associated point object, or is unbounded (negative or positive infinity).
      • hasBound

        public boolean hasBound​(Void item)
        Specified by:
        hasBound in interface EndpointAccessor<Void,​C extends Comparable>
        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).
      • closed

        public static <C extends ComparableEndpoint<C> closed​(C point,
                                                                EndpointDirection direction)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        point - End point object.
        direction - Whether to create a lower or upper end point.
        Returns:
        A closed end point for the given parameters.
      • createComparator

        public static <C extends ComparableComparator<Endpoint<C>> createComparator​(EndpointTypeComparator comparator)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        comparator - Comparator for comparing end point types.
        Returns:
        A comparator for end points. Compares first by getPoint(), if hasBound(), then by the given end point comparator.
      • finite

        public static <C extends ComparableEndpoint<C> finite​(C point,
                                                                com.google.common.collect.BoundType boundType,
                                                                EndpointDirection direction)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        point - End point object.
        boundType - Whether to create an open or closed end point.
        direction - Whether to create a lower or upper end point.
        Returns:
        A finite end point for the given parameters.
      • infinite

        public static <C extends ComparableEndpoint<C> infinite​(EndpointDirection direction)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        direction - Whether to create a lower or upper end point.
        Returns:
        A infinite end point with the given parameters.
      • lower

        public static <C extends ComparableEndpoint<C> lower​(C point,
                                                               com.google.common.collect.BoundType boundType)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        point - End point object.
        boundType - Whether to create an open or closed end point.
        Returns:
        A lower end point for the given parameters.
      • lowerClosed

        public static <C extends ComparableEndpoint<C> lowerClosed​(C point)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        point - End point object.
        Returns:
        A lower closed end point for the given parameters.
      • lowerOpen

        public static <C extends ComparableEndpoint<C> lowerOpen​(C point)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        point - End point object.
        Returns:
        A lower open end point for the given parameters.
      • negativeInfinity

        public static <C extends ComparableEndpoint<C> negativeInfinity()
        Type Parameters:
        C - Type of the end point object.
        Returns:
        An end point describing positive infinity.
      • of

        public static <C extends ComparableEndpoint<C> of​(C point,
                                                            EndpointDescriptor descriptor)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        point - End point object.
        descriptor - Meta data about the end point to create-
        Returns:
        An end point for the given parameters.
      • of

        public static <T,​C extends ComparableEndpoint<C> of​(T item,
                                                                    EndpointAccessor<T,​C> accessor)
        Type Parameters:
        T - Type of the objects holding an end point.
        C - Type of the end point object.
        Parameters:
        item - Object that holds an end point.
        accessor - Accessor for accessing the end point on the given object.
        Returns:
        An end point for the given parameters.
      • open

        public static <C extends ComparableEndpoint<C> open​(C point,
                                                              EndpointDirection direction)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        point - End point object.
        direction - Whether to create a lower or upper end point.
        Returns:
        An open end point for the given parameters.
      • positiveInfinity

        public static <C extends ComparableEndpoint<C> positiveInfinity()
        Type Parameters:
        C - Type of the end point object.
        Returns:
        An end point describing positive infinity.
      • upper

        public static <C extends ComparableEndpoint<C> upper​(C point,
                                                               com.google.common.collect.BoundType boundType)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        point - End point object.
        boundType - Whether to create an open or closed end poit.
        Returns:
        An upper end point for the given parameters.
      • upperClosed

        public static <C extends ComparableEndpoint<C> upperClosed​(C point)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        point - End point object.
        Returns:
        An upper closed end point for the given parameters.
      • upperOpen

        public static <C extends ComparableEndpoint<C> upperOpen​(C point)
        Type Parameters:
        C - Type of the end point object.
        Parameters:
        point - End point object.
        Returns:
        An upper open end point for the given parameters.