Package org.drools.base.time
Class Interval
java.lang.Object
org.drools.base.time.Interval
- All Implemented Interfaces:
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalculates the path addition of this interval with another interval.clone()booleanlonglonginthashCode()voidCalculates the value of the intersection between this Interval and another interval.voidsetLowerBound(long lowerBound) voidsetUpperBound(long upperBound) toString()
-
Field Details
-
MIN
public static final long MIN- See Also:
-
MAX
public static final long MAX- See Also:
-
-
Constructor Details
-
Interval
public Interval() -
Interval
public Interval(long lowerBound, long upperBound)
-
-
Method Details
-
intersect
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
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) -
clone
-
toString
-
hashCode
public int hashCode() -
equals
-