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

AParamParams.java

00001 package edu.ksu.cis.bandera.abstraction.options.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.options.analysis.*;
00040 
00041 public final class AParamParams extends PParams
00042 {
00043     private PName _name_;
00044     private final LinkedList _dim_ = new TypedLinkedList(new Dim_Cast());
00045 
00046     private class Dim_Cast implements Cast
00047     {
00048         public Object cast(Object o)
00049         {
00050             TDim node = (TDim) o;
00051 
00052             if((node.parent() != null) &&
00053                 (node.parent() != AParamParams.this))
00054             {
00055                 node.parent().removeChild(node);
00056             }
00057 
00058             if((node.parent() == null) ||
00059                 (node.parent() != AParamParams.this))
00060             {
00061                 node.parent(AParamParams.this);
00062             }
00063 
00064             return node;
00065         }
00066     }
00067     public AParamParams()
00068     {
00069     }
00070     public AParamParams(
00071         PName _name_,
00072         XTDim _dim_)
00073     {
00074         setName(_name_);
00075 
00076         if(_dim_ != null)
00077         {
00078             while(_dim_ instanceof X1TDim)
00079             {
00080                 this._dim_.addFirst(((X1TDim) _dim_).getTDim());
00081                 _dim_ = ((X1TDim) _dim_).getXTDim();
00082             }
00083             this._dim_.addFirst(((X2TDim) _dim_).getTDim());
00084         }
00085 
00086     }
00087     public AParamParams(
00088         PName _name_,
00089         List _dim_)
00090     {
00091         setName(_name_);
00092 
00093         {
00094             Object temp[] = _dim_.toArray();
00095             for(int i = 0; i < temp.length; i++)
00096             {
00097                 this._dim_.add(temp[i]);
00098             }
00099         }
00100 
00101     }
00102     public void apply(Switch sw)
00103     {
00104         ((Analysis) sw).caseAParamParams(this);
00105     }
00106     public Object clone()
00107     {
00108         return new AParamParams(
00109             (PName) cloneNode(_name_),
00110             cloneList(_dim_));
00111     }
00112     public LinkedList getDim()
00113     {
00114         return _dim_;
00115     }
00116     public PName getName()
00117     {
00118         return _name_;
00119     }
00120     void removeChild(Node child)
00121     {
00122         if(_name_ == child)
00123         {
00124             _name_ = null;
00125             return;
00126         }
00127 
00128         if(_dim_.remove(child))
00129         {
00130             return;
00131         }
00132 
00133     }
00134     void replaceChild(Node oldChild, Node newChild)
00135     {
00136         if(_name_ == oldChild)
00137         {
00138             setName((PName) newChild);
00139             return;
00140         }
00141 
00142         for(ListIterator i = _dim_.listIterator(); i.hasNext();)
00143         {
00144             if(i.next() == oldChild)
00145             {
00146                 if(newChild != null)
00147                 {
00148                     i.set(newChild);
00149                     oldChild.parent(null);
00150                     return;
00151                 }
00152 
00153                 i.remove();
00154                 oldChild.parent(null);
00155                 return;
00156             }
00157         }
00158 
00159     }
00160     public void setDim(List list)
00161     {
00162         Object temp[] = list.toArray();
00163         for(int i = 0; i < temp.length; i++)
00164         {
00165             _dim_.add(temp[i]);
00166         }
00167     }
00168     public void setName(PName node)
00169     {
00170         if(_name_ != null)
00171         {
00172             _name_.parent(null);
00173         }
00174 
00175         if(node != null)
00176         {
00177             if(node.parent() != null)
00178             {
00179                 node.parent().removeChild(node);
00180             }
00181 
00182             node.parent(this);
00183         }
00184 
00185         _name_ = node;
00186     }
00187     public String toString()
00188     {
00189         return ""
00190             + toString(_name_)
00191             + toString(_dim_);
00192     }
00193 }

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