Package it.unive.lisa.symbolic.value
Class Identifier
- java.lang.Object
-
- it.unive.lisa.symbolic.SymbolicExpression
-
- it.unive.lisa.symbolic.value.ValueExpression
-
- it.unive.lisa.symbolic.value.Identifier
-
- Direct Known Subclasses:
HeapLocation,MemoryPointer,OutOfScopeIdentifier,Variable
public abstract class Identifier extends ValueExpression
An identifier of a program variable, representing either a program variable (as an instance ofVariable), or a resolved memory location (as an instance ofHeapLocation).
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedIdentifier(ExternalSet<Type> types, java.lang.String name, boolean weak, Annotations annotations, CodeLocation location)Builds the identifier.protectedIdentifier(ExternalSet<Type> types, java.lang.String name, boolean weak, CodeLocation location)Builds the identifier.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(Annotation ann)Adds an annotation to the annotations of this identifier.booleanequals(java.lang.Object obj)AnnotationsgetAnnotations()Yields the annotations of this identifier.java.lang.StringgetName()Yields the name of this identifier.inthashCode()booleanisWeak()Yields whether or not this identifier is weak.Identifierlub(Identifier other)Yields the least upper bounds between two identifiers.-
Methods inherited from class it.unive.lisa.symbolic.value.ValueExpression
removeNegations
-
Methods inherited from class it.unive.lisa.symbolic.SymbolicExpression
accept, getCodeLocation, getDynamicType, getTypes, popScope, pushScope, toString
-
-
-
-
Constructor Detail
-
Identifier
protected Identifier(ExternalSet<Type> types, java.lang.String name, boolean weak, CodeLocation location)
Builds the identifier.- Parameters:
types- the runtime types of this expressionname- the name of the identifierweak- whether or not this identifier is weak, meaning that it should only receive weak assignmentslocation- the code location of the statement that has generated this identifier
-
Identifier
protected Identifier(ExternalSet<Type> types, java.lang.String name, boolean weak, Annotations annotations, CodeLocation location)
Builds the identifier.- Parameters:
types- the runtime types of this expressionname- the name of the identifierweak- whether or not this identifier is weak, meaning that it should only receive weak assignmentsannotations- the annotations of this identifierlocation- the code location of the statement that has generated this identifier
-
-
Method Detail
-
getName
public java.lang.String getName()
Yields the name of this identifier.- Returns:
- the name
-
isWeak
public boolean isWeak()
Yields whether or not this identifier is weak. Weak identifiers should only receive weak assignments, that is, the value of the identifier after the assignment should be the least upper bound between its old value and the fresh value being assigned. With strong identifiers instead, the new value corresponds to the freshly provided value.- Returns:
trueif this identifier is weak,falseotherwise
-
hashCode
public int hashCode()
- Overrides:
hashCodein classSymbolicExpression
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classSymbolicExpression
-
getAnnotations
public Annotations getAnnotations()
Yields the annotations of this identifier.- Returns:
- the annotations of this identifier
-
addAnnotation
public void addAnnotation(Annotation ann)
Adds an annotation to the annotations of this identifier.- Parameters:
ann- the annotation to be added
-
lub
public Identifier lub(Identifier other) throws SemanticException
Yields the least upper bounds between two identifiers.- Parameters:
other- the other identifier- Returns:
- the least upper bounds between two identifiers.
- Throws:
SemanticException- if this and other are not equal.
-
-