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 * @production ElementAnnotationValue : {@link ElementValue} ::= <span class="component">{@link Annotation}</span>; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.ast:12 017 */ 018 public class ElementAnnotationValue extends ElementValue implements Cloneable { 019 /** 020 * @apilevel low-level 021 */ 022 public void flushCache() { 023 } 024 /** 025 * @apilevel internal 026 */ 027 public void flushCollectionCache() { 028 } 029 /** 030 * @apilevel internal 031 */ 032 @SuppressWarnings({"unchecked", "cast"}) 033 public ElementAnnotationValue clone() throws CloneNotSupportedException { 034 ElementAnnotationValue node = (ElementAnnotationValue)super.clone(); 035 node.in$Circle(false); 036 node.is$Final(false); 037 return node; 038 } 039 /** 040 * @apilevel internal 041 */ 042 @SuppressWarnings({"unchecked", "cast"}) 043 public ElementAnnotationValue copy() { 044 045 try { 046 ElementAnnotationValue node = (ElementAnnotationValue) clone(); 047 node.parent = null; 048 if(children != null) 049 node.children = (ASTNode[]) children.clone(); 050 051 return node; 052 } catch (CloneNotSupportedException e) { 053 throw new Error("Error: clone not supported for " + getClass().getName()); 054 } 055 056 }/** 057 * Create a deep copy of the AST subtree at this node. 058 * The copy is dangling, i.e. has no parent. 059 * @return dangling copy of the subtree at this node 060 * @apilevel low-level 061 */ 062 @SuppressWarnings({"unchecked", "cast"}) 063 public ElementAnnotationValue fullCopy() { 064 065 ElementAnnotationValue tree = (ElementAnnotationValue) copy(); 066 if (children != null) { 067 for (int i = 0; i < children.length; ++i) { 068 069 ASTNode child = (ASTNode) children[i]; 070 if(child != null) { 071 child = child.fullCopy(); 072 tree.setChild(child, i); 073 } 074 } 075 } 076 return tree; 077 078 } /** 079 * @ast method 080 * @aspect Annotations 081 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.jrag:600 082 */ 083 public void toString(StringBuffer s) { 084 getAnnotation().toString(s); 085 } 086 /** 087 * @ast method 088 * @aspect AnnotationsCodegen 089 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/AnnotationsCodegen.jrag:220 090 */ 091 public void appendAsAttributeTo(Attribute buf) { 092 buf.u1('@'); 093 getAnnotation().appendAsAttributeTo(buf); 094 } 095 /** 096 * @ast method 097 * 098 */ 099 public ElementAnnotationValue() { 100 super(); 101 102 103 } 104 /** 105 * Initializes the child array to the correct size. 106 * Initializes List and Opt nta children. 107 * @apilevel internal 108 * @ast method 109 * @ast method 110 * 111 */ 112 public void init$Children() { 113 children = new ASTNode[1]; 114 } 115 /** 116 * @ast method 117 * 118 */ 119 public ElementAnnotationValue(Annotation p0) { 120 setChild(p0, 0); 121 } 122 /** 123 * @apilevel low-level 124 * @ast method 125 * 126 */ 127 protected int numChildren() { 128 return 1; 129 } 130 /** 131 * @apilevel internal 132 * @ast method 133 * 134 */ 135 public boolean mayHaveRewrite() { 136 return false; 137 } 138 /** 139 * Replaces the Annotation child. 140 * @param node The new node to replace the Annotation child. 141 * @apilevel high-level 142 * @ast method 143 * 144 */ 145 public void setAnnotation(Annotation node) { 146 setChild(node, 0); 147 } 148 /** 149 * Retrieves the Annotation child. 150 * @return The current node used as the Annotation child. 151 * @apilevel high-level 152 * @ast method 153 * 154 */ 155 public Annotation getAnnotation() { 156 return (Annotation)getChild(0); 157 } 158 /** 159 * Retrieves the Annotation child. 160 * <p><em>This method does not invoke AST transformations.</em></p> 161 * @return The current node used as the Annotation child. 162 * @apilevel low-level 163 * @ast method 164 * 165 */ 166 public Annotation getAnnotationNoTransform() { 167 return (Annotation)getChildNoTransform(0); 168 } 169 /** 170 * @attribute syn 171 * @aspect Annotations 172 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.jrag:475 173 */ 174 public boolean commensurateWithTypeDecl(TypeDecl type) { 175 ASTNode$State state = state(); 176 try { 177 return type() == type; 178 } 179 finally { 180 } 181 } 182 /** 183 * @attribute syn 184 * @aspect Annotations 185 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.jrag:510 186 */ 187 public TypeDecl type() { 188 ASTNode$State state = state(); 189 try { return getAnnotation().type(); } 190 finally { 191 } 192 } 193 /** 194 * @attribute inh 195 * @aspect Annotations 196 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.jrag:423 197 */ 198 @SuppressWarnings({"unchecked", "cast"}) 199 public Annotation lookupAnnotation(TypeDecl typeDecl) { 200 ASTNode$State state = state(); 201 Annotation lookupAnnotation_TypeDecl_value = getParent().Define_Annotation_lookupAnnotation(this, null, typeDecl); 202 return lookupAnnotation_TypeDecl_value; 203 } 204 /** 205 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.jrag:95 206 * @apilevel internal 207 */ 208 public boolean Define_boolean_mayUseAnnotationTarget(ASTNode caller, ASTNode child, String name) { 209 if(caller == getAnnotationNoTransform()) { 210 return true; 211 } 212 else { return getParent().Define_boolean_mayUseAnnotationTarget(this, caller, name); 213 } 214 } 215 /** 216 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Annotations.jrag:427 217 * @apilevel internal 218 */ 219 public Annotation Define_Annotation_lookupAnnotation(ASTNode caller, ASTNode child, TypeDecl typeDecl) { 220 if(caller == getAnnotationNoTransform()) { 221 return getAnnotation().type() == typeDecl ? getAnnotation() : lookupAnnotation(typeDecl); 222 } 223 else { return getParent().Define_Annotation_lookupAnnotation(this, caller, typeDecl); 224 } 225 } 226 /** 227 * @apilevel internal 228 */ 229 public ASTNode rewriteTo() { 230 return super.rewriteTo(); 231 } 232 }