Package gw.lang.reflect.interval
Class AbstractInterval<E extends java.lang.Comparable<E>,ME extends AbstractInterval<E,ME>>
- java.lang.Object
-
- gw.lang.reflect.interval.AbstractInterval<E,ME>
-
- All Implemented Interfaces:
IInterval<E,ME>
- Direct Known Subclasses:
ComparableInterval,IterableInterval
public abstract class AbstractInterval<E extends java.lang.Comparable<E>,ME extends AbstractInterval<E,ME>> extends java.lang.Object implements IInterval<E,ME>
-
-
Field Summary
Fields Modifier and Type Field Description private boolean_bLeftClosedprivate boolean_bReverseprivate boolean_bRightClosedprivate E_leftprivate E_right
-
Constructor Summary
Constructors Constructor Description AbstractInterval(E left, E right)AbstractInterval(E left, E right, boolean bLeftClosed, boolean bRightClosed, boolean bReverse)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckArgs(E left, E right)booleancontains(E e)booleancontains(ME interval)booleanequals(java.lang.Object o)EgetLeftEndpoint()EgetRightEndpoint()inthashCode()booleanisLeftClosed()booleanisReverse()booleanisRightClosed()java.lang.StringtoString()
-
-
-
Method Detail
-
getLeftEndpoint
public E getLeftEndpoint()
- Specified by:
getLeftEndpointin interfaceIInterval<E extends java.lang.Comparable<E>,ME extends AbstractInterval<E,ME>>- Returns:
- The left endpoint of this interval where the left <= right
-
getRightEndpoint
public E getRightEndpoint()
- Specified by:
getRightEndpointin interfaceIInterval<E extends java.lang.Comparable<E>,ME extends AbstractInterval<E,ME>>- Returns:
- The right endpoint of this interval where the left <= right
-
isLeftClosed
public boolean isLeftClosed()
- Specified by:
isLeftClosedin interfaceIInterval<E extends java.lang.Comparable<E>,ME extends AbstractInterval<E,ME>>- Returns:
- True if this interval includes the left endpoint. E.g., x >= foo indicates a left-closed interval starting with and including foo. Conversely, x > foo is said to be left-open because the interface starts with, but excludes foo i.e., there is no minimum value defined in the interval, rather the interval is open with foo as the limit of minimum values.
-
isRightClosed
public boolean isRightClosed()
- Specified by:
isRightClosedin interfaceIInterval<E extends java.lang.Comparable<E>,ME extends AbstractInterval<E,ME>>- Returns:
- True if this interval includes the right endpoint. E.g., x <= foo indicates a right-closed interval ending with and including foo. Conversely, x < foo is said to be right-open because the interface ends with, but excludes foo i.e., there is no maximum value defined in the interval, rather the interval is open with foo as the limit of maximum values.
-
contains
public boolean contains(E e)
-
contains
public boolean contains(ME interval)
-
isReverse
public boolean isReverse()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-