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

AUnit.java

00001 package edu.ksu.cis.bandera.abstraction.specification.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 /* This file was generated by SableCC (http://www.sable.mcgill.ca/sablecc/). */
00037 
00038 import java.util.*;
00039 import edu.ksu.cis.bandera.abstraction.specification.analysis.*;
00040 
00041 public final class AUnit extends PUnit
00042 {
00043     private TAbstraction _abstraction_;
00044     private TId _id_;
00045     private TExtends _extends_;
00046     private PType _type_;
00047     private TBegin _begin_;
00048     private PTokenSet _tokenSet_;
00049     private PDefaultToken _defaultToken_;
00050     private POne2oneSet _one2oneSet_;
00051     private PAbstractFunction _abstractFunction_;
00052     private final LinkedList _operatorTest_ = new TypedLinkedList(new OperatorTest_Cast());
00053     private TEnd _end_;
00054 
00055     private class OperatorTest_Cast implements Cast
00056     {
00057         public Object cast(Object o)
00058         {
00059             POperatorTest node = (POperatorTest) o;
00060 
00061             if((node.parent() != null) &&
00062                 (node.parent() != AUnit.this))
00063             {
00064                 node.parent().removeChild(node);
00065             }
00066 
00067             if((node.parent() == null) ||
00068                 (node.parent() != AUnit.this))
00069             {
00070                 node.parent(AUnit.this);
00071             }
00072 
00073             return node;
00074         }
00075     }
00076     public AUnit()
00077     {
00078     }
00079     public AUnit(
00080         TAbstraction _abstraction_,
00081         TId _id_,
00082         TExtends _extends_,
00083         PType _type_,
00084         TBegin _begin_,
00085         PTokenSet _tokenSet_,
00086         PDefaultToken _defaultToken_,
00087         POne2oneSet _one2oneSet_,
00088         PAbstractFunction _abstractFunction_,
00089         XPOperatorTest _operatorTest_,
00090         TEnd _end_)
00091     {
00092         setAbstraction(_abstraction_);
00093 
00094         setId(_id_);
00095 
00096         setExtends(_extends_);
00097 
00098         setType(_type_);
00099 
00100         setBegin(_begin_);
00101 
00102         setTokenSet(_tokenSet_);
00103 
00104         setDefaultToken(_defaultToken_);
00105 
00106         setOne2oneSet(_one2oneSet_);
00107 
00108         setAbstractFunction(_abstractFunction_);
00109 
00110         if(_operatorTest_ != null)
00111         {
00112             while(_operatorTest_ instanceof X1POperatorTest)
00113             {
00114                 this._operatorTest_.addFirst(((X1POperatorTest) _operatorTest_).getPOperatorTest());
00115                 _operatorTest_ = ((X1POperatorTest) _operatorTest_).getXPOperatorTest();
00116             }
00117             this._operatorTest_.addFirst(((X2POperatorTest) _operatorTest_).getPOperatorTest());
00118         }
00119 
00120         setEnd(_end_);
00121 
00122     }
00123     public AUnit(
00124         TAbstraction _abstraction_,
00125         TId _id_,
00126         TExtends _extends_,
00127         PType _type_,
00128         TBegin _begin_,
00129         PTokenSet _tokenSet_,
00130         PDefaultToken _defaultToken_,
00131         POne2oneSet _one2oneSet_,
00132         PAbstractFunction _abstractFunction_,
00133         List _operatorTest_,
00134         TEnd _end_)
00135     {
00136         setAbstraction(_abstraction_);
00137 
00138         setId(_id_);
00139 
00140         setExtends(_extends_);
00141 
00142         setType(_type_);
00143 
00144         setBegin(_begin_);
00145 
00146         setTokenSet(_tokenSet_);
00147 
00148         setDefaultToken(_defaultToken_);
00149 
00150         setOne2oneSet(_one2oneSet_);
00151 
00152         setAbstractFunction(_abstractFunction_);
00153 
00154         {
00155             Object temp[] = _operatorTest_.toArray();
00156             for(int i = 0; i < temp.length; i++)
00157             {
00158                 this._operatorTest_.add(temp[i]);
00159             }
00160         }
00161 
00162         setEnd(_end_);
00163 
00164     }
00165     public void apply(Switch sw)
00166     {
00167         ((Analysis) sw).caseAUnit(this);
00168     }
00169     public Object clone()
00170     {
00171         return new AUnit(
00172             (TAbstraction) cloneNode(_abstraction_),
00173             (TId) cloneNode(_id_),
00174             (TExtends) cloneNode(_extends_),
00175             (PType) cloneNode(_type_),
00176             (TBegin) cloneNode(_begin_),
00177             (PTokenSet) cloneNode(_tokenSet_),
00178             (PDefaultToken) cloneNode(_defaultToken_),
00179             (POne2oneSet) cloneNode(_one2oneSet_),
00180             (PAbstractFunction) cloneNode(_abstractFunction_),
00181             cloneList(_operatorTest_),
00182             (TEnd) cloneNode(_end_));
00183     }
00184     public PAbstractFunction getAbstractFunction()
00185     {
00186         return _abstractFunction_;
00187     }
00188     public TAbstraction getAbstraction()
00189     {
00190         return _abstraction_;
00191     }
00192     public TBegin getBegin()
00193     {
00194         return _begin_;
00195     }
00196     public PDefaultToken getDefaultToken()
00197     {
00198         return _defaultToken_;
00199     }
00200     public TEnd getEnd()
00201     {
00202         return _end_;
00203     }
00204     public TExtends getExtends()
00205     {
00206         return _extends_;
00207     }
00208     public TId getId()
00209     {
00210         return _id_;
00211     }
00212     public POne2oneSet getOne2oneSet()
00213     {
00214         return _one2oneSet_;
00215     }
00216     public LinkedList getOperatorTest()
00217     {
00218         return _operatorTest_;
00219     }
00220     public PTokenSet getTokenSet()
00221     {
00222         return _tokenSet_;
00223     }
00224     public PType getType()
00225     {
00226         return _type_;
00227     }
00228     void removeChild(Node child)
00229     {
00230         if(_abstraction_ == child)
00231         {
00232             _abstraction_ = null;
00233             return;
00234         }
00235 
00236         if(_id_ == child)
00237         {
00238             _id_ = null;
00239             return;
00240         }
00241 
00242         if(_extends_ == child)
00243         {
00244             _extends_ = null;
00245             return;
00246         }
00247 
00248         if(_type_ == child)
00249         {
00250             _type_ = null;
00251             return;
00252         }
00253 
00254         if(_begin_ == child)
00255         {
00256             _begin_ = null;
00257             return;
00258         }
00259 
00260         if(_tokenSet_ == child)
00261         {
00262             _tokenSet_ = null;
00263             return;
00264         }
00265 
00266         if(_defaultToken_ == child)
00267         {
00268             _defaultToken_ = null;
00269             return;
00270         }
00271 
00272         if(_one2oneSet_ == child)
00273         {
00274             _one2oneSet_ = null;
00275             return;
00276         }
00277 
00278         if(_abstractFunction_ == child)
00279         {
00280             _abstractFunction_ = null;
00281             return;
00282         }
00283 
00284         if(_operatorTest_.remove(child))
00285         {
00286             return;
00287         }
00288 
00289         if(_end_ == child)
00290         {
00291             _end_ = null;
00292             return;
00293         }
00294 
00295     }
00296     void replaceChild(Node oldChild, Node newChild)
00297     {
00298         if(_abstraction_ == oldChild)
00299         {
00300             setAbstraction((TAbstraction) newChild);
00301             return;
00302         }
00303 
00304         if(_id_ == oldChild)
00305         {
00306             setId((TId) newChild);
00307             return;
00308         }
00309 
00310         if(_extends_ == oldChild)
00311         {
00312             setExtends((TExtends) newChild);
00313             return;
00314         }
00315 
00316         if(_type_ == oldChild)
00317         {
00318             setType((PType) newChild);
00319             return;
00320         }
00321 
00322         if(_begin_ == oldChild)
00323         {
00324             setBegin((TBegin) newChild);
00325             return;
00326         }
00327 
00328         if(_tokenSet_ == oldChild)
00329         {
00330             setTokenSet((PTokenSet) newChild);
00331             return;
00332         }
00333 
00334         if(_defaultToken_ == oldChild)
00335         {
00336             setDefaultToken((PDefaultToken) newChild);
00337             return;
00338         }
00339 
00340         if(_one2oneSet_ == oldChild)
00341         {
00342             setOne2oneSet((POne2oneSet) newChild);
00343             return;
00344         }
00345 
00346         if(_abstractFunction_ == oldChild)
00347         {
00348             setAbstractFunction((PAbstractFunction) newChild);
00349             return;
00350         }
00351 
00352         for(ListIterator i = _operatorTest_.listIterator(); i.hasNext();)
00353         {
00354             if(i.next() == oldChild)
00355             {
00356                 if(newChild != null)
00357                 {
00358                     i.set(newChild);
00359                     oldChild.parent(null);
00360                     return;
00361                 }
00362 
00363                 i.remove();
00364                 oldChild.parent(null);
00365                 return;
00366             }
00367         }
00368 
00369         if(_end_ == oldChild)
00370         {
00371             setEnd((TEnd) newChild);
00372             return;
00373         }
00374 
00375     }
00376     public void setAbstractFunction(PAbstractFunction node)
00377     {
00378         if(_abstractFunction_ != null)
00379         {
00380             _abstractFunction_.parent(null);
00381         }
00382 
00383         if(node != null)
00384         {
00385             if(node.parent() != null)
00386             {
00387                 node.parent().removeChild(node);
00388             }
00389 
00390             node.parent(this);
00391         }
00392 
00393         _abstractFunction_ = node;
00394     }
00395     public void setAbstraction(TAbstraction node)
00396     {
00397         if(_abstraction_ != null)
00398         {
00399             _abstraction_.parent(null);
00400         }
00401 
00402         if(node != null)
00403         {
00404             if(node.parent() != null)
00405             {
00406                 node.parent().removeChild(node);
00407             }
00408 
00409             node.parent(this);
00410         }
00411 
00412         _abstraction_ = node;
00413     }
00414     public void setBegin(TBegin node)
00415     {
00416         if(_begin_ != null)
00417         {
00418             _begin_.parent(null);
00419         }
00420 
00421         if(node != null)
00422         {
00423             if(node.parent() != null)
00424             {
00425                 node.parent().removeChild(node);
00426             }
00427 
00428             node.parent(this);
00429         }
00430 
00431         _begin_ = node;
00432     }
00433     public void setDefaultToken(PDefaultToken node)
00434     {
00435         if(_defaultToken_ != null)
00436         {
00437             _defaultToken_.parent(null);
00438         }
00439 
00440         if(node != null)
00441         {
00442             if(node.parent() != null)
00443             {
00444                 node.parent().removeChild(node);
00445             }
00446 
00447             node.parent(this);
00448         }
00449 
00450         _defaultToken_ = node;
00451     }
00452     public void setEnd(TEnd node)
00453     {
00454         if(_end_ != null)
00455         {
00456             _end_.parent(null);
00457         }
00458 
00459         if(node != null)
00460         {
00461             if(node.parent() != null)
00462             {
00463                 node.parent().removeChild(node);
00464             }
00465 
00466             node.parent(this);
00467         }
00468 
00469         _end_ = node;
00470     }
00471     public void setExtends(TExtends node)
00472     {
00473         if(_extends_ != null)
00474         {
00475             _extends_.parent(null);
00476         }
00477 
00478         if(node != null)
00479         {
00480             if(node.parent() != null)
00481             {
00482                 node.parent().removeChild(node);
00483             }
00484 
00485             node.parent(this);
00486         }
00487 
00488         _extends_ = node;
00489     }
00490     public void setId(TId node)
00491     {
00492         if(_id_ != null)
00493         {
00494             _id_.parent(null);
00495         }
00496 
00497         if(node != null)
00498         {
00499             if(node.parent() != null)
00500             {
00501                 node.parent().removeChild(node);
00502             }
00503 
00504             node.parent(this);
00505         }
00506 
00507         _id_ = node;
00508     }
00509     public void setOne2oneSet(POne2oneSet node)
00510     {
00511         if(_one2oneSet_ != null)
00512         {
00513             _one2oneSet_.parent(null);
00514         }
00515 
00516         if(node != null)
00517         {
00518             if(node.parent() != null)
00519             {
00520                 node.parent().removeChild(node);
00521             }
00522 
00523             node.parent(this);
00524         }
00525 
00526         _one2oneSet_ = node;
00527     }
00528     public void setOperatorTest(List list)
00529     {
00530         Object temp[] = list.toArray();
00531         for(int i = 0; i < temp.length; i++)
00532         {
00533             _operatorTest_.add(temp[i]);
00534         }
00535     }
00536     public void setTokenSet(PTokenSet node)
00537     {
00538         if(_tokenSet_ != null)
00539         {
00540             _tokenSet_.parent(null);
00541         }
00542 
00543         if(node != null)
00544         {
00545             if(node.parent() != null)
00546             {
00547                 node.parent().removeChild(node);
00548             }
00549 
00550             node.parent(this);
00551         }
00552 
00553         _tokenSet_ = node;
00554     }
00555     public void setType(PType node)
00556     {
00557         if(_type_ != null)
00558         {
00559             _type_.parent(null);
00560         }
00561 
00562         if(node != null)
00563         {
00564             if(node.parent() != null)
00565             {
00566                 node.parent().removeChild(node);
00567             }
00568 
00569             node.parent(this);
00570         }
00571 
00572         _type_ = node;
00573     }
00574     public String toString()
00575     {
00576         return ""
00577             + toString(_abstraction_)
00578             + toString(_id_)
00579             + toString(_extends_)
00580             + toString(_type_)
00581             + toString(_begin_)
00582             + toString(_tokenSet_)
00583             + toString(_defaultToken_)
00584             + toString(_one2oneSet_)
00585             + toString(_abstractFunction_)
00586             + toString(_operatorTest_)
00587             + toString(_end_);
00588     }
00589 }

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