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

ALocationAssertion.java

00001 package edu.ksu.cis.bandera.specification.assertion.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.specification.assertion.analysis.*;
00040 import edu.ksu.cis.bandera.jjjc.node.*;
00041 
00042 public final class ALocationAssertion extends PAssertion
00043 {
00044     private TLocation _location_;
00045     private TLBracket _lBracket_;
00046     private TId _label_;
00047     private TRBracket _rBracket_;
00048     private TId _id_;
00049     private TColon _colon_;
00050     private PExp exp;
00051     private TSemicolon _semicolon_;
00052     private final LinkedList _comment_ = new TypedLinkedList(new Comment_Cast());
00053 
00054     private class Comment_Cast implements Cast
00055     {
00056         public Object cast(Object o)
00057         {
00058             PComment node = (PComment) o;
00059 
00060             if((node.parent() != null) &&
00061                 (node.parent() != ALocationAssertion.this))
00062             {
00063                 node.parent().removeChild(node);
00064             }
00065 
00066             if((node.parent() == null) ||
00067                 (node.parent() != ALocationAssertion.this))
00068             {
00069                 node.parent(ALocationAssertion.this);
00070             }
00071 
00072             return node;
00073         }
00074     }
00075     public ALocationAssertion()
00076     {
00077     }
00078     public ALocationAssertion(
00079         TLocation _location_,
00080         TLBracket _lBracket_,
00081         TId _label_,
00082         TRBracket _rBracket_,
00083         TId _id_,
00084         TColon _colon_,
00085         TSemicolon _semicolon_,
00086         XPComment _comment_)
00087     {
00088         setLocation(_location_);
00089 
00090         setLBracket(_lBracket_);
00091 
00092         setLabel(_label_);
00093 
00094         setRBracket(_rBracket_);
00095 
00096         setId(_id_);
00097 
00098         setColon(_colon_);
00099 
00100         setSemicolon(_semicolon_);
00101 
00102         if(_comment_ != null)
00103         {
00104             while(_comment_ instanceof X1PComment)
00105             {
00106                 this._comment_.addFirst(((X1PComment) _comment_).getPComment());
00107                 _comment_ = ((X1PComment) _comment_).getXPComment();
00108             }
00109             this._comment_.addFirst(((X2PComment) _comment_).getPComment());
00110         }
00111 
00112     }
00113     public ALocationAssertion(
00114         TLocation _location_,
00115         TLBracket _lBracket_,
00116         TId _label_,
00117         TRBracket _rBracket_,
00118         TId _id_,
00119         TColon _colon_,
00120         TSemicolon _semicolon_,
00121         List _comment_)
00122     {
00123         setLocation(_location_);
00124 
00125         setLBracket(_lBracket_);
00126 
00127         setLabel(_label_);
00128 
00129         setRBracket(_rBracket_);
00130 
00131         setId(_id_);
00132 
00133         setColon(_colon_);
00134 
00135         setSemicolon(_semicolon_);
00136 
00137         {
00138             Object temp[] = _comment_.toArray();
00139             for(int i = 0; i < temp.length; i++)
00140             {
00141                 this._comment_.add(temp[i]);
00142             }
00143         }
00144 
00145     }
00146     public void apply(Switch sw)
00147     {
00148         ((Analysis) sw).caseALocationAssertion(this);
00149     }
00150     public Object clone()
00151     {
00152         return new ALocationAssertion(
00153             (TLocation) cloneNode(_location_),
00154             (TLBracket) cloneNode(_lBracket_),
00155             (TId) cloneNode(_label_),
00156             (TRBracket) cloneNode(_rBracket_),
00157             (TId) cloneNode(_id_),
00158             (TColon) cloneNode(_colon_),
00159             (TSemicolon) cloneNode(_semicolon_),
00160             cloneList(_comment_));
00161     }
00162     public TColon getColon()
00163     {
00164         return _colon_;
00165     }
00166     public LinkedList getComment()
00167     {
00168         return _comment_;
00169     }
00170 /**
00171  * 
00172  * @return edu.ksu.cis.bandera.jjjc.node.PExp
00173  */
00174 public edu.ksu.cis.bandera.jjjc.node.PExp getExp() {
00175     return exp;
00176 }
00177     public TId getId()
00178     {
00179         return _id_;
00180     }
00181     public TId getLabel()
00182     {
00183         return _label_;
00184     }
00185     public TLBracket getLBracket()
00186     {
00187         return _lBracket_;
00188     }
00189     public TLocation getLocation()
00190     {
00191         return _location_;
00192     }
00193     public TRBracket getRBracket()
00194     {
00195         return _rBracket_;
00196     }
00197     public TSemicolon getSemicolon()
00198     {
00199         return _semicolon_;
00200     }
00201     void removeChild(Node child)
00202     {
00203         if(_location_ == child)
00204         {
00205             _location_ = null;
00206             return;
00207         }
00208 
00209         if(_lBracket_ == child)
00210         {
00211             _lBracket_ = null;
00212             return;
00213         }
00214 
00215         if(_label_ == child)
00216         {
00217             _label_ = null;
00218             return;
00219         }
00220 
00221         if(_rBracket_ == child)
00222         {
00223             _rBracket_ = null;
00224             return;
00225         }
00226 
00227         if(_id_ == child)
00228         {
00229             _id_ = null;
00230             return;
00231         }
00232 
00233         if(_colon_ == child)
00234         {
00235             _colon_ = null;
00236             return;
00237         }
00238 
00239         if(_semicolon_ == child)
00240         {
00241             _semicolon_ = null;
00242             return;
00243         }
00244 
00245         if(_comment_.remove(child))
00246         {
00247             return;
00248         }
00249 
00250     }
00251     void replaceChild(Node oldChild, Node newChild)
00252     {
00253         if(_location_ == oldChild)
00254         {
00255             setLocation((TLocation) newChild);
00256             return;
00257         }
00258 
00259         if(_lBracket_ == oldChild)
00260         {
00261             setLBracket((TLBracket) newChild);
00262             return;
00263         }
00264 
00265         if(_label_ == oldChild)
00266         {
00267             setLabel((TId) newChild);
00268             return;
00269         }
00270 
00271         if(_rBracket_ == oldChild)
00272         {
00273             setRBracket((TRBracket) newChild);
00274             return;
00275         }
00276 
00277         if(_id_ == oldChild)
00278         {
00279             setId((TId) newChild);
00280             return;
00281         }
00282 
00283         if(_colon_ == oldChild)
00284         {
00285             setColon((TColon) newChild);
00286             return;
00287         }
00288 
00289         if(_semicolon_ == oldChild)
00290         {
00291             setSemicolon((TSemicolon) newChild);
00292             return;
00293         }
00294 
00295         for(ListIterator i = _comment_.listIterator(); i.hasNext();)
00296         {
00297             if(i.next() == oldChild)
00298             {
00299                 if(newChild != null)
00300                 {
00301                     i.set(newChild);
00302                     oldChild.parent(null);
00303                     return;
00304                 }
00305 
00306                 i.remove();
00307                 oldChild.parent(null);
00308                 return;
00309             }
00310         }
00311 
00312     }
00313     public void setColon(TColon node)
00314     {
00315         if(_colon_ != null)
00316         {
00317             _colon_.parent(null);
00318         }
00319 
00320         if(node != null)
00321         {
00322             if(node.parent() != null)
00323             {
00324                 node.parent().removeChild(node);
00325             }
00326 
00327             node.parent(this);
00328         }
00329 
00330         _colon_ = node;
00331     }
00332     public void setComment(List list)
00333     {
00334         Object temp[] = list.toArray();
00335         for(int i = 0; i < temp.length; i++)
00336         {
00337             _comment_.add(temp[i]);
00338         }
00339     }
00340 /**
00341  * 
00342  * @param newExp edu.ksu.cis.bandera.jjjc.node.PExp
00343  */
00344 public void setExp(edu.ksu.cis.bandera.jjjc.node.PExp newExp) {
00345     exp = newExp;
00346 }
00347     public void setId(TId node)
00348     {
00349         if(_id_ != null)
00350         {
00351             _id_.parent(null);
00352         }
00353 
00354         if(node != null)
00355         {
00356             if(node.parent() != null)
00357             {
00358                 node.parent().removeChild(node);
00359             }
00360 
00361             node.parent(this);
00362         }
00363 
00364         _id_ = node;
00365     }
00366     public void setLabel(TId node)
00367     {
00368         if(_label_ != null)
00369         {
00370             _label_.parent(null);
00371         }
00372 
00373         if(node != null)
00374         {
00375             if(node.parent() != null)
00376             {
00377                 node.parent().removeChild(node);
00378             }
00379 
00380             node.parent(this);
00381         }
00382 
00383         _label_ = node;
00384     }
00385     public void setLBracket(TLBracket node)
00386     {
00387         if(_lBracket_ != null)
00388         {
00389             _lBracket_.parent(null);
00390         }
00391 
00392         if(node != null)
00393         {
00394             if(node.parent() != null)
00395             {
00396                 node.parent().removeChild(node);
00397             }
00398 
00399             node.parent(this);
00400         }
00401 
00402         _lBracket_ = node;
00403     }
00404     public void setLocation(TLocation node)
00405     {
00406         if(_location_ != null)
00407         {
00408             _location_.parent(null);
00409         }
00410 
00411         if(node != null)
00412         {
00413             if(node.parent() != null)
00414             {
00415                 node.parent().removeChild(node);
00416             }
00417 
00418             node.parent(this);
00419         }
00420 
00421         _location_ = node;
00422     }
00423     public void setRBracket(TRBracket node)
00424     {
00425         if(_rBracket_ != null)
00426         {
00427             _rBracket_.parent(null);
00428         }
00429 
00430         if(node != null)
00431         {
00432             if(node.parent() != null)
00433             {
00434                 node.parent().removeChild(node);
00435             }
00436 
00437             node.parent(this);
00438         }
00439 
00440         _rBracket_ = node;
00441     }
00442     public void setSemicolon(TSemicolon node)
00443     {
00444         if(_semicolon_ != null)
00445         {
00446             _semicolon_.parent(null);
00447         }
00448 
00449         if(node != null)
00450         {
00451             if(node.parent() != null)
00452             {
00453                 node.parent().removeChild(node);
00454             }
00455 
00456             node.parent(this);
00457         }
00458 
00459         _semicolon_ = node;
00460     }
00461     public String toString()
00462     {
00463         return ""
00464             + toString(_location_)
00465             + toString(_lBracket_)
00466             + toString(_label_)
00467             + toString(_rBracket_)
00468             + toString(_id_)
00469             + toString(_colon_)
00470             + toString(_semicolon_)
00471             + toString(_comment_);
00472     }
00473 }

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