/* ValidExpression -- 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 valid expression which is a special form of a expression. */ public class ValidExpression extends Expression { private static final java.util.function.Predicate VALIDATOR = ACSLNode.VALIDATORS.get(ValidExpression.class); /** * is used to check if a pointer location is safe, so the formula should be a * Pointer (UnaryExpression with star) or this makes no sense. */ Expression formula; /** * The constructor taking initial values. * @param formula is used to check if a pointer location is safe, so the formula should be a * Pointer (UnaryExpression with star) or this makes no sense. */ public ValidExpression(Expression formula) { super(); this.formula = formula; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid ValidExpression: " + this; } /** * The constructor taking initial values. * @param type the type of this expression. * @param formula is used to check if a pointer location is safe, so the formula should be a * Pointer (UnaryExpression with star) or this makes no sense. */ public ValidExpression(ACSLType type, Expression formula) { super(type); this.formula = formula; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid ValidExpression: " + this; } /** * Returns a textual description of this object. */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("ValidExpression").append('['); sb.append(formula); return sb.append(']').toString(); } /** * Gets is used to check if a pointer location is safe, so the formula should be a * Pointer (UnaryExpression with star) or this makes no sense. * @return is used to check if a pointer location is safe, so the formula should be a * Pointer (UnaryExpression with star) or this makes no sense. */ 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 ValidExpression(newtype, newformula); } return this; } }