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

APreAssertion.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 APreAssertion extends PAssertion
00043 {
00044     private TPre _pre_;
00045     private TId _id_;
00046     private TColon _colon_;
00047     private PExp exp;
00048     private TSemicolon _semicolon_;
00049     private final LinkedList _comment_ = new TypedLinkedList(new Comment_Cast());
00050 
00051     private class Comment_Cast implements Cast
00052     {
00053         public Object cast(Object o)
00054         {
00055             PComment node = (PComment) o;
00056 
00057             if((node.parent() != null) &&
00058                 (node.parent() != APreAssertion.this))
00059             {
00060                 node.parent().removeChild(node);
00061             }
00062 
00063             if((node.parent() == null) ||
00064                 (node.parent() != APreAssertion.this))
00065             {
00066                 node.parent(APreAssertion.this);
00067             }
00068 
00069             return node;
00070         }
00071     }
00072     public APreAssertion()
00073     {
00074     }
00075     public APreAssertion(
00076         TPre _pre_,
00077         TId _id_,
00078         TColon _colon_,
00079         TSemicolon _semicolon_,
00080         XPComment _comment_)
00081     {
00082         setPre(_pre_);
00083 
00084         setId(_id_);
00085 
00086         setColon(_colon_);
00087 
00088         setSemicolon(_semicolon_);
00089 
00090         if(_comment_ != null)
00091         {
00092             while(_comment_ instanceof X1PComment)
00093             {
00094                 this._comment_.addFirst(((X1PComment) _comment_).getPComment());
00095                 _comment_ = ((X1PComment) _comment_).getXPComment();
00096             }
00097             this._comment_.addFirst(((X2PComment) _comment_).getPComment());
00098         }
00099 
00100     }
00101     public APreAssertion(
00102         TPre _pre_,
00103         TId _id_,
00104         TColon _colon_,
00105         TSemicolon _semicolon_,
00106         List _comment_)
00107     {
00108         setPre(_pre_);
00109 
00110         setId(_id_);
00111 
00112         setColon(_colon_);
00113 
00114         setSemicolon(_semicolon_);
00115 
00116         {
00117             Object temp[] = _comment_.toArray();
00118             for(int i = 0; i < temp.length; i++)
00119             {
00120                 this._comment_.add(temp[i]);
00121             }
00122         }
00123 
00124     }
00125     public void apply(Switch sw)
00126     {
00127         ((Analysis) sw).caseAPreAssertion(this);
00128     }
00129     public Object clone()
00130     {
00131         return new APreAssertion(
00132             (TPre) cloneNode(_pre_),
00133             (TId) cloneNode(_id_),
00134             (TColon) cloneNode(_colon_),
00135             (TSemicolon) cloneNode(_semicolon_),
00136             cloneList(_comment_));
00137     }
00138     public TColon getColon()
00139     {
00140         return _colon_;
00141     }
00142     public LinkedList getComment()
00143     {
00144         return _comment_;
00145     }
00146 /**
00147  * 
00148  * @return edu.ksu.cis.bandera.jjjc.node.PExp
00149  */
00150 public edu.ksu.cis.bandera.jjjc.node.PExp getExp() {
00151     return exp;
00152 }
00153     public TId getId()
00154     {
00155         return _id_;
00156     }
00157     public TPre getPre()
00158     {
00159         return _pre_;
00160     }
00161     public TSemicolon getSemicolon()
00162     {
00163         return _semicolon_;
00164     }
00165     void removeChild(Node child)
00166     {
00167         if(_pre_ == child)
00168         {
00169             _pre_ = null;
00170             return;
00171         }
00172 
00173         if(_id_ == child)
00174         {
00175             _id_ = null;
00176             return;
00177         }
00178 
00179         if(_colon_ == child)
00180         {
00181             _colon_ = null;
00182             return;
00183         }
00184 
00185         if(_semicolon_ == child)
00186         {
00187             _semicolon_ = null;
00188             return;
00189         }
00190 
00191         if(_comment_.remove(child))
00192         {
00193             return;
00194         }
00195 
00196     }
00197     void replaceChild(Node oldChild, Node newChild)
00198     {
00199         if(_pre_ == oldChild)
00200         {
00201             setPre((TPre) newChild);
00202             return;
00203         }
00204 
00205         if(_id_ == oldChild)
00206         {
00207             setId((TId) newChild);
00208             return;
00209         }
00210 
00211         if(_colon_ == oldChild)
00212         {
00213             setColon((TColon) newChild);
00214             return;
00215         }
00216 
00217         if(_semicolon_ == oldChild)
00218         {
00219             setSemicolon((TSemicolon) newChild);
00220             return;
00221         }
00222 
00223         for(ListIterator i = _comment_.listIterator(); i.hasNext();)
00224         {
00225             if(i.next() == oldChild)
00226             {
00227                 if(newChild != null)
00228                 {
00229                     i.set(newChild);
00230                     oldChild.parent(null);
00231                     return;
00232                 }
00233 
00234                 i.remove();
00235                 oldChild.parent(null);
00236                 return;
00237             }
00238         }
00239 
00240     }
00241     public void setColon(TColon node)
00242     {
00243         if(_colon_ != null)
00244         {
00245             _colon_.parent(null);
00246         }
00247 
00248         if(node != null)
00249         {
00250             if(node.parent() != null)
00251             {
00252                 node.parent().removeChild(node);
00253             }
00254 
00255             node.parent(this);
00256         }
00257 
00258         _colon_ = node;
00259     }
00260     public void setComment(List list)
00261     {
00262         Object temp[] = list.toArray();
00263         for(int i = 0; i < temp.length; i++)
00264         {
00265             _comment_.add(temp[i]);
00266         }
00267     }
00268 /**
00269  * 
00270  * @param newExp edu.ksu.cis.bandera.jjjc.node.PExp
00271  */
00272 public void setExp(edu.ksu.cis.bandera.jjjc.node.PExp newExp) {
00273     exp = newExp;
00274 }
00275     public void setId(TId node)
00276     {
00277         if(_id_ != null)
00278         {
00279             _id_.parent(null);
00280         }
00281 
00282         if(node != null)
00283         {
00284             if(node.parent() != null)
00285             {
00286                 node.parent().removeChild(node);
00287             }
00288 
00289             node.parent(this);
00290         }
00291 
00292         _id_ = node;
00293     }
00294     public void setPre(TPre node)
00295     {
00296         if(_pre_ != null)
00297         {
00298             _pre_.parent(null);
00299         }
00300 
00301         if(node != null)
00302         {
00303             if(node.parent() != null)
00304             {
00305                 node.parent().removeChild(node);
00306             }
00307 
00308             node.parent(this);
00309         }
00310 
00311         _pre_ = node;
00312     }
00313     public void setSemicolon(TSemicolon node)
00314     {
00315         if(_semicolon_ != null)
00316         {
00317             _semicolon_.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         _semicolon_ = node;
00331     }
00332     public String toString()
00333     {
00334         return ""
00335             + toString(_pre_)
00336             + toString(_id_)
00337             + toString(_colon_)
00338             + toString(_semicolon_)
00339             + toString(_comment_);
00340     }
00341 }

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