001    /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.3 */
002    package AST;
003    
004    import java.util.*;
005    /**
006     * @ast node
007     * @declaredat /home/csz-naf/examples/StateMachine/spec/StateMachine.ast:7
008     * @production Declaration : {@link ASTNode};
009    
010     */
011    public abstract class Declaration extends ASTNode<ASTNode> implements Cloneable {
012      /**
013       * @apilevel internal
014       */
015      public Declaration clone() throws CloneNotSupportedException {
016        Declaration node = (Declaration) super.clone();
017        node.transitionOf_State_visited = null;
018        node.localLookup_String_visited = null;
019        node.lookupForward_String_visited = null;
020        node.theMachine_visited = false;
021        node.lookup_String_visited = null;
022        return node;
023      }
024      /**
025       * @aspect PrettyPrint
026       * @declaredat /home/csz-naf/examples/StateMachine/spec/PrettyPrint.jrag:12
027       */
028      public void pp() {}
029      /**
030       * @aspect PrintInfoAboutCycles
031       * @declaredat /home/csz-naf/examples/StateMachine/spec/PrintInfoAboutCycles.jrag:10
032       */
033      public void printInfoAboutCycles() {}
034      /**
035       * @aspect PrintReachable
036       * @declaredat /home/csz-naf/examples/StateMachine/spec/PrintReachable.jrag:8
037       */
038      public void printReachable() { }
039      /**
040       */
041      public Declaration() {
042        super();
043      }
044      /**
045       * Initializes the child array to the correct size.
046       * Initializes List and Opt nta children.
047       * @apilevel internal
048       * @ast method
049       */
050      public void init$Children() {
051      }
052      /**
053       * @apilevel low-level
054       */
055      protected int numChildren() {
056        return 0;
057      }
058      /**
059       * @apilevel low-level
060       */
061      public void flushCache() {
062        super.flushCache();
063        transitionOf_State_visited = null;
064        localLookup_String_visited = null;
065        lookupForward_String_visited = null;
066        theMachine_visited = false;
067        lookup_String_visited = null;
068      }
069      /**
070       * @apilevel internal
071       */
072      public void flushCollectionCache() {
073        super.flushCollectionCache();
074      }
075      /**
076       * @apilevel internal
077       */
078      protected java.util.Set transitionOf_State_visited;
079      /**
080       * @attribute syn
081       * @aspect Exercises
082       * @declaredat /home/csz-naf/examples/StateMachine/spec/Exercises.jrag:39
083       */
084      public Transition transitionOf(State s) {
085        Object _parameters = s;
086        if(transitionOf_State_visited == null) transitionOf_State_visited = new java.util.HashSet(4);
087        if (transitionOf_State_visited.contains(_parameters)) {
088          throw new RuntimeException("Circular definition of attr: transitionOf in class: org.jastadd.ast.AST.SynDecl");
089        }
090        transitionOf_State_visited.add(_parameters);
091        try {  return null;  }
092        finally {
093          transitionOf_State_visited.remove(_parameters);
094        }
095      }
096      /**
097       * @apilevel internal
098       */
099      protected java.util.Set localLookup_String_visited;
100      /**
101       * @attribute syn
102       * @aspect NameAnalysis
103       * @declaredat /home/csz-naf/examples/StateMachine/spec/NameAnalysis.jrag:18
104       */
105      public State localLookup(String label) {
106        Object _parameters = label;
107        if(localLookup_String_visited == null) localLookup_String_visited = new java.util.HashSet(4);
108        if (localLookup_String_visited.contains(_parameters)) {
109          throw new RuntimeException("Circular definition of attr: localLookup in class: org.jastadd.ast.AST.SynDecl");
110        }
111        localLookup_String_visited.add(_parameters);
112        try {  return null;  }
113        finally {
114          localLookup_String_visited.remove(_parameters);
115        }
116      }
117      /**
118       * @attribute inh
119       * @aspect Exercises
120       * @declaredat /home/csz-naf/examples/StateMachine/spec/Exercises.jrag:15
121       */
122      public State lookupForward(String label) {
123        Object _parameters = label;
124        if(lookupForward_String_visited == null) lookupForward_String_visited = new java.util.HashSet(4);
125        if (lookupForward_String_visited.contains(_parameters)) {
126          throw new RuntimeException("Circular definition of attr: lookupForward in class: org.jastadd.ast.AST.InhDecl");
127        }
128        lookupForward_String_visited.add(_parameters);
129        State lookupForward_String_value = getParent().Define_State_lookupForward(this, null, label);
130    
131        lookupForward_String_visited.remove(_parameters);
132        return lookupForward_String_value;
133      }
134      /**
135       * @apilevel internal
136       */
137      protected java.util.Set lookupForward_String_visited;
138      /**
139       * @attribute inh
140       * @aspect Exercises
141       * @declaredat /home/csz-naf/examples/StateMachine/spec/Exercises.jrag:72
142       */
143      public StateMachine theMachine() {
144        if (theMachine_visited) {
145          throw new RuntimeException("Circular definition of attr: theMachine in class: org.jastadd.ast.AST.InhDecl");
146        }
147        theMachine_visited = true;
148        StateMachine theMachine_value = getParent().Define_StateMachine_theMachine(this, null);
149    
150        theMachine_visited = false;
151        return theMachine_value;
152      }
153      /**
154       * @apilevel internal
155       */
156      protected boolean theMachine_visited = false;
157      /**
158       * @attribute inh
159       * @aspect NameAnalysis
160       * @declaredat /home/csz-naf/examples/StateMachine/spec/NameAnalysis.jrag:8
161       */
162      public State lookup(String label) {
163        Object _parameters = label;
164        if(lookup_String_visited == null) lookup_String_visited = new java.util.HashSet(4);
165        if (lookup_String_visited.contains(_parameters)) {
166          throw new RuntimeException("Circular definition of attr: lookup in class: org.jastadd.ast.AST.InhDecl");
167        }
168        lookup_String_visited.add(_parameters);
169        State lookup_String_value = getParent().Define_State_lookup(this, null, label);
170    
171        lookup_String_visited.remove(_parameters);
172        return lookup_String_value;
173      }
174      /**
175       * @apilevel internal
176       */
177      protected java.util.Set lookup_String_visited;
178    }