/* 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 AAst extends PAst {
private final LinkedList<PAstProd> _prods_ = new LinkedList<PAstProd>();
public AAst() {
// Constructor
}
public AAst(
@SuppressWarnings("hiding") List<?> _prods_) {
// Constructor
setProds(_prods_);
}
@Override
public Object clone() {
return new AAst(
cloneList(this._prods_));
}
@Override
public void apply(Switch sw) {
((Analysis) sw).caseAAst(this);
}
public LinkedList<PAstProd> getProds() {
return this._prods_;
}
public void setProds(List<?> list) {
for (PAstProd e : this._prods_) {
e.parent(null);
}
this._prods_.clear();
for (Object obj_e : list) {
PAstProd e = (PAstProd) obj_e;
if (e.parent() != null) {
e.parent().removeChild(e);
}
e.parent(this);
this._prods_.add(e);
}
}
@Override
public String toString() {
return ""
+ toString(this._prods_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child) {
// Remove child
if (this._prods_.remove(child)) {
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) {
// Replace child
for (ListIterator<PAstProd> i = this._prods_.listIterator(); i.hasNext(); ) {
if (i.next() == oldChild) {
if (newChild != null) {
i.set((PAstProd) newChild);
newChild.parent(this);
oldChild.parent(null);
return;
}
i.remove();
oldChild.parent(null);
return;
}
}
throw new RuntimeException("Not a child.");
}
}