Class Interval

  • All Implemented Interfaces:
    Cloneable

    public class Interval
    extends Object
    implements Cloneable
    A class to represent a time interval. Specially useful to calculate time distance between events constrained by temporal constraints. If the interval is open, i.e., from -infinitum to +infinitum, the representation is created by using lowerBound = Long.MIN_VALUE and upperBound = Long.MAX_VALUE.
    • Constructor Detail

      • Interval

        public Interval()
      • Interval

        public Interval​(long lowerBound,
                        long upperBound)
    • Method Detail

      • intersect

        public void intersect​(Interval another)
        Calculates the value of the intersection between this Interval and another interval. This is given by the following rule: lowerBound = max( this.lowerBound, another.lowerBound ) upperBound = min( this.upperBound, another.upperBound )
        Parameters:
        another - the other interval to calculate the intersection with.
      • add

        public void add​(Interval another)
        Calculates the path addition of this interval with another interval. This is given by the following rule: lowerBound = ( this.lowerBound == MIN || another.lowerBound == MIN ) ? MIN : this.lowerBound+another.lowerBound; upperBound = ( this.upperBound == MAX || another.upperBound == MAX ) ? MAX : this.upperBound+another.upperBound;
        Parameters:
        another - the other interval to add into this interval
      • getLowerBound

        public long getLowerBound()
      • setLowerBound

        public void setLowerBound​(long lowerBound)
      • getUpperBound

        public long getUpperBound()
      • setUpperBound

        public void setUpperBound​(long upperBound)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object