Class Interval
java.lang.Object
adaa.analytics.rules.logic.representation.valueset.Interval
- All Implemented Interfaces:
IValueSet,Serializable
Represents continuous interval.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic doubleConstant representing positive infinity.protected doubleLeft bound of the interval.protected booleanFlag indicating if the interval is closed from the left side.static doubleConstant representing negative infinity.protected doubleRight bound of the interval.protected booleanFlag indicating if the interval is closed from the right side. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(double value) Checks whether the interval contains a given value.static Intervalcreate_geq(double v) Factory method which creates a left-bounded interval in the form [v, +inf).static Intervalcreate_le(double v) Factory method which creates a right-bounded interval in the form (-inf, v).booleanChecks if the value set equals to another one.getDifference(IValueSet set) Get difference between the value set and another one.getIntersection(IValueSet set) Gets intersection of the interval with another one.doublegetLeft()GetsleftdoublegetRight()GetsrightinthashCode()Calculates hashcode of the value set.booleanintersects(IValueSet set) Checks if the interval intersects with another one.toString()Converts the value set to a string.
-
Field Details
-
MINUS_INF
public static double MINUS_INFConstant representing negative infinity. -
INF
public static double INFConstant representing positive infinity. -
left
protected double leftLeft bound of the interval. -
right
protected double rightRight bound of the interval. -
leftClosed
protected boolean leftClosedFlag indicating if the interval is closed from the left side. -
rightClosed
protected boolean rightClosedFlag indicating if the interval is closed from the right side.
-
-
Constructor Details
-
Interval
public Interval()Creates an unbounded interval (-inf,+inf). -
Interval
public Interval(double left, double right, boolean leftClosed, boolean rightClosed) Initializes all members.- Parameters:
left- Left side.right- Right side.leftClosed- Flag indicating if interval is left-closed.rightClosed- Flag indicating if interval is right-closed.
-
Interval
Creates a half-bounded interval using value and relation in a text form.- Parameters:
value- Interval bound.relation- One of the following: "<", ">", "<=", ">=".
-
-
Method Details
-
getLeft
public double getLeft()Getsleft -
getRight
public double getRight()Getsright -
create_le
Factory method which creates a right-bounded interval in the form (-inf, v).- Parameters:
v- Right interval side.- Returns:
- Created interval.
-
create_geq
Factory method which creates a left-bounded interval in the form [v, +inf).- Parameters:
v- Left interval side.- Returns:
- Created interval.
-
equals
Checks if the value set equals to another one. -
contains
public boolean contains(double value) Checks whether the interval contains a given value. If the value is missing (NaN), the behaviour depends on the missing value policy (seeMissingValuesHandler). -
intersects
Checks if the interval intersects with another one.- Specified by:
intersectsin interfaceIValueSet- Parameters:
set- Other value set.- Returns:
- Test result.
-
getIntersection
Gets intersection of the interval with another one.- Specified by:
getIntersectionin interfaceIValueSet- Parameters:
set- Other value set.- Returns:
- Intersection of sets.
-
toString
Converts the value set to a string. -
getDifference
Get difference between the value set and another one.- Specified by:
getDifferencein interfaceIValueSet- Parameters:
set- Other value set.- Returns:
- Difference of sets.
-
hashCode
public int hashCode()Calculates hashcode of the value set. -
getLeftSign
-
getRightSign
-