/* 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 AUnorderedShapeReplacement extends PShapeReplacement
{
private TString _string_;
private TLSbkt _lSbkt_;
private final LinkedList<PShapeAdjustment> _shapeAdjustment_ = new LinkedList<PShapeAdjustment>();
private TRSbkt _rSbkt_;
public AUnorderedShapeReplacement()
{
// Constructor
}
public AUnorderedShapeReplacement(
@SuppressWarnings("hiding") TString _string_,
@SuppressWarnings("hiding") TLSbkt _lSbkt_,
@SuppressWarnings("hiding") List<PShapeAdjustment> _shapeAdjustment_,
@SuppressWarnings("hiding") TRSbkt _rSbkt_)
{
// Constructor
setString(_string_);
setLSbkt(_lSbkt_);
setShapeAdjustment(_shapeAdjustment_);
setRSbkt(_rSbkt_);
}
@Override
public Object clone()
{
return new AUnorderedShapeReplacement(
cloneNode(this._string_),
cloneNode(this._lSbkt_),
cloneList(this._shapeAdjustment_),
cloneNode(this._rSbkt_));
}
public void apply(Switch sw)
{
((Analysis) sw).caseAUnorderedShapeReplacement(this);
}
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 TLSbkt getLSbkt()
{
return this._lSbkt_;
}
public void setLSbkt(TLSbkt node)
{
if(this._lSbkt_ != null)
{
this._lSbkt_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._lSbkt_ = node;
}
public LinkedList<PShapeAdjustment> getShapeAdjustment()
{
return this._shapeAdjustment_;
}
public void setShapeAdjustment(List<PShapeAdjustment> list)
{
this._shapeAdjustment_.clear();
this._shapeAdjustment_.addAll(list);
for(PShapeAdjustment e : list)
{
if(e.parent() != null)
{
e.parent().removeChild(e);
}
e.parent(this);
}
}
public TRSbkt getRSbkt()
{
return this._rSbkt_;
}
public void setRSbkt(TRSbkt node)
{
if(this._rSbkt_ != null)
{
this._rSbkt_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._rSbkt_ = node;
}
@Override
public String toString()
{
return ""
+ toString(this._string_)
+ toString(this._lSbkt_)
+ toString(this._shapeAdjustment_)
+ toString(this._rSbkt_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._string_ == child)
{
this._string_ = null;
return;
}
if(this._lSbkt_ == child)
{
this._lSbkt_ = null;
return;
}
if(this._shapeAdjustment_.remove(child))
{
return;
}
if(this._rSbkt_ == child)
{
this._rSbkt_ = null;
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._string_ == oldChild)
{
setString((TString) newChild);
return;
}
if(this._lSbkt_ == oldChild)
{
setLSbkt((TLSbkt) newChild);
return;
}
for(ListIterator<PShapeAdjustment> i = this._shapeAdjustment_.listIterator(); i.hasNext();)
{
if(i.next() == oldChild)
{
if(newChild != null)
{
i.set((PShapeAdjustment) newChild);
newChild.parent(this);
oldChild.parent(null);
return;
}
i.remove();
oldChild.parent(null);
return;
}
}
if(this._rSbkt_ == oldChild)
{
setRSbkt((TRSbkt) newChild);
return;
}
throw new RuntimeException("Not a child.");
}
}