Package org.drools.base.time
Class Interval
- java.lang.Object
-
- org.drools.base.time.Interval
-
- All Implemented Interfaces:
java.lang.Cloneable
public class Interval extends java.lang.Object implements java.lang.CloneableA 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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Interval another)Calculates the path addition of this interval with another interval.Intervalclone()booleanequals(java.lang.Object obj)longgetLowerBound()longgetUpperBound()inthashCode()voidintersect(Interval another)Calculates the value of the intersection between this Interval and another interval.voidsetLowerBound(long lowerBound)voidsetUpperBound(long upperBound)java.lang.StringtoString()
-
-
-
Field Detail
-
MIN
public static final long MIN
- See Also:
- Constant Field Values
-
MAX
public static final long MAX
- See Also:
- Constant Field Values
-
-
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)
-
clone
public Interval clone()
- Overrides:
clonein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-