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

AQualifiedClassInstanceCreationExp.java

00001 package edu.ksu.cis.bandera.jjjc.node;
00002 
00003 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00004  * Bandera, a Java(TM) analysis and transformation toolkit           *
00005  * Copyright (C) 1998-2001 SAnToS Laboratories (santos@cis.ksu.edu)  *
00006 
00007  * All rights reserved.                                              *
00008  *                                                                   *
00009  * This work was done as a project in the SAnToS Laboratory,         *
00010  * Department of Computing and Information Sciences, Kansas State    *
00011  * University, USA (http://www.cis.ksu.edu/santos).                  *
00012  * It is understood that any modification not identified as such is  *
00013  * not covered by the preceding statement.                           *
00014  *                                                                   *
00015  * This work is free software; you can redistribute it and/or        *
00016  * modify it under the terms of the GNU Library General Public       *
00017  * License as published by the Free Software Foundation; either      *
00018  * version 2 of the License, or (at your option) any later version.  *
00019  *                                                                   *
00020  * This work is distributed in the hope that it will be useful,      *
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of    *
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *
00023  * Library General Public License for more details.                  *
00024  *                                                                   *
00025  * You should have received a copy of the GNU Library General Public *
00026  * License along with this toolkit; if not, write to the             *
00027  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,      *
00028  * Boston, MA  02111-1307, USA.                                      *
00029  *                                                                   *
00030  * Java is a trademark of Sun Microsystems, Inc.                     *
00031  *                                                                   *
00032  * To submit a bug report, send a comment, or get the latest news on *
00033  * this project and other SAnToS projects, please visit the web-site *
00034  *                http://www.cis.ksu.edu/santos                      *
00035  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00036 import ca.mcgill.sable.util.*;
00037 import edu.ksu.cis.bandera.jjjc.analysis.*;
00038 
00039 public final class AQualifiedClassInstanceCreationExp extends PExp
00040 {
00041     private PExp _exp_;
00042     private TDot _dot_;
00043     private TNew _new_;
00044     private TId _id_;
00045     private TLPar _lPar_;
00046     private final LinkedList _argumentList_ = new TypedLinkedList(new ArgumentList_Cast());
00047     private TRPar _rPar_;
00048     private PClassBody _classBody_;
00049 
00050     private class ArgumentList_Cast implements Cast
00051     {
00052         public Object cast(Object o)
00053         {
00054             PExp node = (PExp) o;
00055 
00056             if((node.parent() != null) &&
00057                 (node.parent() != AQualifiedClassInstanceCreationExp.this))
00058             {
00059                 node.parent().removeChild(node);
00060             }
00061 
00062             if((node.parent() == null) ||
00063                 (node.parent() != AQualifiedClassInstanceCreationExp.this))
00064             {
00065                 node.parent(AQualifiedClassInstanceCreationExp.this);
00066             }
00067 
00068             return node;
00069         }
00070     }
00071     public AQualifiedClassInstanceCreationExp()
00072     {
00073     }
00074     public AQualifiedClassInstanceCreationExp(
00075         PExp _exp_,
00076         TDot _dot_,
00077         TNew _new_,
00078         TId _id_,
00079         TLPar _lPar_,
00080         List _argumentList_,
00081         TRPar _rPar_,
00082         PClassBody _classBody_)
00083     {
00084         setExp(_exp_);
00085 
00086         setDot(_dot_);
00087 
00088         setNew(_new_);
00089 
00090         setId(_id_);
00091 
00092         setLPar(_lPar_);
00093 
00094         {
00095             Object temp[] = _argumentList_.toArray();
00096             for(int i = 0; i < temp.length; i++)
00097             {
00098                 this._argumentList_.add(temp[i]);
00099             }
00100         }
00101 
00102         setRPar(_rPar_);
00103 
00104         setClassBody(_classBody_);
00105 
00106     }
00107     public AQualifiedClassInstanceCreationExp(
00108         PExp _exp_,
00109         TDot _dot_,
00110         TNew _new_,
00111         TId _id_,
00112         TLPar _lPar_,
00113         XPExp _argumentList_,
00114         TRPar _rPar_,
00115         PClassBody _classBody_)
00116     {
00117         setExp(_exp_);
00118 
00119         setDot(_dot_);
00120 
00121         setNew(_new_);
00122 
00123         setId(_id_);
00124 
00125         setLPar(_lPar_);
00126 
00127         if(_argumentList_ != null)
00128         {
00129             while(_argumentList_ instanceof X1PExp)
00130             {
00131                 this._argumentList_.addFirst(((X1PExp) _argumentList_).getPExp());
00132                 _argumentList_ = ((X1PExp) _argumentList_).getXPExp();
00133             }
00134             this._argumentList_.addFirst(((X2PExp) _argumentList_).getPExp());
00135         }
00136 
00137         setRPar(_rPar_);
00138 
00139         setClassBody(_classBody_);
00140 
00141     }
00142     public void apply(Switch sw)
00143     {
00144         ((Analysis) sw).caseAQualifiedClassInstanceCreationExp(this);
00145     }
00146     public Object clone()
00147     {
00148         return new AQualifiedClassInstanceCreationExp(
00149             (PExp) cloneNode(_exp_),
00150             (TDot) cloneNode(_dot_),
00151             (TNew) cloneNode(_new_),
00152             (TId) cloneNode(_id_),
00153             (TLPar) cloneNode(_lPar_),
00154             cloneList(_argumentList_),
00155             (TRPar) cloneNode(_rPar_),
00156             (PClassBody) cloneNode(_classBody_));
00157     }
00158     public LinkedList getArgumentList()
00159     {
00160         return _argumentList_;
00161     }
00162     public PClassBody getClassBody()
00163     {
00164         return _classBody_;
00165     }
00166     public TDot getDot()
00167     {
00168         return _dot_;
00169     }
00170     public PExp getExp()
00171     {
00172         return _exp_;
00173     }
00174     public TId getId()
00175     {
00176         return _id_;
00177     }
00178     public TLPar getLPar()
00179     {
00180         return _lPar_;
00181     }
00182     public TNew getNew()
00183     {
00184         return _new_;
00185     }
00186     public TRPar getRPar()
00187     {
00188         return _rPar_;
00189     }
00190     void removeChild(Node child)
00191     {
00192         if(_exp_ == child)
00193         {
00194             _exp_ = null;
00195             return;
00196         }
00197 
00198         if(_dot_ == child)
00199         {
00200             _dot_ = null;
00201             return;
00202         }
00203 
00204         if(_new_ == child)
00205         {
00206             _new_ = null;
00207             return;
00208         }
00209 
00210         if(_id_ == child)
00211         {
00212             _id_ = null;
00213             return;
00214         }
00215 
00216         if(_lPar_ == child)
00217         {
00218             _lPar_ = null;
00219             return;
00220         }
00221 
00222         if(_argumentList_.remove(child))
00223         {
00224             return;
00225         }
00226 
00227         if(_rPar_ == child)
00228         {
00229             _rPar_ = null;
00230             return;
00231         }
00232 
00233         if(_classBody_ == child)
00234         {
00235             _classBody_ = null;
00236             return;
00237         }
00238 
00239     }
00240     void replaceChild(Node oldChild, Node newChild)
00241     {
00242         if(_exp_ == oldChild)
00243         {
00244             setExp((PExp) newChild);
00245             return;
00246         }
00247 
00248         if(_dot_ == oldChild)
00249         {
00250             setDot((TDot) newChild);
00251             return;
00252         }
00253 
00254         if(_new_ == oldChild)
00255         {
00256             setNew((TNew) newChild);
00257             return;
00258         }
00259 
00260         if(_id_ == oldChild)
00261         {
00262             setId((TId) newChild);
00263             return;
00264         }
00265 
00266         if(_lPar_ == oldChild)
00267         {
00268             setLPar((TLPar) newChild);
00269             return;
00270         }
00271 
00272         for(ListIterator i = _argumentList_.listIterator(); i.hasNext();)
00273         {
00274             if(i.next() == oldChild)
00275             {
00276                 if(newChild != null)
00277                 {
00278                     i.set(newChild);
00279                     oldChild.parent(null);
00280                     return;
00281                 }
00282 
00283                 i.remove();
00284                 oldChild.parent(null);
00285                 return;
00286             }
00287         }
00288 
00289         if(_rPar_ == oldChild)
00290         {
00291             setRPar((TRPar) newChild);
00292             return;
00293         }
00294 
00295         if(_classBody_ == oldChild)
00296         {
00297             setClassBody((PClassBody) newChild);
00298             return;
00299         }
00300 
00301     }
00302     public void setArgumentList(List list)
00303     {
00304         Object temp[] = list.toArray();
00305         for(int i = 0; i < temp.length; i++)
00306         {
00307             _argumentList_.add(temp[i]);
00308         }
00309     }
00310     public void setClassBody(PClassBody node)
00311     {
00312         if(_classBody_ != null)
00313         {
00314             _classBody_.parent(null);
00315         }
00316 
00317         if(node != null)
00318         {
00319             if(node.parent() != null)
00320             {
00321                 node.parent().removeChild(node);
00322             }
00323 
00324             node.parent(this);
00325         }
00326 
00327         _classBody_ = node;
00328     }
00329     public void setDot(TDot node)
00330     {
00331         if(_dot_ != null)
00332         {
00333             _dot_.parent(null);
00334         }
00335 
00336         if(node != null)
00337         {
00338             if(node.parent() != null)
00339             {
00340                 node.parent().removeChild(node);
00341             }
00342 
00343             node.parent(this);
00344         }
00345 
00346         _dot_ = node;
00347     }
00348     public void setExp(PExp node)
00349     {
00350         if(_exp_ != null)
00351         {
00352             _exp_.parent(null);
00353         }
00354 
00355         if(node != null)
00356         {
00357             if(node.parent() != null)
00358             {
00359                 node.parent().removeChild(node);
00360             }
00361 
00362             node.parent(this);
00363         }
00364 
00365         _exp_ = node;
00366     }
00367     public void setId(TId node)
00368     {
00369         if(_id_ != null)
00370         {
00371             _id_.parent(null);
00372         }
00373 
00374         if(node != null)
00375         {
00376             if(node.parent() != null)
00377             {
00378                 node.parent().removeChild(node);
00379             }
00380 
00381             node.parent(this);
00382         }
00383 
00384         _id_ = node;
00385     }
00386     public void setLPar(TLPar node)
00387     {
00388         if(_lPar_ != null)
00389         {
00390             _lPar_.parent(null);
00391         }
00392 
00393         if(node != null)
00394         {
00395             if(node.parent() != null)
00396             {
00397                 node.parent().removeChild(node);
00398             }
00399 
00400             node.parent(this);
00401         }
00402 
00403         _lPar_ = node;
00404     }
00405     public void setNew(TNew node)
00406     {
00407         if(_new_ != null)
00408         {
00409             _new_.parent(null);
00410         }
00411 
00412         if(node != null)
00413         {
00414             if(node.parent() != null)
00415             {
00416                 node.parent().removeChild(node);
00417             }
00418 
00419             node.parent(this);
00420         }
00421 
00422         _new_ = node;
00423     }
00424     public void setRPar(TRPar node)
00425     {
00426         if(_rPar_ != null)
00427         {
00428             _rPar_.parent(null);
00429         }
00430 
00431         if(node != null)
00432         {
00433             if(node.parent() != null)
00434             {
00435                 node.parent().removeChild(node);
00436             }
00437 
00438             node.parent(this);
00439         }
00440 
00441         _rPar_ = node;
00442     }
00443     public String toString()
00444     {
00445         return ""
00446             + toString(_exp_)
00447             + toString(_dot_)
00448             + toString(_new_)
00449             + toString(_id_)
00450             + toString(_lPar_)
00451             + toString(_argumentList_)
00452             + toString(_rPar_)
00453             + toString(_classBody_);
00454     }
00455 }

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