/* Axiomatic -- Automatically generated by TreeBuilder (2024-10-27T16:47Z) */ package de.uni_freiburg.informatik.ultimate.model.acsl.ast; import java.util.List; import java.util.Arrays; import java.util.ArrayList; import de.uni_freiburg.informatik.ultimate.model.acsl.ACSLNode; /** * Represents a axiomatic which is a special form of a logic statement. */ public class Axiomatic extends LogicStatement { private static final java.util.function.Predicate VALIDATOR = ACSLNode.VALIDATORS.get(Axiomatic.class); /** * The logic stmts of this axiomatic. */ LogicStatement[] logicStmts; /** * The constructor taking initial values. * @param polyId the poly id of this logic statement. * @param logicStmts the logic stmts of this axiomatic. */ public Axiomatic(PolyIdentifier polyId, LogicStatement[] logicStmts) { super(polyId); this.logicStmts = logicStmts; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid Axiomatic: " + this; } /** * The constructor taking initial values. * @param polyId the poly id of this logic statement. * @param parameters the parameters of this logic statement. * @param logicStmts the logic stmts of this axiomatic. */ public Axiomatic(PolyIdentifier polyId, Parameter[] parameters, LogicStatement[] logicStmts) { super(polyId, parameters); this.logicStmts = logicStmts; assert VALIDATOR == null || VALIDATOR.test(this) : "Invalid Axiomatic: " + this; } /** * Returns a textual description of this object. */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Axiomatic").append('['); if (logicStmts == null) { sb.append("null"); } else { sb.append('['); for(int i1 = 0; i1 < logicStmts.length; i1++) { if (i1 > 0) sb.append(','); sb.append(logicStmts[i1]); } sb.append(']'); } return sb.append(']').toString(); } /** * Gets the logic stmts of this axiomatic. * @return the logic stmts of this axiomatic. */ public LogicStatement[] getLogicStmts() { return logicStmts; } public List getOutgoingNodes() { List children = super.getOutgoingNodes(); if(logicStmts!=null){ children.addAll(Arrays.asList(logicStmts)); } return children; } public void accept(ACSLVisitor visitor) { if (visitor.visit((LogicStatement)this)) { //visit parent types higher up if necessary } else { return; } if (visitor.visit(this)) { if(logicStmts!=null){ for (LogicStatement elem : logicStmts) { elem.accept(visitor); } } if(polyId!=null){ polyId.accept(visitor); } if(parameters!=null){ for (Parameter elem : parameters) { elem.accept(visitor); } } } } public LogicStatement accept(ACSLTransformer visitor) { LogicStatement node = visitor.transform(this); if(node != this){ return node; } boolean isChanged=false; ArrayList tmpListnewlogicStmts = new ArrayList<>(); if(logicStmts != null){ for(LogicStatement elem : logicStmts){ LogicStatement newlogicStmts = (LogicStatement)elem.accept(visitor); isChanged = isChanged || newlogicStmts != elem; tmpListnewlogicStmts.add(newlogicStmts); } } PolyIdentifier newpolyId = null; if(polyId != null){ newpolyId = (PolyIdentifier)polyId.accept(visitor); } ArrayList tmpListnewparameters = new ArrayList<>(); if(parameters != null){ for(Parameter elem : parameters){ Parameter newparameters = (Parameter)elem.accept(visitor); isChanged = isChanged || newparameters != elem; tmpListnewparameters.add(newparameters); } } if(isChanged || polyId != newpolyId){ return new Axiomatic(newpolyId, tmpListnewparameters.toArray(new Parameter[0]), tmpListnewlogicStmts.toArray(new LogicStatement[0])); } return this; } }