Class Range


  • public class Range
    extends java.lang.Object
    Pair of values.

    Object can be treated as a sub-list of indices. One (low) value is less or equal than another (high) value.

    • Constructor Summary

      Constructors 
      Constructor Description
      Range​(int low, int high)
      Creates range with the specified low and high indices.
      Range​(IntegerRange integerRange)
      Constructs a copy of the specified range.
      Range​(ru.ispras.fortress.expression.Node low, ru.ispras.fortress.expression.Node high)
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Range deepCopy()
      Creates a deep copy of the current object.
      boolean equals​(java.lang.Object obj)  
      ru.ispras.fortress.expression.Node getHigh()
      Returns high index.
      ru.ispras.fortress.expression.Node getLow()
      Returns low index.
      java.util.Collection<ru.ispras.fortress.expression.NodeVariable> getVariables()
      Returns variables that are used in this object.
      int hashCode()  
      boolean isConstantRange()
      Checks whether this range has constant borders.
      boolean isIntegerRange()
      Checks whether this object is a range of integer values.
      IntegerRange toIntegerRange()
      Converts this object to integer range, if fails, returns null.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Range

        public Range​(ru.ispras.fortress.expression.Node low,
                     ru.ispras.fortress.expression.Node high)
        Default constructor.
        Parameters:
        low - low index
        high - high index
        Throws:
        java.lang.IllegalArgumentException - in the following situations: (1) when any of the arguments is null; (2) when the second argument is always less than first argument.
      • Range

        public Range​(int low,
                     int high)
        Creates range with the specified low and high indices.
        Parameters:
        low - The smaller (low) index value.
        high - The bigger (high) index value.
      • Range

        public Range​(IntegerRange integerRange)
        Constructs a copy of the specified range.
        Parameters:
        integerRange - The integer range.
    • Method Detail

      • deepCopy

        public Range deepCopy()
        Creates a deep copy of the current object.
        Returns:
        a full copy of the current object
      • getLow

        public ru.ispras.fortress.expression.Node getLow()
        Returns low index.
        Returns:
        low index
      • getHigh

        public ru.ispras.fortress.expression.Node getHigh()
        Returns high index.
        Returns:
        high index
      • getVariables

        public java.util.Collection<ru.ispras.fortress.expression.NodeVariable> getVariables()
        Returns variables that are used in this object.
        Returns:
        The collection of variables that are used in this object.
      • isConstantRange

        public boolean isConstantRange()
        Checks whether this range has constant borders.
        Returns:
        true when this range has constant borders, false otherwise.
      • isIntegerRange

        public boolean isIntegerRange()
        Checks whether this object is a range of integer values.
        Returns:
        true if this object is integer value range, false otherwise.
      • toIntegerRange

        public IntegerRange toIntegerRange()
        Converts this object to integer range, if fails, returns null.
        Returns:
        the identical integer range of null, if fails.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object