/* GlobalGhostDeclaration -- 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 global ghost declaration which is a special form of a code statement. */ public class GlobalGhostDeclaration extends CodeStatement { private static final java.util.function.Predicate VALIDATOR = ACSLNode.VALIDATORS.get(GlobalGhostDeclaration.class); /** * The type of this global ghost declaration. */ ACSLType type; /** * The identifier of this global ghost declaration. */ String identifier; /** * The expr of this global ghost declaration. */ Expression expr; /** * The constructor taking initial values. * @param type the type of this global ghost declaration. * @param identifier the identifier of this global ghost declaration. * @param expr the expr of this global ghost declaration. */ public GlobalGhostDeclaration(ACSLType type, String identifier, Expression expr) { super(); this.type = type; this.identifier = identifier; this.expr = expr; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid GlobalGhostDeclaration: " + this; } /** * Returns a textual description of this object. */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("GlobalGhostDeclaration").append('['); sb.append(type); sb.append(',').append(identifier); sb.append(',').append(expr); return sb.append(']').toString(); } /** * Gets the type of this global ghost declaration. * @return the type of this global ghost declaration. */ public ACSLType getType() { return type; } /** * Gets the identifier of this global ghost declaration. * @return the identifier of this global ghost declaration. */ public String getIdentifier() { return identifier; } /** * Gets the expr of this global ghost declaration. * @return the expr of this global ghost declaration. */ public Expression getExpr() { return expr; } public List getOutgoingNodes() { List children = super.getOutgoingNodes(); children.add(type); children.add(expr); return children; } public void accept(ACSLVisitor visitor) { if (visitor.visit((CodeStatement)this)) { //visit parent types higher up if necessary } else { return; } if (visitor.visit(this)) { if(type!=null){ type.accept(visitor); } if(expr!=null){ expr.accept(visitor); } } } public CodeStatement accept(ACSLTransformer visitor) { CodeStatement node = visitor.transform(this); if(node != this){ return node; } ACSLType newtype = null; if(type != null){ newtype = (ACSLType)type.accept(visitor); } Expression newexpr = null; if(expr != null){ newexpr = (Expression)expr.accept(visitor); } if(type != newtype || expr != newexpr){ return new GlobalGhostDeclaration(newtype, identifier, newexpr); } return this; } }