/* This file was generated by SableCC (http://www.sablecc.org/). */
package net.sf.jame.contextfree.cfdg.node;
import java.util.*;
import net.sf.jame.contextfree.cfdg.analysis.*;
@SuppressWarnings("nls")
public final class ARuleDeclaration extends PRuleDeclaration
{
private TRule _rule_;
private TString _string_;
private TNumber _number_;
private TLCbkt _lCbkt_;
private final LinkedList<PShapeReplacementDeclaration> _shapeReplacementDeclaration_ = new LinkedList<PShapeReplacementDeclaration>();
private TRCbkt _rCbkt_;
public ARuleDeclaration()
{
// Constructor
}
public ARuleDeclaration(
@SuppressWarnings("hiding") TRule _rule_,
@SuppressWarnings("hiding") TString _string_,
@SuppressWarnings("hiding") TNumber _number_,
@SuppressWarnings("hiding") TLCbkt _lCbkt_,
@SuppressWarnings("hiding") List<PShapeReplacementDeclaration> _shapeReplacementDeclaration_,
@SuppressWarnings("hiding") TRCbkt _rCbkt_)
{
// Constructor
setRule(_rule_);
setString(_string_);
setNumber(_number_);
setLCbkt(_lCbkt_);
setShapeReplacementDeclaration(_shapeReplacementDeclaration_);
setRCbkt(_rCbkt_);
}
@Override
public Object clone()
{
return new ARuleDeclaration(
cloneNode(this._rule_),
cloneNode(this._string_),
cloneNode(this._number_),
cloneNode(this._lCbkt_),
cloneList(this._shapeReplacementDeclaration_),
cloneNode(this._rCbkt_));
}
public void apply(Switch sw)
{
((Analysis) sw).caseARuleDeclaration(this);
}
public TRule getRule()
{
return this._rule_;
}
public void setRule(TRule node)
{
if(this._rule_ != null)
{
this._rule_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._rule_ = node;
}
public TString getString()
{
return this._string_;
}
public void setString(TString node)
{
if(this._string_ != null)
{
this._string_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._string_ = node;
}
public TNumber getNumber()
{
return this._number_;
}
public void setNumber(TNumber node)
{
if(this._number_ != null)
{
this._number_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._number_ = node;
}
public TLCbkt getLCbkt()
{
return this._lCbkt_;
}
public void setLCbkt(TLCbkt node)
{
if(this._lCbkt_ != null)
{
this._lCbkt_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._lCbkt_ = node;
}
public LinkedList<PShapeReplacementDeclaration> getShapeReplacementDeclaration()
{
return this._shapeReplacementDeclaration_;
}
public void setShapeReplacementDeclaration(List<PShapeReplacementDeclaration> list)
{
this._shapeReplacementDeclaration_.clear();
this._shapeReplacementDeclaration_.addAll(list);
for(PShapeReplacementDeclaration e : list)
{
if(e.parent() != null)
{
e.parent().removeChild(e);
}
e.parent(this);
}
}
public TRCbkt getRCbkt()
{
return this._rCbkt_;
}
public void setRCbkt(TRCbkt node)
{
if(this._rCbkt_ != null)
{
this._rCbkt_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._rCbkt_ = node;
}
@Override
public String toString()
{
return ""
+ toString(this._rule_)
+ toString(this._string_)
+ toString(this._number_)
+ toString(this._lCbkt_)
+ toString(this._shapeReplacementDeclaration_)
+ toString(this._rCbkt_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._rule_ == child)
{
this._rule_ = null;
return;
}
if(this._string_ == child)
{
this._string_ = null;
return;
}
if(this._number_ == child)
{
this._number_ = null;
return;
}
if(this._lCbkt_ == child)
{
this._lCbkt_ = null;
return;
}
if(this._shapeReplacementDeclaration_.remove(child))
{
return;
}
if(this._rCbkt_ == child)
{
this._rCbkt_ = null;
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._rule_ == oldChild)
{
setRule((TRule) newChild);
return;
}
if(this._string_ == oldChild)
{
setString((TString) newChild);
return;
}
if(this._number_ == oldChild)
{
setNumber((TNumber) newChild);
return;
}
if(this._lCbkt_ == oldChild)
{
setLCbkt((TLCbkt) newChild);
return;
}
for(ListIterator<PShapeReplacementDeclaration> i = this._shapeReplacementDeclaration_.listIterator(); i.hasNext();)
{
if(i.next() == oldChild)
{
if(newChild != null)
{
i.set((PShapeReplacementDeclaration) newChild);
newChild.parent(this);
oldChild.parent(null);
return;
}
i.remove();
oldChild.parent(null);
return;
}
}
if(this._rCbkt_ == oldChild)
{
setRCbkt((TRCbkt) newChild);
return;
}
throw new RuntimeException("Not a child.");
}
}