/* This file was generated by SableCC (http://www.sablecc.org/). */ package soot.jimple.parser.node; import java.util.*; import soot.jimple.parser.analysis.*; public final class AFieldMember extends PMember { private final LinkedList _modifier_ = new TypedLinkedList(new Modifier_Cast()); private PType _type_; private PName _name_; private TSemicolon _semicolon_; public AFieldMember() { } public AFieldMember( List _modifier_, PType _type_, PName _name_, TSemicolon _semicolon_) { { this._modifier_.clear(); this._modifier_.addAll(_modifier_); } setType(_type_); setName(_name_); setSemicolon(_semicolon_); } public AFieldMember( XPModifier _modifier_, PType _type_, PName _name_, TSemicolon _semicolon_) { if(_modifier_ != null) { while(_modifier_ instanceof X1PModifier) { this._modifier_.addFirst(((X1PModifier) _modifier_).getPModifier()); _modifier_ = ((X1PModifier) _modifier_).getXPModifier(); } this._modifier_.addFirst(((X2PModifier) _modifier_).getPModifier()); } setType(_type_); setName(_name_); setSemicolon(_semicolon_); } public Object clone() { return new AFieldMember( cloneList(_modifier_), (PType) cloneNode(_type_), (PName) cloneNode(_name_), (TSemicolon) cloneNode(_semicolon_)); } public void apply(Switch sw) { ((Analysis) sw).caseAFieldMember(this); } public LinkedList getModifier() { return _modifier_; } public void setModifier(List list) { _modifier_.clear(); _modifier_.addAll(list); } public PType getType() { return _type_; } public void setType(PType node) { if(_type_ != null) { _type_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } _type_ = node; } public PName getName() { return _name_; } public void setName(PName node) { if(_name_ != null) { _name_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } _name_ = node; } public TSemicolon getSemicolon() { return _semicolon_; } public void setSemicolon(TSemicolon node) { if(_semicolon_ != null) { _semicolon_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } _semicolon_ = node; } public String toString() { return "" + toString(_modifier_) + toString(_type_) + toString(_name_) + toString(_semicolon_); } void removeChild(Node child) { if(_modifier_.remove(child)) { return; } if(_type_ == child) { _type_ = null; return; } if(_name_ == child) { _name_ = null; return; } if(_semicolon_ == child) { _semicolon_ = null; return; } } void replaceChild(Node oldChild, Node newChild) { for(ListIterator i = _modifier_.listIterator(); i.hasNext();) { if(i.next() == oldChild) { if(newChild != null) { i.set(newChild); oldChild.parent(null); return; } i.remove(); oldChild.parent(null); return; } } if(_type_ == oldChild) { setType((PType) newChild); return; } if(_name_ == oldChild) { setName((PName) newChild); return; } if(_semicolon_ == oldChild) { setSemicolon((TSemicolon) newChild); return; } } private class Modifier_Cast implements Cast { public Object cast(Object o) { PModifier node = (PModifier) o; if((node.parent() != null) && (node.parent() != AFieldMember.this)) { node.parent().removeChild(node); } if((node.parent() == null) || (node.parent() != AFieldMember.this)) { node.parent(AFieldMember.this); } return node; } } }