/* Requires -- 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 requires which is a special form of a contract statement. */ public class Requires extends ContractStatement { private static final java.util.function.Predicate VALIDATOR = ACSLNode.VALIDATORS.get(Requires.class); /** * The formula of this requires. */ Expression formula; /** * The constructor taking initial values. * @param formula the formula of this requires. */ public Requires(Expression formula) { super(); this.formula = formula; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid Requires: " + this; } /** * Returns a textual description of this object. */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Requires").append('['); sb.append(formula); return sb.append(']').toString(); } /** * Gets the formula of this requires. * @return the formula of this requires. */ 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((ContractStatement)this)) { //visit parent types higher up if necessary } else { return; } if (visitor.visit(this)) { if(formula!=null){ formula.accept(visitor); } } } public ContractStatement accept(ACSLTransformer visitor) { ContractStatement node = visitor.transform(this); if(node != this){ return node; } Expression newformula = null; if(formula != null){ newformula = (Expression)formula.accept(visitor); } if(formula != newformula){ return new Requires(newformula); } return this; } }