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

AAllocation.java

00001 package edu.ksu.cis.bandera.birp.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.birp.analysis.*;
00038 
00039 public final class AAllocation extends PAllocation
00040 {
00041     private PLhs _lhs_;
00042     private TAssign _assign_;
00043     private TNew _new_;
00044     private TId _id_;
00045     private PArraylength _arraylength_;
00046     private TSemicolon _semicolon_;
00047 
00048     public AAllocation()
00049     {
00050     }
00051     public AAllocation(
00052         PLhs _lhs_,
00053         TAssign _assign_,
00054         TNew _new_,
00055         TId _id_,
00056         PArraylength _arraylength_,
00057         TSemicolon _semicolon_)
00058     {
00059         setLhs(_lhs_);
00060 
00061         setAssign(_assign_);
00062 
00063         setNew(_new_);
00064 
00065         setId(_id_);
00066 
00067         setArraylength(_arraylength_);
00068 
00069         setSemicolon(_semicolon_);
00070 
00071     }
00072     public void apply(Switch sw)
00073     {
00074         ((Analysis) sw).caseAAllocation(this);
00075     }
00076     public Object clone()
00077     {
00078         return new AAllocation(
00079             (PLhs) cloneNode(_lhs_),
00080             (TAssign) cloneNode(_assign_),
00081             (TNew) cloneNode(_new_),
00082             (TId) cloneNode(_id_),
00083             (PArraylength) cloneNode(_arraylength_),
00084             (TSemicolon) cloneNode(_semicolon_));
00085     }
00086     public PArraylength getArraylength()
00087     {
00088         return _arraylength_;
00089     }
00090     public TAssign getAssign()
00091     {
00092         return _assign_;
00093     }
00094     public TId getId()
00095     {
00096         return _id_;
00097     }
00098     public PLhs getLhs()
00099     {
00100         return _lhs_;
00101     }
00102     public TNew getNew()
00103     {
00104         return _new_;
00105     }
00106     public TSemicolon getSemicolon()
00107     {
00108         return _semicolon_;
00109     }
00110     void removeChild(Node child)
00111     {
00112         if(_lhs_ == child)
00113         {
00114             _lhs_ = null;
00115             return;
00116         }
00117 
00118         if(_assign_ == child)
00119         {
00120             _assign_ = null;
00121             return;
00122         }
00123 
00124         if(_new_ == child)
00125         {
00126             _new_ = null;
00127             return;
00128         }
00129 
00130         if(_id_ == child)
00131         {
00132             _id_ = null;
00133             return;
00134         }
00135 
00136         if(_arraylength_ == child)
00137         {
00138             _arraylength_ = null;
00139             return;
00140         }
00141 
00142         if(_semicolon_ == child)
00143         {
00144             _semicolon_ = null;
00145             return;
00146         }
00147 
00148     }
00149     void replaceChild(Node oldChild, Node newChild)
00150     {
00151         if(_lhs_ == oldChild)
00152         {
00153             setLhs((PLhs) newChild);
00154             return;
00155         }
00156 
00157         if(_assign_ == oldChild)
00158         {
00159             setAssign((TAssign) newChild);
00160             return;
00161         }
00162 
00163         if(_new_ == oldChild)
00164         {
00165             setNew((TNew) newChild);
00166             return;
00167         }
00168 
00169         if(_id_ == oldChild)
00170         {
00171             setId((TId) newChild);
00172             return;
00173         }
00174 
00175         if(_arraylength_ == oldChild)
00176         {
00177             setArraylength((PArraylength) newChild);
00178             return;
00179         }
00180 
00181         if(_semicolon_ == oldChild)
00182         {
00183             setSemicolon((TSemicolon) newChild);
00184             return;
00185         }
00186 
00187     }
00188     public void setArraylength(PArraylength node)
00189     {
00190         if(_arraylength_ != null)
00191         {
00192             _arraylength_.parent(null);
00193         }
00194 
00195         if(node != null)
00196         {
00197             if(node.parent() != null)
00198             {
00199                 node.parent().removeChild(node);
00200             }
00201 
00202             node.parent(this);
00203         }
00204 
00205         _arraylength_ = node;
00206     }
00207     public void setAssign(TAssign node)
00208     {
00209         if(_assign_ != null)
00210         {
00211             _assign_.parent(null);
00212         }
00213 
00214         if(node != null)
00215         {
00216             if(node.parent() != null)
00217             {
00218                 node.parent().removeChild(node);
00219             }
00220 
00221             node.parent(this);
00222         }
00223 
00224         _assign_ = node;
00225     }
00226     public void setId(TId node)
00227     {
00228         if(_id_ != null)
00229         {
00230             _id_.parent(null);
00231         }
00232 
00233         if(node != null)
00234         {
00235             if(node.parent() != null)
00236             {
00237                 node.parent().removeChild(node);
00238             }
00239 
00240             node.parent(this);
00241         }
00242 
00243         _id_ = node;
00244     }
00245     public void setLhs(PLhs node)
00246     {
00247         if(_lhs_ != null)
00248         {
00249             _lhs_.parent(null);
00250         }
00251 
00252         if(node != null)
00253         {
00254             if(node.parent() != null)
00255             {
00256                 node.parent().removeChild(node);
00257             }
00258 
00259             node.parent(this);
00260         }
00261 
00262         _lhs_ = node;
00263     }
00264     public void setNew(TNew node)
00265     {
00266         if(_new_ != null)
00267         {
00268             _new_.parent(null);
00269         }
00270 
00271         if(node != null)
00272         {
00273             if(node.parent() != null)
00274             {
00275                 node.parent().removeChild(node);
00276             }
00277 
00278             node.parent(this);
00279         }
00280 
00281         _new_ = node;
00282     }
00283     public void setSemicolon(TSemicolon node)
00284     {
00285         if(_semicolon_ != null)
00286         {
00287             _semicolon_.parent(null);
00288         }
00289 
00290         if(node != null)
00291         {
00292             if(node.parent() != null)
00293             {
00294                 node.parent().removeChild(node);
00295             }
00296 
00297             node.parent(this);
00298         }
00299 
00300         _semicolon_ = node;
00301     }
00302     public String toString()
00303     {
00304         return ""
00305             + toString(_lhs_)
00306             + toString(_assign_)
00307             + toString(_new_)
00308             + toString(_id_)
00309             + toString(_arraylength_)
00310             + toString(_semicolon_);
00311     }
00312 }

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