/* 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 AAlt extends PAlt {
private TId _altName_;
private final LinkedList<PElem> _elems_ = new LinkedList<PElem>();
private PAltTransform _altTransform_;
public AAlt() {
// Constructor
}
public AAlt(
@SuppressWarnings("hiding") TId _altName_,
@SuppressWarnings("hiding") List<?> _elems_,
@SuppressWarnings("hiding") PAltTransform _altTransform_) {
// Constructor
setAltName(_altName_);
setElems(_elems_);
setAltTransform(_altTransform_);
}
@Override
public Object clone() {
return new AAlt(
cloneNode(this._altName_),
cloneList(this._elems_),
cloneNode(this._altTransform_));
}
@Override
public void apply(Switch sw) {
((Analysis) sw).caseAAlt(this);
}
public TId getAltName() {
return this._altName_;
}
public void setAltName(TId node) {
if (this._altName_ != null) {
this._altName_.parent(null);
}
if (node != null) {
if (node.parent() != null) {
node.parent().removeChild(node);
}
node.parent(this);
}
this._altName_ = node;
}
public LinkedList<PElem> getElems() {
return this._elems_;
}
public void setElems(List<?> list) {
for (PElem e : this._elems_) {
e.parent(null);
}
this._elems_.clear();
for (Object obj_e : list) {
PElem e = (PElem) obj_e;
if (e.parent() != null) {
e.parent().removeChild(e);
}
e.parent(this);
this._elems_.add(e);
}
}
public PAltTransform getAltTransform() {
return this._altTransform_;
}
public void setAltTransform(PAltTransform node) {
if (this._altTransform_ != null) {
this._altTransform_.parent(null);
}
if (node != null) {
if (node.parent() != null) {
node.parent().removeChild(node);
}
node.parent(this);
}
this._altTransform_ = node;
}
@Override
public String toString() {
return ""
+ toString(this._altName_)
+ toString(this._elems_)
+ toString(this._altTransform_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child) {
// Remove child
if (this._altName_ == child) {
this._altName_ = null;
return;
}
if (this._elems_.remove(child)) {
return;
}
if (this._altTransform_ == child) {
this._altTransform_ = null;
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) {
// Replace child
if (this._altName_ == oldChild) {
setAltName((TId) newChild);
return;
}
for (ListIterator<PElem> i = this._elems_.listIterator(); i.hasNext(); ) {
if (i.next() == oldChild) {
if (newChild != null) {
i.set((PElem) newChild);
newChild.parent(this);
oldChild.parent(null);
return;
}
i.remove();
oldChild.parent(null);
return;
}
}
if (this._altTransform_ == oldChild) {
setAltTransform((PAltTransform) newChild);
return;
}
throw new RuntimeException("Not a child.");
}
}