/* This file was generated by SableCC (http://www.sablecc.org/). */ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; @SuppressWarnings("nls") public final class AGrammar extends PGrammar { private final LinkedList<TPkgId> _package_ = new LinkedList<TPkgId>(); private PHelpers _helpers_; private PStates _states_; private PTokens _tokens_; private PIgnTokens _ignTokens_; private PProductions _productions_; private PAst _ast_; public AGrammar() { // Constructor } public AGrammar( @SuppressWarnings("hiding") List<?> _package_, @SuppressWarnings("hiding") PHelpers _helpers_, @SuppressWarnings("hiding") PStates _states_, @SuppressWarnings("hiding") PTokens _tokens_, @SuppressWarnings("hiding") PIgnTokens _ignTokens_, @SuppressWarnings("hiding") PProductions _productions_, @SuppressWarnings("hiding") PAst _ast_) { // Constructor setPackage(_package_); setHelpers(_helpers_); setStates(_states_); setTokens(_tokens_); setIgnTokens(_ignTokens_); setProductions(_productions_); setAst(_ast_); } @Override public Object clone() { return new AGrammar( cloneList(this._package_), cloneNode(this._helpers_), cloneNode(this._states_), cloneNode(this._tokens_), cloneNode(this._ignTokens_), cloneNode(this._productions_), cloneNode(this._ast_)); } @Override public void apply(Switch sw) { ((Analysis) sw).caseAGrammar(this); } public LinkedList<TPkgId> getPackage() { return this._package_; } public void setPackage(List<?> list) { for (TPkgId e : this._package_) { e.parent(null); } this._package_.clear(); for (Object obj_e : list) { TPkgId e = (TPkgId) obj_e; if (e.parent() != null) { e.parent().removeChild(e); } e.parent(this); this._package_.add(e); } } public PHelpers getHelpers() { return this._helpers_; } public void setHelpers(PHelpers node) { if (this._helpers_ != null) { this._helpers_.parent(null); } if (node != null) { if (node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._helpers_ = node; } public PStates getStates() { return this._states_; } public void setStates(PStates node) { if (this._states_ != null) { this._states_.parent(null); } if (node != null) { if (node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._states_ = node; } public PTokens getTokens() { return this._tokens_; } public void setTokens(PTokens node) { if (this._tokens_ != null) { this._tokens_.parent(null); } if (node != null) { if (node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._tokens_ = node; } public PIgnTokens getIgnTokens() { return this._ignTokens_; } public void setIgnTokens(PIgnTokens node) { if (this._ignTokens_ != null) { this._ignTokens_.parent(null); } if (node != null) { if (node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._ignTokens_ = node; } public PProductions getProductions() { return this._productions_; } public void setProductions(PProductions node) { if (this._productions_ != null) { this._productions_.parent(null); } if (node != null) { if (node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._productions_ = node; } public PAst getAst() { return this._ast_; } public void setAst(PAst node) { if (this._ast_ != null) { this._ast_.parent(null); } if (node != null) { if (node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._ast_ = node; } @Override public String toString() { return "" + toString(this._package_) + toString(this._helpers_) + toString(this._states_) + toString(this._tokens_) + toString(this._ignTokens_) + toString(this._productions_) + toString(this._ast_); } @Override void removeChild(@SuppressWarnings("unused") Node child) { // Remove child if (this._package_.remove(child)) { return; } if (this._helpers_ == child) { this._helpers_ = null; return; } if (this._states_ == child) { this._states_ = null; return; } if (this._tokens_ == child) { this._tokens_ = null; return; } if (this._ignTokens_ == child) { this._ignTokens_ = null; return; } if (this._productions_ == child) { this._productions_ = null; return; } if (this._ast_ == child) { this._ast_ = null; return; } throw new RuntimeException("Not a child."); } @Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child for (ListIterator<TPkgId> i = this._package_.listIterator(); i.hasNext(); ) { if (i.next() == oldChild) { if (newChild != null) { i.set((TPkgId) newChild); newChild.parent(this); oldChild.parent(null); return; } i.remove(); oldChild.parent(null); return; } } if (this._helpers_ == oldChild) { setHelpers((PHelpers) newChild); return; } if (this._states_ == oldChild) { setStates((PStates) newChild); return; } if (this._tokens_ == oldChild) { setTokens((PTokens) newChild); return; } if (this._ignTokens_ == oldChild) { setIgnTokens((PIgnTokens) newChild); return; } if (this._productions_ == oldChild) { setProductions((PProductions) newChild); return; } if (this._ast_ == oldChild) { setAst((PAst) newChild); return; } throw new RuntimeException("Not a child."); } }