/* This file was generated by SableCC (http://www.sablecc.org/). */
package org.uva.student.calinwouter.qlqls.generated.node;
import java.util.*;
import org.uva.student.calinwouter.qlqls.generated.analysis.*;
@SuppressWarnings("nls")
public final class AParameterizedFunction extends PFunction
{
private TIdentifier _identifier_;
private final LinkedList<PElement> _element_ = new LinkedList<PElement>();
public AParameterizedFunction()
{
// Constructor
}
public AParameterizedFunction(
@SuppressWarnings("hiding") TIdentifier _identifier_,
@SuppressWarnings("hiding") List<?> _element_)
{
// Constructor
setIdentifier(_identifier_);
setElement(_element_);
}
@Override
public Object clone()
{
return new AParameterizedFunction(
cloneNode(this._identifier_),
cloneList(this._element_));
}
@Override
public void apply(Switch sw)
{
((Analysis) sw).caseAParameterizedFunction(this);
}
public TIdentifier getIdentifier()
{
return this._identifier_;
}
public void setIdentifier(TIdentifier node)
{
if(this._identifier_ != null)
{
this._identifier_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._identifier_ = node;
}
public LinkedList<PElement> getElement()
{
return this._element_;
}
public void setElement(List<?> list)
{
for(PElement e : this._element_)
{
e.parent(null);
}
this._element_.clear();
for(Object obj_e : list)
{
PElement e = (PElement) obj_e;
if(e.parent() != null)
{
e.parent().removeChild(e);
}
e.parent(this);
this._element_.add(e);
}
}
@Override
public String toString()
{
return ""
+ toString(this._identifier_)
+ toString(this._element_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._identifier_ == child)
{
this._identifier_ = null;
return;
}
if(this._element_.remove(child))
{
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._identifier_ == oldChild)
{
setIdentifier((TIdentifier) newChild);
return;
}
for(ListIterator<PElement> i = this._element_.listIterator(); i.hasNext();)
{
if(i.next() == oldChild)
{
if(newChild != null)
{
i.set((PElement) newChild);
newChild.parent(this);
oldChild.parent(null);
return;
}
i.remove();
oldChild.parent(null);
return;
}
}
throw new RuntimeException("Not a child.");
}
}