001    /* This file was generated with JastAdd2 (http://jastadd.org) version R20130213 */
002    package AST;
003    
004    import java.util.HashSet;
005    import java.io.File;
006    import java.util.*;
007    import beaver.*;
008    import java.util.ArrayList;
009    import java.util.zip.*;
010    import java.io.*;
011    import java.io.FileNotFoundException;
012    import java.util.Collection;
013    
014    /**
015     * @production BoundFieldAccess : {@link VarAccess} ::= <span class="component">&lt;FieldDeclaration:FieldDeclaration&gt;</span>;
016     * @ast node
017     * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BoundNames.ast:6
018     */
019    public class BoundFieldAccess extends VarAccess implements Cloneable {
020      /**
021       * @apilevel low-level
022       */
023      public void flushCache() {
024      }
025      /**
026       * @apilevel internal
027       */
028      public void flushCollectionCache() {
029      }
030      /**
031       * @apilevel internal
032       */
033      @SuppressWarnings({"unchecked", "cast"})
034      public BoundFieldAccess clone() throws CloneNotSupportedException {
035        BoundFieldAccess node = (BoundFieldAccess)super.clone();
036        node.decl_computed = false;
037        node.decl_value = null;
038        node.in$Circle(false);
039        node.is$Final(false);
040        return node;
041      }
042    /**
043     * @apilevel internal
044     */
045      @SuppressWarnings({"unchecked", "cast"})
046    public BoundFieldAccess copy() {
047      
048      try {
049        BoundFieldAccess node = (BoundFieldAccess) clone();
050        node.parent = null;
051        if(children != null)
052          node.children = (ASTNode[]) children.clone();
053        
054        return node;
055      } catch (CloneNotSupportedException e) {
056        throw new Error("Error: clone not supported for " + getClass().getName());
057      }
058      
059    }/**
060     * Create a deep copy of the AST subtree at this node.
061     * The copy is dangling, i.e. has no parent.
062     * @return dangling copy of the subtree at this node
063     * @apilevel low-level
064     */
065      @SuppressWarnings({"unchecked", "cast"})
066    public BoundFieldAccess fullCopy() {
067      
068      BoundFieldAccess tree = (BoundFieldAccess) copy();
069      if (children != null) {
070        for (int i = 0; i < children.length; ++i) {
071          
072          ASTNode child = (ASTNode) children[i];
073          if(child != null) {
074            child = child.fullCopy();
075            tree.setChild(child, i);
076          }
077        }
078      }
079      return tree;
080      
081    }  /**
082       * @ast method 
083       * @aspect BoundNames
084       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BoundNames.jrag:68
085       */
086      public BoundFieldAccess(FieldDeclaration f) {
087        this(f.name(), f);
088      }
089      /**
090       * @ast method 
091       * @aspect BoundNames
092       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BoundNames.jrag:73
093       */
094      public boolean isExactVarAccess() {
095        return false;
096      }
097      /**
098       * @ast method 
099       * 
100       */
101      public BoundFieldAccess() {
102        super();
103    
104    
105      }
106      /**
107       * Initializes the child array to the correct size.
108       * Initializes List and Opt nta children.
109       * @apilevel internal
110       * @ast method
111       * @ast method 
112       * 
113       */
114      public void init$Children() {
115      }
116      /**
117       * @ast method 
118       * 
119       */
120      public BoundFieldAccess(String p0, FieldDeclaration p1) {
121        setID(p0);
122        setFieldDeclaration(p1);
123      }
124      /**
125       * @ast method 
126       * 
127       */
128      public BoundFieldAccess(beaver.Symbol p0, FieldDeclaration p1) {
129        setID(p0);
130        setFieldDeclaration(p1);
131      }
132      /**
133       * @apilevel low-level
134       * @ast method 
135       * 
136       */
137      protected int numChildren() {
138        return 0;
139      }
140      /**
141       * @apilevel internal
142       * @ast method 
143       * 
144       */
145      public boolean mayHaveRewrite() {
146        return false;
147      }
148      /**
149       * Replaces the lexeme ID.
150       * @param value The new value for the lexeme ID.
151       * @apilevel high-level
152       * @ast method 
153       * 
154       */
155      public void setID(String value) {
156        tokenString_ID = value;
157      }
158      /**
159       * JastAdd-internal setter for lexeme ID using the Beaver parser.
160       * @apilevel internal
161       * @ast method 
162       * 
163       */
164      public void setID(beaver.Symbol symbol) {
165        if(symbol.value != null && !(symbol.value instanceof String))
166          throw new UnsupportedOperationException("setID is only valid for String lexemes");
167        tokenString_ID = (String)symbol.value;
168        IDstart = symbol.getStart();
169        IDend = symbol.getEnd();
170      }
171      /**
172       * Retrieves the value for the lexeme ID.
173       * @return The value for the lexeme ID.
174       * @apilevel high-level
175       * @ast method 
176       * 
177       */
178      public String getID() {
179        return tokenString_ID != null ? tokenString_ID : "";
180      }
181      /**
182       * Replaces the lexeme FieldDeclaration.
183       * @param value The new value for the lexeme FieldDeclaration.
184       * @apilevel high-level
185       * @ast method 
186       * 
187       */
188      public void setFieldDeclaration(FieldDeclaration value) {
189        tokenFieldDeclaration_FieldDeclaration = value;
190      }
191      /**
192       * @apilevel internal
193       * @ast method 
194       * 
195       */
196      
197      /**
198       * @apilevel internal
199       */
200      protected FieldDeclaration tokenFieldDeclaration_FieldDeclaration;
201      /**
202       * Retrieves the value for the lexeme FieldDeclaration.
203       * @return The value for the lexeme FieldDeclaration.
204       * @apilevel high-level
205       * @ast method 
206       * 
207       */
208      public FieldDeclaration getFieldDeclaration() {
209        return tokenFieldDeclaration_FieldDeclaration;
210      }
211      /**
212       * @apilevel internal
213       */
214      protected boolean decl_computed = false;
215      /**
216       * @apilevel internal
217       */
218      protected Variable decl_value;
219      /**
220       * @attribute syn
221       * @aspect BoundNames
222       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BoundNames.jrag:72
223       */
224      @SuppressWarnings({"unchecked", "cast"})
225      public Variable decl() {
226        if(decl_computed) {
227          return decl_value;
228        }
229          ASTNode$State state = state();
230      int num = state.boundariesCrossed;
231      boolean isFinal = this.is$Final();
232        decl_value = decl_compute();
233      if(isFinal && num == state().boundariesCrossed){ decl_computed = true; }
234            return decl_value;
235      }
236      /**
237       * @apilevel internal
238       */
239      private Variable decl_compute() {  return getFieldDeclaration();  }
240      /**
241       * @apilevel internal
242       */
243      public ASTNode rewriteTo() {
244        return super.rewriteTo();
245      }
246    }