Package it.unive.lisa.symbolic.value
Class TernaryExpression
- java.lang.Object
-
- it.unive.lisa.symbolic.SymbolicExpression
-
- it.unive.lisa.symbolic.value.ValueExpression
-
- it.unive.lisa.symbolic.value.TernaryExpression
-
public class TernaryExpression extends ValueExpression
A bynary expression that applies aTernaryExpressionto threeSymbolicExpressions.
-
-
Constructor Summary
Constructors Constructor Description TernaryExpression(ExternalSet<Type> types, SymbolicExpression left, SymbolicExpression middle, SymbolicExpression right, TernaryOperator operator, CodeLocation location)Builds the binary expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(ExpressionVisitor<T> visitor, java.lang.Object... params)Accepts anExpressionVisitor, visiting this expression recursively.booleanequals(java.lang.Object obj)SymbolicExpressiongetLeft()Yields the left-hand side operand of this expression.SymbolicExpressiongetMiddle()Yields the middle operand of this expression.TernaryOperatorgetOperator()SymbolicExpressiongetRight()Yields the right-hand side operand of this expression.inthashCode()SymbolicExpressionpopScope(ScopeToken token)Pops the scope identified by the given token from the expression.SymbolicExpressionpushScope(ScopeToken token)Pushes a new scope, identified by the give token, in the expression.java.lang.StringtoString()-
Methods inherited from class it.unive.lisa.symbolic.value.ValueExpression
removeNegations
-
Methods inherited from class it.unive.lisa.symbolic.SymbolicExpression
getCodeLocation, getDynamicType, getTypes
-
-
-
-
Constructor Detail
-
TernaryExpression
public TernaryExpression(ExternalSet<Type> types, SymbolicExpression left, SymbolicExpression middle, SymbolicExpression right, TernaryOperator operator, CodeLocation location)
Builds the binary expression.- Parameters:
types- the runtime types of this expressionleft- the left-hand side operand of this expressionmiddle- the middle operand of this expressionright- the right-hand side operand of this expressionoperator- the operator to applylocation- the code location of the statement that has generated this expression
-
-
Method Detail
-
getLeft
public SymbolicExpression getLeft()
Yields the left-hand side operand of this expression.- Returns:
- the left operand
-
getMiddle
public SymbolicExpression getMiddle()
Yields the middle operand of this expression.- Returns:
- the middle operand
-
getRight
public SymbolicExpression getRight()
Yields the right-hand side operand of this expression.- Returns:
- the right operand
-
getOperator
public TernaryOperator getOperator()
- Returns:
- the operator to apply
-
pushScope
public SymbolicExpression pushScope(ScopeToken token) throws SemanticException
Description copied from class:SymbolicExpressionPushes a new scope, identified by the give token, in the expression. This causes allVariables to becomeOutOfScopeIdentifiers associated with the given token.- Specified by:
pushScopein classSymbolicExpression- Parameters:
token- the token identifying the scope to push- Returns:
- a copy of this expression where the local variables have gone out of scope
- Throws:
SemanticException- if an error occurs during the computation
-
popScope
public SymbolicExpression popScope(ScopeToken token) throws SemanticException
Description copied from class:SymbolicExpressionPops the scope identified by the given token from the expression. This causes all the invisible variables (i.e.OutOfScopeIdentifiers) mapped to the given scope to become visible (i.e.Variables) again.- Specified by:
popScopein classSymbolicExpression- Parameters:
token- the token of the scope to be restored- Returns:
- a copy of this expression where the local variables associated with the given scope are visible again
- Throws:
SemanticException- if an error occurs during the computation
-
hashCode
public int hashCode()
- Overrides:
hashCodein classSymbolicExpression
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classSymbolicExpression
-
toString
public java.lang.String toString()
- Specified by:
toStringin classSymbolicExpression
-
accept
public <T> T accept(ExpressionVisitor<T> visitor, java.lang.Object... params) throws SemanticException
Description copied from class:SymbolicExpressionAccepts anExpressionVisitor, visiting this expression recursively.- Specified by:
acceptin classSymbolicExpression- Type Parameters:
T- the type of value produced by the visiting callbacks- Parameters:
visitor- the visitorparams- additional optional parameters to pass to each visiting callback- Returns:
- the value produced by the visiting operation
- Throws:
SemanticException- if an error occurs during the visiting
-
-