Class VariableExpression
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.Expression
-
- net.ssehub.easy.instantiation.core.model.expressions.VariableExpression
-
- Direct Known Subclasses:
VariableEx
public class VariableExpression extends Expression
An expression denoting that a variable is used.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringqualifiedNameprivate VariableDeclarationvariable
-
Constructor Summary
Constructors Constructor Description VariableExpression()Constructor for serialization.VariableExpression(VariableDeclaration variable)Creates a variable expression node.VariableExpression(VariableDeclaration variable, java.lang.String qualifiedName)Creates a variable expression node.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectaccept(IExpressionVisitor visitor)Visits the expression.static java.lang.StringcomposeUnkownVariableWarning(java.lang.String name)Composes a warning message for a missing/unknown variable.VariableDeclarationgetDeclaration()Returns the variable declaration beyond this node.java.lang.StringgetName()Returns the name of the variable beyond this node.java.lang.StringgetQualifiedName()The qualified name in case that not the variable itself but a qualified access to the variable was used.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
getFormattingHint, replaceEmptyLine
-
-
-
-
Field Detail
-
variable
private VariableDeclaration variable
-
qualifiedName
private java.lang.String qualifiedName
-
-
Constructor Detail
-
VariableExpression
VariableExpression()
Constructor for serialization.
-
VariableExpression
public VariableExpression(VariableDeclaration variable)
Creates a variable expression node.- Parameters:
variable- the variable declaration used as variable here
-
VariableExpression
public VariableExpression(VariableDeclaration variable, java.lang.String qualifiedName)
Creates a variable expression node.- Parameters:
variable- the variable declaration used as variable herequalifiedName- in case that not the variable itself but a qualified access to the variable is used (may be null)
-
-
Method Detail
-
getQualifiedName
public java.lang.String getQualifiedName()
The qualified name in case that not the variable itself but a qualified access to the variable was used.- Returns:
- the qualified name, may be null
-
getName
public java.lang.String getName()
Returns the name of the variable beyond this node.- Returns:
- the name of the variable
-
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)
-
getDeclaration
public VariableDeclaration getDeclaration()
Returns the variable declaration beyond this node.- Returns:
- the variable declaration
-
composeUnkownVariableWarning
public static java.lang.String composeUnkownVariableWarning(java.lang.String name)
Composes a warning message for a missing/unknown variable.- Parameters:
name- the name of the variable- Returns:
- the warning message
-
-