/* 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 AProductions extends PProductions {
private final LinkedList<PProd> _prods_ = new LinkedList<PProd>();
public AProductions() {
// Constructor
}
public AProductions(
@SuppressWarnings("hiding") List<?> _prods_) {
// Constructor
setProds(_prods_);
}
@Override
public Object clone() {
return new AProductions(
cloneList(this._prods_));
}
@Override
public void apply(Switch sw) {
((Analysis) sw).caseAProductions(this);
}
public LinkedList<PProd> getProds() {
return this._prods_;
}
public void setProds(List<?> list) {
for (PProd e : this._prods_) {
e.parent(null);
}
this._prods_.clear();
for (Object obj_e : list) {
PProd e = (PProd) 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<PProd> i = this._prods_.listIterator(); i.hasNext(); ) {
if (i.next() == oldChild) {
if (newChild != null) {
i.set((PProd) newChild);
newChild.parent(this);
oldChild.parent(null);
return;
}
i.remove();
oldChild.parent(null);
return;
}
}
throw new RuntimeException("Not a child.");
}
}