Class DiscreteInterval<T extends java.lang.Number,​U extends DiscreteInterval<T,​U>>

  • Type Parameters:
    T - kind of numbers
    U - kind of interval of numbers
    Direct Known Subclasses:
    FloatingPointInterval, IntegerInterval

    public abstract class DiscreteInterval<T extends java.lang.Number,​U extends DiscreteInterval<T,​U>>
    extends java.lang.Object

    Title: Discrete Interval

    Description: An abstract base class interval representation of discrete value spaces. Instances are immutable.

    Copyright: Copyright (c) 2009

    Company: Clark & Parsia, LLC.

    Author:
    Mike Smith
    • Constructor Detail

      • DiscreteInterval

        public DiscreteInterval​(T point)
        Create a point interval. This is equivalent to DiscreteInterval(T, T) with arguments point,point
        Parameters:
        point - Value of point interval
      • DiscreteInterval

        public DiscreteInterval​(T lower,
                                T upper)
        Create an interval.
        Parameters:
        lower - Interval _lower bound
        upper - Interval _upper bound
    • Method Detail

      • canUnionWith

        public boolean canUnionWith​(U other)
      • contains

        public boolean contains​(T n)
      • equals

        public abstract boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getLower

        public T getLower()
      • getUpper

        public T getUpper()
      • greater

        public U greater​(T n)
        Get the subinterval greater than n
        Parameters:
        n -
        Returns:
        a new interval, formed by intersecting this interval with (n,+inf) or null if that intersection is empty
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • intersection

        public U intersection​(U that)
      • isFinite

        public boolean isFinite()
      • less

        public U less​(T n)
        Get the subinterval less than n
        Parameters:
        n -
        Returns:
        a new interval, formed by intersecting this interval with (-inf,n) or null if that intersection is empty
      • remove

        public java.util.List<U> remove​(U other)
      • size

        public abstract java.lang.Number size()
      • union

        public java.util.List<U> union​(U other)
      • valueIterator

        public java.util.Iterator<T> valueIterator()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object