Package it.unive.lisa.program.cfg
Class Parameter
- java.lang.Object
-
- it.unive.lisa.program.cfg.Parameter
-
- All Implemented Interfaces:
CodeElement
public class Parameter extends java.lang.Object implements CodeElement
A CFG parameter identified by its name and its type, containing the information about the source file, line and column where the parameter is defined. No information about the CFG where the parameter appears is contained.
-
-
Constructor Summary
Constructors Constructor Description Parameter(CodeLocation location, java.lang.String name)
Builds an untyped parameter reference, identified by its name.Parameter(CodeLocation location, java.lang.String name, Expression defaultValue)
Builds the parameter reference, identified by its name and its type, happening at the given location in the program.Parameter(CodeLocation location, java.lang.String name, Type staticType)
Builds the parameter reference, identified by its name and its type, happening at the given location in the program.Parameter(CodeLocation location, java.lang.String name, Type staticType, Expression defaultValue, Annotations annotations)
Builds the parameter reference, identified by its name and its type, happening at the given location in the program.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnnotation(Annotation ann)
Adds an annotations to this parameter.boolean
equals(java.lang.Object obj)
Annotations
getAnnotations()
Yields the annotations of this parameter.Expression
getDefaultValue()
Yields the default value for this parameter that can be used when a call does not specify a value for it.CodeLocation
getLocation()
Yields the location where this code element appears in the program.java.lang.String
getName()
Yields the name of this parameter.Type
getStaticType()
Yields the static type of this parameter.int
hashCode()
java.lang.String
toString()
Variable
toSymbolicVariable()
Creates aVariable
that represent this parameter, that can be used bySemanticDomain
s to reference this parameter.
-
-
-
Constructor Detail
-
Parameter
public Parameter(CodeLocation location, java.lang.String name)
Builds an untyped parameter reference, identified by its name. The type of this parameter is unknown (i.e. it is {#link Untyped#INSTANCE}).- Parameters:
location
- the location of this parametername
- the name of this parameter
-
Parameter
public Parameter(CodeLocation location, java.lang.String name, Type staticType)
Builds the parameter reference, identified by its name and its type, happening at the given location in the program.- Parameters:
location
- the location where this parameter is defined within the programname
- the name of this parameterstaticType
- the type of this parameter. If unknown, useUntyped.INSTANCE
-
Parameter
public Parameter(CodeLocation location, java.lang.String name, Expression defaultValue)
Builds the parameter reference, identified by its name and its type, happening at the given location in the program.- Parameters:
location
- the location where this parameter is defined within the programname
- the name of this parameterdefaultValue
- the default value for this parameter that can be used when a call does not specify a value for it
-
Parameter
public Parameter(CodeLocation location, java.lang.String name, Type staticType, Expression defaultValue, Annotations annotations)
Builds the parameter reference, identified by its name and its type, happening at the given location in the program.- Parameters:
location
- the location where this parameter is defined within the programname
- the name of this parameterstaticType
- the type of this parameter. If unknown, useUntyped.INSTANCE
defaultValue
- the default value for this parameter that can be used when a call does not specify a value for itannotations
- the annotations of this parameter
-
-
Method Detail
-
getName
public java.lang.String getName()
Yields the name of this parameter.- Returns:
- the name of this parameter
-
getStaticType
public Type getStaticType()
Yields the static type of this parameter.- Returns:
- the static type of this parameter
-
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
-
getLocation
public CodeLocation getLocation()
Description copied from interface:CodeElement
Yields the location where this code element appears in the program.- Specified by:
getLocation
in interfaceCodeElement
- Returns:
- the location where this code element appears in the program
-
getAnnotations
public Annotations getAnnotations()
Yields the annotations of this parameter.- Returns:
- the annotations of this parameter
-
addAnnotation
public void addAnnotation(Annotation ann)
Adds an annotations to this parameter.- Parameters:
ann
- the annotation to be added
-
getDefaultValue
public Expression getDefaultValue()
Yields the default value for this parameter that can be used when a call does not specify a value for it.- Returns:
- the default value
-
toSymbolicVariable
public Variable toSymbolicVariable()
Creates aVariable
that represent this parameter, that can be used bySemanticDomain
s to reference this parameter.- Returns:
- the variable representing this parameter
-
-