soot.jimple.parser.node.AFullMethodBody Maven / Gradle / Ivy
/* This file was generated by SableCC (http://www.sablecc.org/). */
package soot.jimple.parser.node;
import java.util.*;
import soot.jimple.parser.analysis.*;
@SuppressWarnings("nls")
public final class AFullMethodBody extends PMethodBody
{
private TLBrace _lBrace_;
private final LinkedList _declaration_ = new LinkedList();
private final LinkedList _statement_ = new LinkedList();
private final LinkedList _catchClause_ = new LinkedList();
private TRBrace _rBrace_;
public AFullMethodBody()
{
// Constructor
}
public AFullMethodBody(
@SuppressWarnings("hiding") TLBrace _lBrace_,
@SuppressWarnings("hiding") List _declaration_,
@SuppressWarnings("hiding") List _statement_,
@SuppressWarnings("hiding") List _catchClause_,
@SuppressWarnings("hiding") TRBrace _rBrace_)
{
// Constructor
setLBrace(_lBrace_);
setDeclaration(_declaration_);
setStatement(_statement_);
setCatchClause(_catchClause_);
setRBrace(_rBrace_);
}
@Override
public Object clone()
{
return new AFullMethodBody(
cloneNode(this._lBrace_),
cloneList(this._declaration_),
cloneList(this._statement_),
cloneList(this._catchClause_),
cloneNode(this._rBrace_));
}
@Override
public void apply(Switch sw)
{
((Analysis) sw).caseAFullMethodBody(this);
}
public TLBrace getLBrace()
{
return this._lBrace_;
}
public void setLBrace(TLBrace node)
{
if(this._lBrace_ != null)
{
this._lBrace_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._lBrace_ = node;
}
public LinkedList getDeclaration()
{
return this._declaration_;
}
public void setDeclaration(List list)
{
for(PDeclaration e : this._declaration_)
{
e.parent(null);
}
this._declaration_.clear();
for(Object obj_e : list)
{
PDeclaration e = (PDeclaration) obj_e;
if(e.parent() != null)
{
e.parent().removeChild(e);
}
e.parent(this);
this._declaration_.add(e);
}
}
public LinkedList getStatement()
{
return this._statement_;
}
public void setStatement(List list)
{
for(PStatement e : this._statement_)
{
e.parent(null);
}
this._statement_.clear();
for(Object obj_e : list)
{
PStatement e = (PStatement) obj_e;
if(e.parent() != null)
{
e.parent().removeChild(e);
}
e.parent(this);
this._statement_.add(e);
}
}
public LinkedList getCatchClause()
{
return this._catchClause_;
}
public void setCatchClause(List list)
{
for(PCatchClause e : this._catchClause_)
{
e.parent(null);
}
this._catchClause_.clear();
for(Object obj_e : list)
{
PCatchClause e = (PCatchClause) obj_e;
if(e.parent() != null)
{
e.parent().removeChild(e);
}
e.parent(this);
this._catchClause_.add(e);
}
}
public TRBrace getRBrace()
{
return this._rBrace_;
}
public void setRBrace(TRBrace node)
{
if(this._rBrace_ != null)
{
this._rBrace_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._rBrace_ = node;
}
@Override
public String toString()
{
return ""
+ toString(this._lBrace_)
+ toString(this._declaration_)
+ toString(this._statement_)
+ toString(this._catchClause_)
+ toString(this._rBrace_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._lBrace_ == child)
{
this._lBrace_ = null;
return;
}
if(this._declaration_.remove(child))
{
return;
}
if(this._statement_.remove(child))
{
return;
}
if(this._catchClause_.remove(child))
{
return;
}
if(this._rBrace_ == child)
{
this._rBrace_ = null;
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._lBrace_ == oldChild)
{
setLBrace((TLBrace) newChild);
return;
}
for(ListIterator i = this._declaration_.listIterator(); i.hasNext();)
{
if(i.next() == oldChild)
{
if(newChild != null)
{
i.set((PDeclaration) newChild);
newChild.parent(this);
oldChild.parent(null);
return;
}
i.remove();
oldChild.parent(null);
return;
}
}
for(ListIterator i = this._statement_.listIterator(); i.hasNext();)
{
if(i.next() == oldChild)
{
if(newChild != null)
{
i.set((PStatement) newChild);
newChild.parent(this);
oldChild.parent(null);
return;
}
i.remove();
oldChild.parent(null);
return;
}
}
for(ListIterator i = this._catchClause_.listIterator(); i.hasNext();)
{
if(i.next() == oldChild)
{
if(newChild != null)
{
i.set((PCatchClause) newChild);
newChild.parent(this);
oldChild.parent(null);
return;
}
i.remove();
oldChild.parent(null);
return;
}
}
if(this._rBrace_ == oldChild)
{
setRBrace((TRBrace) newChild);
return;
}
throw new RuntimeException("Not a child.");
}
}