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

ASuperMethodInvocationExp.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 ASuperMethodInvocationExp extends PExp
00040 {
00041     private TSuper _super_;
00042     private TDot _dot_;
00043     private TId _id_;
00044     private TLPar _lPar_;
00045     private final LinkedList _argumentList_ = new TypedLinkedList(new ArgumentList_Cast());
00046     private TRPar _rPar_;
00047 
00048     private class ArgumentList_Cast implements Cast
00049     {
00050         public Object cast(Object o)
00051         {
00052             PExp node = (PExp) o;
00053 
00054             if((node.parent() != null) &&
00055                 (node.parent() != ASuperMethodInvocationExp.this))
00056             {
00057                 node.parent().removeChild(node);
00058             }
00059 
00060             if((node.parent() == null) ||
00061                 (node.parent() != ASuperMethodInvocationExp.this))
00062             {
00063                 node.parent(ASuperMethodInvocationExp.this);
00064             }
00065 
00066             return node;
00067         }
00068     }
00069     public ASuperMethodInvocationExp()
00070     {
00071     }
00072     public ASuperMethodInvocationExp(
00073         TSuper _super_,
00074         TDot _dot_,
00075         TId _id_,
00076         TLPar _lPar_,
00077         List _argumentList_,
00078         TRPar _rPar_)
00079     {
00080         setSuper(_super_);
00081 
00082         setDot(_dot_);
00083 
00084         setId(_id_);
00085 
00086         setLPar(_lPar_);
00087 
00088         {
00089             Object temp[] = _argumentList_.toArray();
00090             for(int i = 0; i < temp.length; i++)
00091             {
00092                 this._argumentList_.add(temp[i]);
00093             }
00094         }
00095 
00096         setRPar(_rPar_);
00097 
00098     }
00099     public ASuperMethodInvocationExp(
00100         TSuper _super_,
00101         TDot _dot_,
00102         TId _id_,
00103         TLPar _lPar_,
00104         XPExp _argumentList_,
00105         TRPar _rPar_)
00106     {
00107         setSuper(_super_);
00108 
00109         setDot(_dot_);
00110 
00111         setId(_id_);
00112 
00113         setLPar(_lPar_);
00114 
00115         if(_argumentList_ != null)
00116         {
00117             while(_argumentList_ instanceof X1PExp)
00118             {
00119                 this._argumentList_.addFirst(((X1PExp) _argumentList_).getPExp());
00120                 _argumentList_ = ((X1PExp) _argumentList_).getXPExp();
00121             }
00122             this._argumentList_.addFirst(((X2PExp) _argumentList_).getPExp());
00123         }
00124 
00125         setRPar(_rPar_);
00126 
00127     }
00128     public void apply(Switch sw)
00129     {
00130         ((Analysis) sw).caseASuperMethodInvocationExp(this);
00131     }
00132     public Object clone()
00133     {
00134         return new ASuperMethodInvocationExp(
00135             (TSuper) cloneNode(_super_),
00136             (TDot) cloneNode(_dot_),
00137             (TId) cloneNode(_id_),
00138             (TLPar) cloneNode(_lPar_),
00139             cloneList(_argumentList_),
00140             (TRPar) cloneNode(_rPar_));
00141     }
00142     public LinkedList getArgumentList()
00143     {
00144         return _argumentList_;
00145     }
00146     public TDot getDot()
00147     {
00148         return _dot_;
00149     }
00150     public TId getId()
00151     {
00152         return _id_;
00153     }
00154     public TLPar getLPar()
00155     {
00156         return _lPar_;
00157     }
00158     public TRPar getRPar()
00159     {
00160         return _rPar_;
00161     }
00162     public TSuper getSuper()
00163     {
00164         return _super_;
00165     }
00166     void removeChild(Node child)
00167     {
00168         if(_super_ == child)
00169         {
00170             _super_ = null;
00171             return;
00172         }
00173 
00174         if(_dot_ == child)
00175         {
00176             _dot_ = null;
00177             return;
00178         }
00179 
00180         if(_id_ == child)
00181         {
00182             _id_ = null;
00183             return;
00184         }
00185 
00186         if(_lPar_ == child)
00187         {
00188             _lPar_ = null;
00189             return;
00190         }
00191 
00192         if(_argumentList_.remove(child))
00193         {
00194             return;
00195         }
00196 
00197         if(_rPar_ == child)
00198         {
00199             _rPar_ = null;
00200             return;
00201         }
00202 
00203     }
00204     void replaceChild(Node oldChild, Node newChild)
00205     {
00206         if(_super_ == oldChild)
00207         {
00208             setSuper((TSuper) newChild);
00209             return;
00210         }
00211 
00212         if(_dot_ == oldChild)
00213         {
00214             setDot((TDot) newChild);
00215             return;
00216         }
00217 
00218         if(_id_ == oldChild)
00219         {
00220             setId((TId) newChild);
00221             return;
00222         }
00223 
00224         if(_lPar_ == oldChild)
00225         {
00226             setLPar((TLPar) newChild);
00227             return;
00228         }
00229 
00230         for(ListIterator i = _argumentList_.listIterator(); i.hasNext();)
00231         {
00232             if(i.next() == oldChild)
00233             {
00234                 if(newChild != null)
00235                 {
00236                     i.set(newChild);
00237                     oldChild.parent(null);
00238                     return;
00239                 }
00240 
00241                 i.remove();
00242                 oldChild.parent(null);
00243                 return;
00244             }
00245         }
00246 
00247         if(_rPar_ == oldChild)
00248         {
00249             setRPar((TRPar) newChild);
00250             return;
00251         }
00252 
00253     }
00254     public void setArgumentList(List list)
00255     {
00256         Object temp[] = list.toArray();
00257         for(int i = 0; i < temp.length; i++)
00258         {
00259             _argumentList_.add(temp[i]);
00260         }
00261     }
00262     public void setDot(TDot node)
00263     {
00264         if(_dot_ != null)
00265         {
00266             _dot_.parent(null);
00267         }
00268 
00269         if(node != null)
00270         {
00271             if(node.parent() != null)
00272             {
00273                 node.parent().removeChild(node);
00274             }
00275 
00276             node.parent(this);
00277         }
00278 
00279         _dot_ = node;
00280     }
00281     public void setId(TId node)
00282     {
00283         if(_id_ != null)
00284         {
00285             _id_.parent(null);
00286         }
00287 
00288         if(node != null)
00289         {
00290             if(node.parent() != null)
00291             {
00292                 node.parent().removeChild(node);
00293             }
00294 
00295             node.parent(this);
00296         }
00297 
00298         _id_ = node;
00299     }
00300     public void setLPar(TLPar node)
00301     {
00302         if(_lPar_ != null)
00303         {
00304             _lPar_.parent(null);
00305         }
00306 
00307         if(node != null)
00308         {
00309             if(node.parent() != null)
00310             {
00311                 node.parent().removeChild(node);
00312             }
00313 
00314             node.parent(this);
00315         }
00316 
00317         _lPar_ = node;
00318     }
00319     public void setRPar(TRPar node)
00320     {
00321         if(_rPar_ != null)
00322         {
00323             _rPar_.parent(null);
00324         }
00325 
00326         if(node != null)
00327         {
00328             if(node.parent() != null)
00329             {
00330                 node.parent().removeChild(node);
00331             }
00332 
00333             node.parent(this);
00334         }
00335 
00336         _rPar_ = node;
00337     }
00338     public void setSuper(TSuper node)
00339     {
00340         if(_super_ != null)
00341         {
00342             _super_.parent(null);
00343         }
00344 
00345         if(node != null)
00346         {
00347             if(node.parent() != null)
00348             {
00349                 node.parent().removeChild(node);
00350             }
00351 
00352             node.parent(this);
00353         }
00354 
00355         _super_ = node;
00356     }
00357     public String toString()
00358     {
00359         return ""
00360             + toString(_super_)
00361             + toString(_dot_)
00362             + toString(_id_)
00363             + toString(_lPar_)
00364             + toString(_argumentList_)
00365             + toString(_rPar_);
00366     }
00367 }

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