Class RangedVariable

  • All Implemented Interfaces:
    UseDef

    public class RangedVariable
    extends java.lang.Object
    implements UseDef
    Variable or it's sub-part restricted by the specified range and indices.

    When range or indices are not null it means that not all variable is in use but only it's sub-part.

    • Constructor Summary

      Constructors 
      Constructor Description
      RangedVariable​(ru.ispras.fortress.expression.NodeVariable variable)
      Constructs object with the specified variable.
      RangedVariable​(ru.ispras.fortress.expression.NodeVariable variable, java.util.List<ru.ispras.fortress.expression.Node> indices)
      Creates object with the specified variable and it's range.
      RangedVariable​(ru.ispras.fortress.expression.NodeVariable variable, Range range)
      Constructs object with the specified variable and it's range.
      RangedVariable​(ru.ispras.fortress.expression.NodeVariable var, Range range, java.util.List<ru.ispras.fortress.expression.Node> indices)
      Creates object with the specified parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addIndex​(ru.ispras.fortress.expression.Node index)
      Add the specified node as index for this object.
      RangedVariable deepCopy()
      Creates a deep copy of the current object.
      boolean equals​(java.lang.Object obj)  
      java.util.Set<ru.ispras.fortress.expression.NodeVariable> getDefines()
      Returns a set of defined variables.
      java.util.List<ru.ispras.fortress.expression.Node> getIndices()
      Returns the sequence of object's indices.
      IntegerRange getIntegerRange()
      Returns the integer range of this object.
      java.lang.String getName()
      Returns string form of the ranged variable that can be used as name.
      Range getRange()
      Returns range.
      java.util.Set<ru.ispras.fortress.expression.NodeVariable> getUses()
      Returns a set of used variables.
      ru.ispras.fortress.expression.NodeVariable getVariable()
      Returns variable.
      java.lang.String getVariableName()
      Returns variable name.
      int hashCode()  
      boolean indexed()
      Checks whether this object has indices.
      boolean ranged()
      Checks whether this object has sub-range.
      void setIndices​(java.util.List<ru.ispras.fortress.expression.Node> indices)
      Sets new sequence on indices.
      void setRange​(Range range)
      Sets new range.
      void setRange​(ru.ispras.fortress.expression.Node low, ru.ispras.fortress.expression.Node high)
      Sets new range from the pair of the specified nodes.
      ru.ispras.fortress.expression.Node toNode()
      Returns the syntax node that is equivalent to this object.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • RangedVariable

        public RangedVariable​(ru.ispras.fortress.expression.NodeVariable variable)
        Constructs object with the specified variable.
        Parameters:
        variable - The target variable.
        Throws:
        java.lang.IllegalArgumentException - when argument is null.
      • RangedVariable

        public RangedVariable​(ru.ispras.fortress.expression.NodeVariable variable,
                              Range range)
        Constructs object with the specified variable and it's range.

        The ranged variable MUST have either bit vector data type or map data type.

        Parameters:
        variable - The target variable.
        range - The variable's sub-range.
        Throws:
        java.lang.IllegalArgumentException - when any of the arguments is null;
      • RangedVariable

        public RangedVariable​(ru.ispras.fortress.expression.NodeVariable variable,
                              java.util.List<ru.ispras.fortress.expression.Node> indices)
        Creates object with the specified variable and it's range.

        The indexed variable MUST be of map data type.

        Parameters:
        variable - The target variable.
        indices - The list of indices describing the variable's element.
        Throws:
        java.lang.IllegalArgumentException - when any of the arguments is null;
      • RangedVariable

        public RangedVariable​(ru.ispras.fortress.expression.NodeVariable var,
                              Range range,
                              java.util.List<ru.ispras.fortress.expression.Node> indices)
        Creates object with the specified parameters.
        Parameters:
        var - The target variable.
        range - The variable sub-range (for bit-vectors and bit-vector arrays).
        indices - The variable element indices (for arrays).
    • Method Detail

      • deepCopy

        public RangedVariable deepCopy()
        Creates a deep copy of the current object.
        Returns:
        Deep copy of this object.
      • getVariable

        public ru.ispras.fortress.expression.NodeVariable getVariable()
        Returns variable.
        Returns:
        Variable.
      • getVariableName

        public java.lang.String getVariableName()
        Returns variable name.
        Returns:
        Variable name.
      • getName

        public java.lang.String getName()
        Returns string form of the ranged variable that can be used as name.
        Returns:
        The string name of the object.
      • getRange

        public Range getRange()
        Returns range.
        Returns:
        Range.
      • getIntegerRange

        public IntegerRange getIntegerRange()
        Returns the integer range of this object.
        Returns:
        The integer range of this object.
      • getIndices

        public java.util.List<ru.ispras.fortress.expression.Node> getIndices()
        Returns the sequence of object's indices.
        Returns:
        The sequence of object's indices.
      • setRange

        public void setRange​(Range range)
        Sets new range.
        Parameters:
        range - Range to be set.
        Throws:
        java.lang.IllegalArgumentException - when argument is null;
      • setRange

        public void setRange​(ru.ispras.fortress.expression.Node low,
                             ru.ispras.fortress.expression.Node high)
        Sets new range from the pair of the specified nodes.
        Parameters:
        low - The low border node.
        high - The high border node.
      • setIndices

        public void setIndices​(java.util.List<ru.ispras.fortress.expression.Node> indices)
        Sets new sequence on indices.
        Parameters:
        indices - The sequence of indices.
        Throws:
        java.lang.IllegalArgumentException - in the following situations: (1) when any argument is null; (2) when this object's variable is not of DataMap data types;
      • addIndex

        public void addIndex​(ru.ispras.fortress.expression.Node index)
        Add the specified node as index for this object.
        Parameters:
        index - The index.
        Throws:
        java.lang.IllegalArgumentException - in the following situations: (1) when any argument is null; (2) when this object's variable is not of DataMap data types;
      • ranged

        public boolean ranged()
        Checks whether this object has sub-range.
        Returns:
        true if this contains non-null range, false otherwise.
      • indexed

        public boolean indexed()
        Checks whether this object has indices.
        Returns:
        true if this object has indices, false otherwise.
      • toNode

        public ru.ispras.fortress.expression.Node toNode()
        Returns the syntax node that is equivalent to this object.
        Returns:
        The node formula for this object.
      • 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
      • getUses

        public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getUses()
        Description copied from interface: UseDef
        Returns a set of used variables.
        Specified by:
        getUses in interface UseDef
        Returns:
        Variables that are used in this object.
      • getDefines

        public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getDefines()
        Description copied from interface: UseDef
        Returns a set of defined variables.
        Specified by:
        getDefines in interface UseDef
        Returns:
        Variables that are defined in this object.