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

AFormat.java

00001 package edu.ksu.cis.bandera.specification.node;
00002 
00003 /* This file was generated by SableCC (http://www.sablecc.org/). */
00004 
00005 import java.util.*;
00006 import edu.ksu.cis.bandera.specification.analysis.*;
00007 
00008 public final class AFormat extends PFormat
00009 {
00010     private TDoubleQuote _quote1_;
00011     private final LinkedList _formatWord_ = new TypedLinkedList(new FormatWord_Cast());
00012     private TDoubleQuote _quote2_;
00013 
00014     private class FormatWord_Cast implements Cast
00015     {
00016         public Object cast(Object o)
00017         {
00018             PFormatWord node = (PFormatWord) o;
00019 
00020             if((node.parent() != null) &&
00021                 (node.parent() != AFormat.this))
00022             {
00023                 node.parent().removeChild(node);
00024             }
00025 
00026             if((node.parent() == null) ||
00027                 (node.parent() != AFormat.this))
00028             {
00029                 node.parent(AFormat.this);
00030             }
00031 
00032             return node;
00033         }
00034     }
00035     public AFormat()
00036     {
00037     }
00038     public AFormat(
00039         TDoubleQuote _quote1_,
00040         XPFormatWord _formatWord_,
00041         TDoubleQuote _quote2_)
00042     {
00043         setQuote1(_quote1_);
00044 
00045         if(_formatWord_ != null)
00046         {
00047             while(_formatWord_ instanceof X1PFormatWord)
00048             {
00049                 this._formatWord_.addFirst(((X1PFormatWord) _formatWord_).getPFormatWord());
00050                 _formatWord_ = ((X1PFormatWord) _formatWord_).getXPFormatWord();
00051             }
00052             this._formatWord_.addFirst(((X2PFormatWord) _formatWord_).getPFormatWord());
00053         }
00054 
00055         setQuote2(_quote2_);
00056 
00057     }
00058     public AFormat(
00059         TDoubleQuote _quote1_,
00060         List _formatWord_,
00061         TDoubleQuote _quote2_)
00062     {
00063         setQuote1(_quote1_);
00064 
00065         {
00066             this._formatWord_.clear();
00067             this._formatWord_.addAll(_formatWord_);
00068         }
00069 
00070         setQuote2(_quote2_);
00071 
00072     }
00073     public void apply(Switch sw)
00074     {
00075         ((Analysis) sw).caseAFormat(this);
00076     }
00077     public Object clone()
00078     {
00079         return new AFormat(
00080             (TDoubleQuote) cloneNode(_quote1_),
00081             cloneList(_formatWord_),
00082             (TDoubleQuote) cloneNode(_quote2_));
00083     }
00084     public LinkedList getFormatWord()
00085     {
00086         return _formatWord_;
00087     }
00088     public TDoubleQuote getQuote1()
00089     {
00090         return _quote1_;
00091     }
00092     public TDoubleQuote getQuote2()
00093     {
00094         return _quote2_;
00095     }
00096     void removeChild(Node child)
00097     {
00098         if(_quote1_ == child)
00099         {
00100             _quote1_ = null;
00101             return;
00102         }
00103 
00104         if(_formatWord_.remove(child))
00105         {
00106             return;
00107         }
00108 
00109         if(_quote2_ == child)
00110         {
00111             _quote2_ = null;
00112             return;
00113         }
00114 
00115     }
00116     void replaceChild(Node oldChild, Node newChild)
00117     {
00118         if(_quote1_ == oldChild)
00119         {
00120             setQuote1((TDoubleQuote) newChild);
00121             return;
00122         }
00123 
00124         for(ListIterator i = _formatWord_.listIterator(); i.hasNext();)
00125         {
00126             if(i.next() == oldChild)
00127             {
00128                 if(newChild != null)
00129                 {
00130                     i.set(newChild);
00131                     oldChild.parent(null);
00132                     return;
00133                 }
00134 
00135                 i.remove();
00136                 oldChild.parent(null);
00137                 return;
00138             }
00139         }
00140 
00141         if(_quote2_ == oldChild)
00142         {
00143             setQuote2((TDoubleQuote) newChild);
00144             return;
00145         }
00146 
00147     }
00148     public void setFormatWord(List list)
00149     {
00150         _formatWord_.clear();
00151         _formatWord_.addAll(list);
00152     }
00153     public void setQuote1(TDoubleQuote node)
00154     {
00155         if(_quote1_ != null)
00156         {
00157             _quote1_.parent(null);
00158         }
00159 
00160         if(node != null)
00161         {
00162             if(node.parent() != null)
00163             {
00164                 node.parent().removeChild(node);
00165             }
00166 
00167             node.parent(this);
00168         }
00169 
00170         _quote1_ = node;
00171     }
00172     public void setQuote2(TDoubleQuote node)
00173     {
00174         if(_quote2_ != null)
00175         {
00176             _quote2_.parent(null);
00177         }
00178 
00179         if(node != null)
00180         {
00181             if(node.parent() != null)
00182             {
00183                 node.parent().removeChild(node);
00184             }
00185 
00186             node.parent(this);
00187         }
00188 
00189         _quote2_ = node;
00190     }
00191     public String toString()
00192     {
00193         return ""
00194             + toString(_quote1_)
00195             + toString(_formatWord_)
00196             + toString(_quote2_);
00197     }
00198 }

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