Class ValueAssignmentExpression
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.Expression
-
- net.ssehub.easy.instantiation.core.model.expressions.ValueAssignmentExpression
-
public class ValueAssignmentExpression extends Expression
Represents a value assignment.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private FieldDescriptorfieldprivate ExpressionvalueExpressionprivate VariableDeclarationvarDecl
-
Constructor Summary
Constructors Constructor Description ValueAssignmentExpression()Constructor for serialization.ValueAssignmentExpression(VariableDeclaration varDecl, Expression valueExpression)Creates a new value assignment expression which assignsvalueExpressiontovarDecl.ValueAssignmentExpression(VariableDeclaration varDecl, FieldDescriptor field, Expression valueExpression)Creates a new value assignment expression which assignsvalueExpressiontofieldinvarDecl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectaccept(IExpressionVisitor visitor)Visits the expression.FieldDescriptorgetField()The field to assign to.ExpressiongetValueExpression()Returns the value expression.VariableDeclarationgetVarDecl()Returns the variable declaration.TypeDescriptor<?>inferType()Infers the type of this expression including the type of the contained sub-expressions.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.Expression
replaceEmptyLine
-
-
-
-
Field Detail
-
varDecl
private VariableDeclaration varDecl
-
field
private FieldDescriptor field
-
valueExpression
private Expression valueExpression
-
-
Constructor Detail
-
ValueAssignmentExpression
ValueAssignmentExpression()
Constructor for serialization.
-
ValueAssignmentExpression
public ValueAssignmentExpression(VariableDeclaration varDecl, Expression valueExpression)
Creates a new value assignment expression which assignsvalueExpressiontovarDecl.- Parameters:
varDecl- the variable declarationvalueExpression- the value expression
-
ValueAssignmentExpression
public ValueAssignmentExpression(VariableDeclaration varDecl, FieldDescriptor field, Expression valueExpression)
Creates a new value assignment expression which assignsvalueExpressiontofieldinvarDecl.- Parameters:
varDecl- the variable declarationfield- the field declaration (optional, may be null)valueExpression- the value expression
-
-
Method Detail
-
getVarDecl
public VariableDeclaration getVarDecl()
Returns the variable declaration.- Returns:
- the variable declaration
-
getField
public FieldDescriptor getField()
The field to assign to.- Returns:
- the field (may be null)
-
getValueExpression
public Expression getValueExpression()
Returns the value expression.- Returns:
- the value expression
-
inferType
public TypeDescriptor<?> inferType() throws VilException
Description copied from class:ExpressionInfers the type of this expression including the type of the contained sub-expressions.- Specified by:
inferTypein classExpression- Returns:
- the type of this expression
- Throws:
VilException- in case that inferring the type fails
-
accept
public java.lang.Object accept(IExpressionVisitor visitor) throws VilException
Description copied from class:ExpressionVisits the expression.- Specified by:
acceptin classExpression- Parameters:
visitor- the visitor- Returns:
- the result of visiting this expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
-