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

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

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