Class Assignment<TagT extends java.lang.Enum<TagT>>

  • All Implemented Interfaces:
    java.lang.Cloneable, UseDef

    public final class Assignment<TagT extends java.lang.Enum<TagT>>
    extends SyntaxNode<TagT>
    implements UseDef
    Assignment statement.

    Consists of defined RangedVariable target variable and used value expression.

    See Also:
    RangedVariable
    • Constructor Detail

      • Assignment

        public Assignment​(java.lang.Class<TagT> tagType,
                          TagT tag)
        Constructs an assignment node.
        Parameters:
        tagType - the enumeration type representing node tags.
        tag - the node tag.
      • Assignment

        public Assignment​(java.lang.Class<TagT> tagType,
                          TagT tag,
                          RangedVariable left,
                          ru.ispras.fortress.expression.Node right)
        Constructs object with the specified target variable and value expression.
        Parameters:
        tagType - the enumeration type representing node tags.
        tag - the node tag.
        left - defined variable
        right - used expression
        Throws:
        java.lang.IllegalArgumentException - when any of arguments is null.
      • Assignment

        public Assignment​(java.lang.Class<TagT> tagType,
                          TagT tag,
                          ru.ispras.fortress.expression.NodeVariable var,
                          ru.ispras.fortress.expression.Node expr)
        Constructs object with the specified target non-ranged variable and value expression.
        Parameters:
        tagType - the enumeration type representing node tags.
        tag - the node tag.
        var - defined variable
        expr - used expression
        Throws:
        java.lang.IllegalArgumentException - when any of arguments is null.
    • Method Detail

      • getLeft

        public RangedVariable getLeft()
        Returns defined ranged variable.
        Returns:
        ranged variable
      • getVariable

        public ru.ispras.fortress.expression.NodeVariable getVariable()
        Returns defined variable.
        Returns:
        variable
      • ranged

        public boolean ranged()
        Checks rather this object contains a defining to ranged variable.
        Returns:
        true if this object defines ranged variable, false otherwise
      • setVariable

        public void setVariable​(RangedVariable variable)
        Sets the specified variable as objects' target.
        Parameters:
        variable - new target variable
        Throws:
        java.lang.IllegalArgumentException - when argument is null.
      • getRight

        public ru.ispras.fortress.expression.Node getRight()
        Returns value expression.
        Returns:
        used expression
      • setRight

        public void setRight​(ru.ispras.fortress.expression.Node right)
        Sets new value expression.
        Parameters:
        right - new value expression
        Throws:
        java.lang.IllegalArgumentException - when argument is null.
      • getUsedVariableNames

        public java.util.Set<java.lang.String> getUsedVariableNames()
        Returns names of variables that are used in this object.
        Returns:
        set of used variables' names.
      • getSeparatedDescription

        public java.lang.String getSeparatedDescription​(ru.ispras.fortress.expression.printer.ExprTreePrinter printer,
                                                        java.lang.String separator)
        Returns this assignment description that is presented in format of the specified printer with the specified separator.
        Parameters:
        printer - expression printer
        separator - assignment separator between defined and used variables
        Returns:
        description
        Throws:
        java.lang.IllegalArgumentException - when any of the arguments is null.
      • isInitialized

        public boolean isInitialized()
        Checks rather all the object's fields are not null.
        Returns:
        true when all the object's fields are not null, false otherwise
      • 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.
      • clone

        public Assignment<TagT> clone()
        Overrides:
        clone in class java.lang.Object
      • hashCode

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

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

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