/* SyntacticNamingExpression -- Automatically generated by TreeBuilder (2024-10-27T16:47Z) */ package de.uni_freiburg.informatik.ultimate.model.acsl.ast; import java.util.List; import de.uni_freiburg.informatik.ultimate.model.acsl.ACSLNode; /** * Represents a syntactic naming expression which is a special form of a expression. */ public class SyntacticNamingExpression extends Expression { private static final java.util.function.Predicate VALIDATOR = ACSLNode.VALIDATORS.get(SyntacticNamingExpression.class); /** * special contruct is used in assumes clauses. */ String identifier; /** * The formula of this syntactic naming expression. */ Expression formula; /** * The constructor taking initial values. * @param identifier special contruct is used in assumes clauses. * @param formula the formula of this syntactic naming expression. */ public SyntacticNamingExpression(String identifier, Expression formula) { super(); this.identifier = identifier; this.formula = formula; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid SyntacticNamingExpression: " + this; } /** * The constructor taking initial values. * @param type the type of this expression. * @param identifier special contruct is used in assumes clauses. * @param formula the formula of this syntactic naming expression. */ public SyntacticNamingExpression(ACSLType type, String identifier, Expression formula) { super(type); this.identifier = identifier; this.formula = formula; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid SyntacticNamingExpression: " + this; } /** * Returns a textual description of this object. */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("SyntacticNamingExpression").append('['); sb.append(identifier); sb.append(',').append(formula); return sb.append(']').toString(); } /** * Gets special contruct is used in assumes clauses. * @return special contruct is used in assumes clauses. */ public String getIdentifier() { return identifier; } /** * Gets the formula of this syntactic naming expression. * @return the formula of this syntactic naming expression. */ public Expression getFormula() { return formula; } public List getOutgoingNodes() { List children = super.getOutgoingNodes(); children.add(formula); return children; } public void accept(ACSLVisitor visitor) { if (visitor.visit((Expression)this)) { //visit parent types higher up if necessary } else { return; } if (visitor.visit(this)) { if(formula!=null){ formula.accept(visitor); } if(type!=null){ type.accept(visitor); } } } public Expression accept(ACSLTransformer visitor) { Expression node = visitor.transform(this); if(node != this){ return node; } Expression newformula = null; if(formula != null){ newformula = (Expression)formula.accept(visitor); } ACSLType newtype = null; if(type != null){ newtype = (ACSLType)type.accept(visitor); } if(formula != newformula || type != newtype){ return new SyntacticNamingExpression(newtype, identifier, newformula); } return this; } }