Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

AParamParamList.java

00001 package edu.ksu.cis.bandera.specification.predicate.node;
00002 
00003 /* This file was generated by SableCC (http://www.sable.mcgill.ca/sablecc/). */
00004 
00005 import java.util.*;
00006 import edu.ksu.cis.bandera.specification.predicate.analysis.*;
00007 
00008 public final class AParamParamList extends PParamList
00009 {
00010     private PName _name_;
00011     private final LinkedList _dim_ = new TypedLinkedList(new Dim_Cast());
00012     private TId _id_;
00013 
00014     private class Dim_Cast implements Cast
00015     {
00016         public Object cast(Object o)
00017         {
00018             TDim node = (TDim) o;
00019 
00020             if((node.parent() != null) &&
00021                 (node.parent() != AParamParamList.this))
00022             {
00023                 node.parent().removeChild(node);
00024             }
00025 
00026             if((node.parent() == null) ||
00027                 (node.parent() != AParamParamList.this))
00028             {
00029                 node.parent(AParamParamList.this);
00030             }
00031 
00032             return node;
00033         }
00034     }
00035     public AParamParamList()
00036     {
00037     }
00038     public AParamParamList(
00039         PName _name_,
00040         XTDim _dim_,
00041         TId _id_)
00042     {
00043         setName(_name_);
00044 
00045         if(_dim_ != null)
00046         {
00047             while(_dim_ instanceof X1TDim)
00048             {
00049                 this._dim_.addFirst(((X1TDim) _dim_).getTDim());
00050                 _dim_ = ((X1TDim) _dim_).getXTDim();
00051             }
00052             this._dim_.addFirst(((X2TDim) _dim_).getTDim());
00053         }
00054 
00055         setId(_id_);
00056 
00057     }
00058     public AParamParamList(
00059         PName _name_,
00060         List _dim_,
00061         TId _id_)
00062     {
00063         setName(_name_);
00064 
00065         {
00066             Object temp[] = _dim_.toArray();
00067             for(int i = 0; i < temp.length; i++)
00068             {
00069                 this._dim_.add(temp[i]);
00070             }
00071         }
00072 
00073         setId(_id_);
00074 
00075     }
00076     public void apply(Switch sw)
00077     {
00078         ((Analysis) sw).caseAParamParamList(this);
00079     }
00080     public Object clone()
00081     {
00082         return new AParamParamList(
00083             (PName) cloneNode(_name_),
00084             cloneList(_dim_),
00085             (TId) cloneNode(_id_));
00086     }
00087     public LinkedList getDim()
00088     {
00089         return _dim_;
00090     }
00091     public TId getId()
00092     {
00093         return _id_;
00094     }
00095     public PName getName()
00096     {
00097         return _name_;
00098     }
00099     void removeChild(Node child)
00100     {
00101         if(_name_ == child)
00102         {
00103             _name_ = null;
00104             return;
00105         }
00106 
00107         if(_dim_.remove(child))
00108         {
00109             return;
00110         }
00111 
00112         if(_id_ == child)
00113         {
00114             _id_ = null;
00115             return;
00116         }
00117 
00118     }
00119     void replaceChild(Node oldChild, Node newChild)
00120     {
00121         if(_name_ == oldChild)
00122         {
00123             setName((PName) newChild);
00124             return;
00125         }
00126 
00127         for(ListIterator i = _dim_.listIterator(); i.hasNext();)
00128         {
00129             if(i.next() == oldChild)
00130             {
00131                 if(newChild != null)
00132                 {
00133                     i.set(newChild);
00134                     oldChild.parent(null);
00135                     return;
00136                 }
00137 
00138                 i.remove();
00139                 oldChild.parent(null);
00140                 return;
00141             }
00142         }
00143 
00144         if(_id_ == oldChild)
00145         {
00146             setId((TId) newChild);
00147             return;
00148         }
00149 
00150     }
00151     public void setDim(List list)
00152     {
00153         Object temp[] = list.toArray();
00154         for(int i = 0; i < temp.length; i++)
00155         {
00156             _dim_.add(temp[i]);
00157         }
00158     }
00159     public void setId(TId node)
00160     {
00161         if(_id_ != null)
00162         {
00163             _id_.parent(null);
00164         }
00165 
00166         if(node != null)
00167         {
00168             if(node.parent() != null)
00169             {
00170                 node.parent().removeChild(node);
00171             }
00172 
00173             node.parent(this);
00174         }
00175 
00176         _id_ = node;
00177     }
00178     public void setName(PName node)
00179     {
00180         if(_name_ != null)
00181         {
00182             _name_.parent(null);
00183         }
00184 
00185         if(node != null)
00186         {
00187             if(node.parent() != null)
00188             {
00189                 node.parent().removeChild(node);
00190             }
00191 
00192             node.parent(this);
00193         }
00194 
00195         _name_ = node;
00196     }
00197     public String toString()
00198     {
00199         return ""
00200             + toString(_name_)
00201             + toString(_dim_)
00202             + toString(_id_);
00203     }
00204 }

Generated at Thu Feb 7 06:39:01 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001