prerna.sablecc2.node.AScript Maven / Gradle / Ivy
/* This file was generated by SableCC (http://www.sablecc.org/). */
package prerna.sablecc2.node;
import java.util.*;
import prerna.sablecc2.analysis.*;
@SuppressWarnings("nls")
public final class AScript extends PScript
{
private PScriptstart _scriptstart_;
private final LinkedList _otherscript_ = new LinkedList();
public AScript()
{
// Constructor
}
public AScript(
@SuppressWarnings("hiding") PScriptstart _scriptstart_,
@SuppressWarnings("hiding") List> _otherscript_)
{
// Constructor
setScriptstart(_scriptstart_);
setOtherscript(_otherscript_);
}
@Override
public Object clone()
{
return new AScript(
cloneNode(this._scriptstart_),
cloneList(this._otherscript_));
}
@Override
public void apply(Switch sw)
{
((Analysis) sw).caseAScript(this);
}
public PScriptstart getScriptstart()
{
return this._scriptstart_;
}
public void setScriptstart(PScriptstart node)
{
if(this._scriptstart_ != null)
{
this._scriptstart_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._scriptstart_ = node;
}
public LinkedList getOtherscript()
{
return this._otherscript_;
}
public void setOtherscript(List> list)
{
for(POtherscript e : this._otherscript_)
{
e.parent(null);
}
this._otherscript_.clear();
for(Object obj_e : list)
{
POtherscript e = (POtherscript) obj_e;
if(e.parent() != null)
{
e.parent().removeChild(e);
}
e.parent(this);
this._otherscript_.add(e);
}
}
@Override
public String toString()
{
return ""
+ toString(this._scriptstart_)
+ toString(this._otherscript_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._scriptstart_ == child)
{
this._scriptstart_ = null;
return;
}
if(this._otherscript_.remove(child))
{
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._scriptstart_ == oldChild)
{
setScriptstart((PScriptstart) newChild);
return;
}
for(ListIterator i = this._otherscript_.listIterator(); i.hasNext();)
{
if(i.next() == oldChild)
{
if(newChild != null)
{
i.set((POtherscript) newChild);
newChild.parent(this);
oldChild.parent(null);
return;
}
i.remove();
oldChild.parent(null);
return;
}
}
throw new RuntimeException("Not a child.");
}
}