/* This file was generated by SableCC (http://www.sablecc.org/). */ package org.uva.student.calinwouter.qlqls.generated.node; import java.util.*; import org.uva.student.calinwouter.qlqls.generated.analysis.*; @SuppressWarnings("nls") public final class AForm extends PForm { private TIdentifier _identifier_; private final LinkedList<PStatement> _statement_ = new LinkedList<PStatement>(); public AForm() { // Constructor } public AForm( @SuppressWarnings("hiding") TIdentifier _identifier_, @SuppressWarnings("hiding") List<?> _statement_) { // Constructor setIdentifier(_identifier_); setStatement(_statement_); } @Override public Object clone() { return new AForm( cloneNode(this._identifier_), cloneList(this._statement_)); } @Override public void apply(Switch sw) { ((Analysis) sw).caseAForm(this); } public TIdentifier getIdentifier() { return this._identifier_; } public void setIdentifier(TIdentifier node) { if(this._identifier_ != null) { this._identifier_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._identifier_ = node; } public LinkedList<PStatement> getStatement() { return this._statement_; } public void setStatement(List<?> list) { for(PStatement e : this._statement_) { e.parent(null); } this._statement_.clear(); for(Object obj_e : list) { PStatement e = (PStatement) obj_e; if(e.parent() != null) { e.parent().removeChild(e); } e.parent(this); this._statement_.add(e); } } @Override public String toString() { return "" + toString(this._identifier_) + toString(this._statement_); } @Override void removeChild(@SuppressWarnings("unused") Node child) { // Remove child if(this._identifier_ == child) { this._identifier_ = null; return; } if(this._statement_.remove(child)) { return; } throw new RuntimeException("Not a child."); } @Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child if(this._identifier_ == oldChild) { setIdentifier((TIdentifier) newChild); return; } for(ListIterator<PStatement> i = this._statement_.listIterator(); i.hasNext();) { if(i.next() == oldChild) { if(newChild != null) { i.set((PStatement) newChild); newChild.parent(this); oldChild.parent(null); return; } i.remove(); oldChild.parent(null); return; } } throw new RuntimeException("Not a child."); } }