001 package AST; 002 003 import java.util.HashSet; 004 import java.io.File; 005 import java.util.*; 006 import beaver.*; 007 import java.util.ArrayList; 008 import java.util.zip.*; 009 import java.io.*; 010 import java.io.FileNotFoundException; 011 import java.util.Collection; 012 /** 013 * @apilevel internal 014 * @ast class 015 * 016 */ 017 public class ASTNode$State extends java.lang.Object { 018 019 /** 020 * @apilevel internal 021 */ 022 public boolean IN_CIRCLE = false; 023 024 025 /** 026 * @apilevel internal 027 */ 028 public int CIRCLE_INDEX = 1; 029 030 031 /** 032 * @apilevel internal 033 */ 034 public boolean CHANGE = false; 035 036 037 /** 038 * @apilevel internal 039 */ 040 public boolean RESET_CYCLE = false; 041 042 043 /** 044 * @apilevel internal 045 */ 046 static public class CircularValue { 047 Object value; 048 int visited = -1; 049 } 050 051 052 public static final int REWRITE_CHANGE = 1; 053 054 055 public static final int REWRITE_NOCHANGE = 2; 056 057 058 public static final int REWRITE_INTERRUPT = 3; 059 060 061 public int boundariesCrossed = 0; 062 063 064 065 private int[] stack; 066 067 068 private int pos; 069 070 071 public ASTNode$State() { 072 stack = new int[64]; 073 pos = 0; 074 } 075 076 077 private void ensureSize(int size) { 078 if(size < stack.length) 079 return; 080 int[] newStack = new int[stack.length * 2]; 081 System.arraycopy(stack, 0, newStack, 0, stack.length); 082 stack = newStack; 083 } 084 085 086 public void push(int i) { 087 ensureSize(pos+1); 088 stack[pos++] = i; 089 } 090 091 092 public int pop() { 093 return stack[--pos]; 094 } 095 096 097 public int peek() { 098 return stack[pos-1]; 099 } 100 101 102 /** 103 * @apilevel internal 104 */ 105 static class IdentityHashSet extends java.util.AbstractSet implements java.util.Set { 106 public IdentityHashSet(int initialCapacity) { 107 map = new java.util.IdentityHashMap(initialCapacity); 108 } 109 private java.util.IdentityHashMap map; 110 private static final Object PRESENT = new Object(); 111 public java.util.Iterator iterator() { return map.keySet().iterator(); } 112 public int size() { return map.size(); } 113 public boolean isEmpty() { return map.isEmpty(); } 114 public boolean contains(Object o) { return map.containsKey(o); } 115 public boolean add(Object o) { return map.put(o, PRESENT)==null; } 116 public boolean remove(Object o) { return map.remove(o)==PRESENT; } 117 public void clear() { map.clear(); } 118 } 119 120 121 public Options options = new Options(); 122 123 124 public int replacePos = 0; 125 126 127 protected int duringImplicitConstructor = 0; 128 129 130 protected int duringBoundNames = 0; 131 132 133 protected int duringNameResolution = 0; 134 135 136 protected int duringSyntacticClassification = 0; 137 138 139 protected int duringAnonymousClasses = 0; 140 141 142 protected int duringVariableDeclarationTransformation = 0; 143 144 145 protected int duringLiterals = 0; 146 147 148 protected int duringDU = 0; 149 150 151 protected int duringAnnotations = 0; 152 153 154 protected int duringEnums = 0; 155 156 157 protected int duringGenericTypeVariables = 0; 158 159 public void reset() { 160 IN_CIRCLE = false; 161 CIRCLE_INDEX = 1; 162 CHANGE = false; 163 boundariesCrossed = 0; 164 if(duringImplicitConstructor != 0) { 165 System.out.println("Warning: resetting duringImplicitConstructor"); 166 duringImplicitConstructor = 0; 167 } 168 if(duringBoundNames != 0) { 169 System.out.println("Warning: resetting duringBoundNames"); 170 duringBoundNames = 0; 171 } 172 if(duringNameResolution != 0) { 173 System.out.println("Warning: resetting duringNameResolution"); 174 duringNameResolution = 0; 175 } 176 if(duringSyntacticClassification != 0) { 177 System.out.println("Warning: resetting duringSyntacticClassification"); 178 duringSyntacticClassification = 0; 179 } 180 if(duringAnonymousClasses != 0) { 181 System.out.println("Warning: resetting duringAnonymousClasses"); 182 duringAnonymousClasses = 0; 183 } 184 if(duringVariableDeclarationTransformation != 0) { 185 System.out.println("Warning: resetting duringVariableDeclarationTransformation"); 186 duringVariableDeclarationTransformation = 0; 187 } 188 if(duringLiterals != 0) { 189 System.out.println("Warning: resetting duringLiterals"); 190 duringLiterals = 0; 191 } 192 if(duringDU != 0) { 193 System.out.println("Warning: resetting duringDU"); 194 duringDU = 0; 195 } 196 if(duringAnnotations != 0) { 197 System.out.println("Warning: resetting duringAnnotations"); 198 duringAnnotations = 0; 199 } 200 if(duringEnums != 0) { 201 System.out.println("Warning: resetting duringEnums"); 202 duringEnums = 0; 203 } 204 if(duringGenericTypeVariables != 0) { 205 System.out.println("Warning: resetting duringGenericTypeVariables"); 206 duringGenericTypeVariables = 0; 207 } 208 } 209 210 211 }