java.lang.Object
adaa.analytics.rules.logic.representation.valueset.Interval
All Implemented Interfaces:
IValueSet, Serializable

public class Interval extends Object implements IValueSet, Serializable
Represents continuous interval.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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
    Constructor
    Description
    Creates an unbounded interval (-inf,+inf).
    Interval(double left, double right, boolean leftClosed, boolean rightClosed)
    Initializes all members.
    Interval(double value, String relation)
    Creates a half-bounded interval using value and relation in a text form.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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.
    Get difference between the value set and another one.
    Gets intersection of the interval with another one.
    double
    Gets left
     
    double
    Gets right
     
    int
    Calculates hashcode of the value set.
    boolean
    Checks if the interval intersects with another one.
    Converts the value set to a string.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • MINUS_INF

      public static double MINUS_INF
      Constant representing negative infinity.
    • INF

      public static double INF
      Constant representing positive infinity.
    • left

      protected double left
      Left bound of the interval.
    • leftClosed

      protected boolean leftClosed
      Flag indicating if the interval is closed from the left side.
    • rightClosed

      protected boolean rightClosed
      Flag 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

      public Interval(double value, String relation)
      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()
      Gets left
    • getRight

      public double getRight()
      Gets right
    • create_le

      public static Interval create_le(double v)
      Factory method which creates a right-bounded interval in the form (-inf, v).
      Parameters:
      v - Right interval side.
      Returns:
      Created interval.
    • create_geq

      public static Interval create_geq(double v)
      Factory method which creates a left-bounded interval in the form [v, +inf).
      Parameters:
      v - Left interval side.
      Returns:
      Created interval.
    • equals

      public boolean equals(Object obj)
      Checks if the value set equals to another one.
      Specified by:
      equals in interface IValueSet
      Overrides:
      equals in class Object
      Parameters:
      obj - Reference object.
      Returns:
      Test result.
    • 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 (see MissingValuesHandler).
      Specified by:
      contains in interface IValueSet
      Parameters:
      value - Value to be checked.
      Returns:
      Test result.
    • intersects

      public boolean intersects(IValueSet set)
      Checks if the interval intersects with another one.
      Specified by:
      intersects in interface IValueSet
      Parameters:
      set - Other value set.
      Returns:
      Test result.
    • getIntersection

      public IValueSet getIntersection(IValueSet set)
      Gets intersection of the interval with another one.
      Specified by:
      getIntersection in interface IValueSet
      Parameters:
      set - Other value set.
      Returns:
      Intersection of sets.
    • toString

      public String toString()
      Converts the value set to a string.
      Specified by:
      toString in interface IValueSet
      Overrides:
      toString in class Object
      Returns:
      Text representation of the value set.
    • getDifference

      public List<IValueSet> getDifference(IValueSet set)
      Get difference between the value set and another one.
      Specified by:
      getDifference in interface IValueSet
      Parameters:
      set - Other value set.
      Returns:
      Difference of sets.
    • hashCode

      public int hashCode()
      Calculates hashcode of the value set.
      Specified by:
      hashCode in interface IValueSet
      Overrides:
      hashCode in class Object
      Returns:
      Hashcode.
    • getLeftSign

      public String getLeftSign()
    • getRightSign

      public String getRightSign()