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

AStrongCastExp.java

00001 package edu.ksu.cis.bandera.specification.predicate.node;
00002 
00003 /* This file was generated by SableCC (http://www.sable.mcgill.ca/sablecc/). */
00004 
00005 import java.util.*;
00006 import edu.ksu.cis.bandera.specification.predicate.analysis.*;
00007 
00008 public final class AStrongCastExp extends PExp
00009 {
00010     private TLParen _lParen_;
00011     private PName _type_;
00012     private final LinkedList _dim_ = new TypedLinkedList(new Dim_Cast());
00013     private TRParen _rParen_;
00014     private PExp _exp_;
00015 
00016     private class Dim_Cast implements Cast
00017     {
00018         public Object cast(Object o)
00019         {
00020             TDim node = (TDim) o;
00021 
00022             if((node.parent() != null) &&
00023                 (node.parent() != AStrongCastExp.this))
00024             {
00025                 node.parent().removeChild(node);
00026             }
00027 
00028             if((node.parent() == null) ||
00029                 (node.parent() != AStrongCastExp.this))
00030             {
00031                 node.parent(AStrongCastExp.this);
00032             }
00033 
00034             return node;
00035         }
00036     }
00037     public AStrongCastExp()
00038     {
00039     }
00040     public AStrongCastExp(
00041         TLParen _lParen_,
00042         PName _type_,
00043         XTDim _dim_,
00044         TRParen _rParen_,
00045         PExp _exp_)
00046     {
00047         setLParen(_lParen_);
00048 
00049         setType(_type_);
00050 
00051         if(_dim_ != null)
00052         {
00053             while(_dim_ instanceof X1TDim)
00054             {
00055                 this._dim_.addFirst(((X1TDim) _dim_).getTDim());
00056                 _dim_ = ((X1TDim) _dim_).getXTDim();
00057             }
00058             this._dim_.addFirst(((X2TDim) _dim_).getTDim());
00059         }
00060 
00061         setRParen(_rParen_);
00062 
00063         setExp(_exp_);
00064 
00065     }
00066     public AStrongCastExp(
00067         TLParen _lParen_,
00068         PName _type_,
00069         List _dim_,
00070         TRParen _rParen_,
00071         PExp _exp_)
00072     {
00073         setLParen(_lParen_);
00074 
00075         setType(_type_);
00076 
00077         {
00078             Object temp[] = _dim_.toArray();
00079             for(int i = 0; i < temp.length; i++)
00080             {
00081                 this._dim_.add(temp[i]);
00082             }
00083         }
00084 
00085         setRParen(_rParen_);
00086 
00087         setExp(_exp_);
00088 
00089     }
00090     public void apply(Switch sw)
00091     {
00092         ((Analysis) sw).caseAStrongCastExp(this);
00093     }
00094     public Object clone()
00095     {
00096         return new AStrongCastExp(
00097             (TLParen) cloneNode(_lParen_),
00098             (PName) cloneNode(_type_),
00099             cloneList(_dim_),
00100             (TRParen) cloneNode(_rParen_),
00101             (PExp) cloneNode(_exp_));
00102     }
00103     public LinkedList getDim()
00104     {
00105         return _dim_;
00106     }
00107     public PExp getExp()
00108     {
00109         return _exp_;
00110     }
00111     public TLParen getLParen()
00112     {
00113         return _lParen_;
00114     }
00115     public TRParen getRParen()
00116     {
00117         return _rParen_;
00118     }
00119     public PName getType()
00120     {
00121         return _type_;
00122     }
00123     void removeChild(Node child)
00124     {
00125         if(_lParen_ == child)
00126         {
00127             _lParen_ = null;
00128             return;
00129         }
00130 
00131         if(_type_ == child)
00132         {
00133             _type_ = null;
00134             return;
00135         }
00136 
00137         if(_dim_.remove(child))
00138         {
00139             return;
00140         }
00141 
00142         if(_rParen_ == child)
00143         {
00144             _rParen_ = null;
00145             return;
00146         }
00147 
00148         if(_exp_ == child)
00149         {
00150             _exp_ = null;
00151             return;
00152         }
00153 
00154     }
00155     void replaceChild(Node oldChild, Node newChild)
00156     {
00157         if(_lParen_ == oldChild)
00158         {
00159             setLParen((TLParen) newChild);
00160             return;
00161         }
00162 
00163         if(_type_ == oldChild)
00164         {
00165             setType((PName) newChild);
00166             return;
00167         }
00168 
00169         for(ListIterator i = _dim_.listIterator(); i.hasNext();)
00170         {
00171             if(i.next() == oldChild)
00172             {
00173                 if(newChild != null)
00174                 {
00175                     i.set(newChild);
00176                     oldChild.parent(null);
00177                     return;
00178                 }
00179 
00180                 i.remove();
00181                 oldChild.parent(null);
00182                 return;
00183             }
00184         }
00185 
00186         if(_rParen_ == oldChild)
00187         {
00188             setRParen((TRParen) newChild);
00189             return;
00190         }
00191 
00192         if(_exp_ == oldChild)
00193         {
00194             setExp((PExp) newChild);
00195             return;
00196         }
00197 
00198     }
00199     public void setDim(List list)
00200     {
00201         Object temp[] = list.toArray();
00202         for(int i = 0; i < temp.length; i++)
00203         {
00204             _dim_.add(temp[i]);
00205         }
00206     }
00207     public void setExp(PExp node)
00208     {
00209         if(_exp_ != null)
00210         {
00211             _exp_.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         _exp_ = node;
00225     }
00226     public void setLParen(TLParen node)
00227     {
00228         if(_lParen_ != null)
00229         {
00230             _lParen_.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         _lParen_ = node;
00244     }
00245     public void setRParen(TRParen node)
00246     {
00247         if(_rParen_ != null)
00248         {
00249             _rParen_.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         _rParen_ = node;
00263     }
00264     public void setType(PName node)
00265     {
00266         if(_type_ != null)
00267         {
00268             _type_.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         _type_ = node;
00282     }
00283     public String toString()
00284     {
00285         return ""
00286             + toString(_lParen_)
00287             + toString(_type_)
00288             + toString(_dim_)
00289             + toString(_rParen_)
00290             + toString(_exp_);
00291     }
00292 }

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