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 double
Constant representing positive infinity.protected double
Left bound of the interval.protected boolean
Flag indicating if the interval is closed from the left side.static double
Constant representing negative infinity.protected double
Right bound of the interval.protected boolean
Flag indicating if the interval is closed from the right side. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(double value) Checks whether the interval contains a given value.static Interval
create_geq
(double v) Factory method which creates a left-bounded interval in the form [v, +inf).static Interval
create_le
(double v) Factory method which creates a right-bounded interval in the form (-inf, v).boolean
Checks 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.double
getLeft()
Getsleft
double
getRight()
Getsright
int
hashCode()
Calculates hashcode of the value set.boolean
intersects
(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:
intersects
in interfaceIValueSet
- Parameters:
set
- Other value set.- Returns:
- Test result.
-
getIntersection
Gets intersection of the interval with another one.- Specified by:
getIntersection
in 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:
getDifference
in interfaceIValueSet
- Parameters:
set
- Other value set.- Returns:
- Difference of sets.
-
hashCode
public int hashCode()Calculates hashcode of the value set. -
getLeftSign
-
getRightSign
-