/* Decreases -- 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 decreases which is a special form of a contract statement. */ public class Decreases extends ContractStatement { private static final java.util.function.Predicate VALIDATOR = ACSLNode.VALIDATORS.get(Decreases.class); /** * The formula of this decreases. */ Expression formula; /** * The identifier of this decreases. */ String identifier; /** * The constructor taking initial values. * @param formula the formula of this decreases. */ public Decreases(Expression formula) { super(); this.formula = formula; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid Decreases: " + this; } /** * The constructor taking initial values. * @param formula the formula of this decreases. * @param identifier the identifier of this decreases. */ public Decreases(Expression formula, String identifier) { super(); this.formula = formula; this.identifier = identifier; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid Decreases: " + this; } /** * Returns a textual description of this object. */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Decreases").append('['); sb.append(formula); sb.append(',').append(identifier); return sb.append(']').toString(); } /** * Gets the formula of this decreases. * @return the formula of this decreases. */ public Expression getFormula() { return formula; } /** * Gets the identifier of this decreases. * @return the identifier of this decreases. */ public String getIdentifier() { return identifier; } 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 Decreases(newformula, identifier); } return this; } }