Class HxInterval

java.lang.Object
com.hexaly.optimizer.HxInterval

public class HxInterval extends Object
Value type for interval expressions. Such value is obtained with HxExpression.getIntervalValue() or HxSolution.getIntervalValue(com.hexaly.optimizer.HxExpression).
Since:
12.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor of HxInterval.
    HxInterval(long value)
    Constructor of HxInterval.
    HxInterval(long start, long end)
    Constructor of HxInterval.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(long value)
    Returns true if the interval contains the given value, false otherwise.
    long
    Returns the number of elements in the interval.
    boolean
     
    long
    Returns the end of the interval.
    long
    Returns the start of the interval.
    int
     
    boolean
    Returns true if the interval is degenerate.
    boolean
    Returns true if the interval is present (non-void).
    boolean
    Returns true if the interval is void.
    Returns an iterator for the content of this interval.
    Returns a string representation of the interval.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • HxInterval

      public HxInterval()
      Constructor of HxInterval. Returns a void interval.
    • HxInterval

      public HxInterval(long value)
      Constructor of HxInterval. Returns a degenerate interval of value ``[value, value)``.
      Parameters:
      value - Start and end of the interval.
    • HxInterval

      public HxInterval(long start, long end)
      Constructor of HxInterval. Returns an interval of value ``[start, end)``. End must be greater (or equal) than start.
      Parameters:
      start - Start of the interval.
      end - End of the interval.
  • Method Details

    • isPresent

      public boolean isPresent()
      Returns true if the interval is present (non-void). A void interval is an empty interval with no valid start or end bounds.
      Returns:
      True if the interval is present.
    • isVoid

      public boolean isVoid()
      Returns true if the interval is void. A void interval is an empty interval with no valid start or end bounds.
      Returns:
      True if the interval is void.
    • isDegenerate

      public boolean isDegenerate()
      Returns true if the interval is degenerate. A degenerate interval is an interval with equal start and end bounds. It does not contain any element however.
      Returns:
      True if the interval is degenerate.
    • getStart

      public long getStart()
      Returns the start of the interval. Cannot be called on a void interval as it does not have a valid start.
      Returns:
      Start of the interval.
    • getEnd

      public long getEnd()
      Returns the end of the interval. Cannot be called on a void interval as it does not have a valid end.
      Returns:
      End of the interval.
    • count

      public long count()
      Returns the number of elements in the interval. A void or degenerate interval does not contain any element.
      Returns:
      Number of elements in the interval.
    • contains

      public boolean contains(long value)
      Returns true if the interval contains the given value, false otherwise.
      Parameters:
      value - Element whose presence in this interval is to be tested.
      Returns:
      True if the interval contains the value
    • toString

      public String toString()
      Returns a string representation of the interval.
      Overrides:
      toString in class Object
      Returns:
      String representation.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • iterator

      public Iterator<Long> iterator()
      Returns an iterator for the content of this interval.
      Returns:
      Read-only iterator for the content of this interval.