Package ru.ispras.castle.ast
Class Assignment<TagT extends java.lang.Enum<TagT>>
- java.lang.Object
-
- ru.ispras.castle.ast.basis.SyntaxNode<TagT>
-
- ru.ispras.castle.ast.Assignment<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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ru.ispras.castle.ast.basis.SyntaxNode
SyntaxNode.Kind
-
-
Constructor Summary
Constructors Constructor Description Assignment(java.lang.Class<TagT> tagType, TagT tag)
Constructs an assignment node.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.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Assignment<TagT>
clone()
boolean
equals(java.lang.Object obj)
java.util.Set<ru.ispras.fortress.expression.NodeVariable>
getDefines()
Returns a set of defined variables.RangedVariable
getLeft()
Returns defined ranged variable.ru.ispras.fortress.expression.Node
getRight()
Returns value expression.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.java.util.Set<java.lang.String>
getUsedVariableNames()
Returns names of variables that are used in this object.java.util.Set<ru.ispras.fortress.expression.NodeVariable>
getUses()
Returns a set of used variables.ru.ispras.fortress.expression.NodeVariable
getVariable()
Returns defined variable.int
hashCode()
boolean
isInitialized()
Checks rather all the object's fields are notnull
.boolean
ranged()
Checks rather this object contains a defining to ranged variable.void
setRight(ru.ispras.fortress.expression.Node right)
Sets new value expression.void
setVariable(RangedVariable variable)
Sets the specified variable as objects' target.java.lang.String
toString()
-
Methods inherited from class ru.ispras.castle.ast.basis.SyntaxNode
add, containsAttribute, find, findRecursively, getAttribute, getChildren, getChildren, getKind, getName, getParent, getTag, getTagType, hasName, hasScope, setAttribute, setAttributes, setName, setParent, setRedefinitionHandler
-
-
-
-
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 variableright
- used expression- Throws:
java.lang.IllegalArgumentException
- when any of arguments isnull
.
-
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 variableexpr
- used expression- Throws:
java.lang.IllegalArgumentException
- when any of arguments isnull
.
-
-
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 isnull
.
-
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 isnull
.
-
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 printerseparator
- assignment separator between defined and used variables- Returns:
- description
- Throws:
java.lang.IllegalArgumentException
- when any of the arguments isnull
.
-
isInitialized
public boolean isInitialized()
Checks rather all the object's fields are notnull
.- Returns:
true
when all the object's fields are notnull
,false
otherwise
-
getUses
public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getUses()
Description copied from interface:UseDef
Returns a set of used variables.
-
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 interfaceUseDef
- Returns:
- Variables that are defined in this object.
-
clone
public Assignment<TagT> clone()
- Overrides:
clone
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-