/* ModelVariable -- 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; /** * ModelVariable (//@model int x...) * TODO: Somehow wired these variables. */ public class ModelVariable extends ACSLNode { private static final java.util.function.Predicate VALIDATOR = ACSLNode.VALIDATORS.get(ModelVariable.class); /** * The type of this model variable. */ ACSLType type; /** * The parameter of this model variable. */ Parameter parameter; /** * The constructor taking initial values. * @param type the type of this model variable. */ public ModelVariable(ACSLType type) { super(); this.type = type; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid ModelVariable: " + this; } /** * The constructor taking initial values. * @param type the type of this model variable. * @param parameter the parameter of this model variable. */ public ModelVariable(ACSLType type, Parameter parameter) { super(); this.type = type; this.parameter = parameter; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid ModelVariable: " + this; } /** * Returns a textual description of this object. */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("ModelVariable").append('['); sb.append(type); sb.append(',').append(parameter); return sb.append(']').toString(); } /** * Gets the type of this model variable. * @return the type of this model variable. */ public ACSLType getType() { return type; } /** * Gets the parameter of this model variable. * @return the parameter of this model variable. */ public Parameter getParameter() { return parameter; } public List getOutgoingNodes() { List children = super.getOutgoingNodes(); children.add(type); children.add(parameter); return children; } public void accept(ACSLVisitor visitor) { if (visitor.visit(this)) { if(type!=null){ type.accept(visitor); } if(parameter!=null){ parameter.accept(visitor); } } } public ModelVariable accept(ACSLTransformer visitor) { ModelVariable node = visitor.transform(this); if(node != this){ return node; } ACSLType newtype = null; if(type != null){ newtype = (ACSLType)type.accept(visitor); } Parameter newparameter = null; if(parameter != null){ newparameter = (Parameter)parameter.accept(visitor); } if(type != newtype || parameter != newparameter){ return new ModelVariable(newtype, newparameter); } return this; } }