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

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

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