org.extendj.ast.EnumConstant Maven / Gradle / Ivy
/* This file was generated with JastAdd2 (http://jastadd.org) version 2.3.0 */
package org.extendj.ast;
import java.util.ArrayList;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.util.Set;
import beaver.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.LinkedHashSet;
import java.util.*;
import org.jastadd.util.PrettyPrintable;
import org.jastadd.util.PrettyPrinter;
import java.util.zip.*;
import java.io.*;
import org.jastadd.util.*;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
/**
* @ast node
* @declaredat /home/jesper/git/extendj/java5/grammar/Enums.ast:3
* @astdecl EnumConstant : BodyDecl ::= Modifiers Arg:Expr* [Init:Expr] TypeAccess:Access;
* @production EnumConstant : {@link BodyDecl} ::= {@link Modifiers} <ID:String> Arg:{@link Expr}* [Init:{@link Expr}] TypeAccess:{@link Access};
*/
public class EnumConstant extends BodyDecl implements Cloneable, Variable {
/**
* @aspect Java5PrettyPrint
* @declaredat /home/jesper/git/extendj/java5/frontend/PrettyPrint.jadd:107
*/
public void prettyPrint(PrettyPrinter out) {
out.print(getModifiers());
out.print(getID());
if (hasBodyDecl()) {
out.print("(");
out.join(getArgList(), new PrettyPrinter.Joiner() {
@Override
public void printSeparator(PrettyPrinter out) {
out.print(", ");
}
});
out.print(") {");
out.println();
out.indent(1);
out.join(getBodyDeclList(), new PrettyPrinter.Joiner() {
@Override
public void printSeparator(PrettyPrinter out) {
out.println();
out.println();
}
});
if (!out.isNewLine()) {
out.println();
}
out.print("}");
} else {
if (hasArg()) {
out.print("(");
out.join(getArgList(), new PrettyPrinter.Joiner() {
@Override
public void printSeparator(PrettyPrinter out) {
out.print(", ");
}
});
out.print(")");
}
}
}
/**
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:279
*/
public EnumConstant(Modifiers mods, String name, List args,
List bds) {
this(mods, name, args, new Opt(new EnumInstanceExpr(createOptAnonymousDecl(bds))));
}
/**
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:321
*/
private static Opt createOptAnonymousDecl(List bds) {
if (bds.getNumChildNoTransform() == 0) {
return new Opt();
}
return new Opt(
new AnonymousDecl(
new Modifiers(),
"Anonymous",
bds
)
);
}
/**
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:335
*/
public int getNumBodyDecl() {
int cnt = 0;
ClassInstanceExpr init = (ClassInstanceExpr) getInit();
if (!init.hasTypeDecl()) {
return 0;
}
for (BodyDecl bd : init.getTypeDecl().getBodyDecls()) {
if (!(bd instanceof ConstructorDecl)) {
++cnt;
}
}
return cnt;
}
/**
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:349
*/
public BodyDecl getBodyDecl(int i) {
ClassInstanceExpr init = (ClassInstanceExpr) getInit();
if (init.hasTypeDecl()) {
for (BodyDecl bd : init.getTypeDecl().getBodyDecls()) {
if (!(bd instanceof ConstructorDecl)) {
if (i-- == 0) {
return bd;
}
}
}
}
throw new ArrayIndexOutOfBoundsException(i);
}
/**
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:364
*/
public boolean hasBodyDecl() {
ClassInstanceExpr init = (ClassInstanceExpr) getInit();
if (init.hasTypeDecl()) {
return init.getTypeDecl().hasBodyDecl();
}
return false;
}
/**
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:373
*/
public List getBodyDeclList() {
ClassInstanceExpr init = (ClassInstanceExpr) getInit();
if (init.hasTypeDecl()) {
return init.getTypeDecl().getBodyDeclList();
}
throw new Error("Enum has no body decl list.");
}
/** Create an access to this field.
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:417
*/
public Access createBoundAccess() {
if (isStatic()) {
return hostType().createQualifiedAccess().qualifiesAccess(new BoundEnumConstant(this));
} else {
return new ThisAccess().qualifiesAccess(new BoundEnumConstant(this));
}
}
/**
* @aspect EnumsCodegen
* @declaredat /home/jesper/git/extendj/java5/backend/EnumsCodegen.jrag:294
*/
protected void emitInitializerBCode(CodeGeneration gen) {
getInit().createBCode(gen);
getInit().emitAssignConvTo(gen, type());
}
/**
* @aspect GenericsCodegen
* @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:119
*/
public void emitLoadVariable(CodeGeneration gen, Access access) {
access.createLoadQualifier(gen, this);
emitLoadField(gen, access.fieldQualifierType());
}
/** Generate bytecode to load this field.
* @aspect CodeGeneration
* @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:208
*/
public void emitLoadField(CodeGeneration gen, TypeDecl hostType) {
if (hostType().isArrayDecl() && name().equals("length")) {
gen.ARRAYLENGTH();
return;
}
String classname = hostType.constantPoolName();
String name = name();
int index = gen.constantPool().addFieldref(classname, name, type());
if (isStatic()) {
gen.GETSTATIC(index, type());
} else {
gen.GETFIELD(index, type());
}
}
/** Generate bytecode to store a field in the given hostType.
* @aspect CodeGeneration
* @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:270
*/
public void emitStoreField(CodeGeneration gen, TypeDecl hostType) {
String classname = hostType.constantPoolName();
String name = name();
int index = gen.constantPool().addFieldref(classname, name, type());
if (isStatic()) {
gen.PUTSTATIC(index);
} else {
gen.PUTFIELD(index);
}
}
/**
* @declaredat ASTNode:1
*/
public EnumConstant() {
super();
}
/**
* Initializes the child array to the correct size.
* Initializes List and Opt nta children.
* @apilevel internal
* @ast method
* @declaredat ASTNode:10
*/
public void init$Children() {
children = new ASTNode[4];
setChild(new List(), 1);
setChild(new Opt(), 2);
}
/**
* @declaredat ASTNode:15
*/
@ASTNodeAnnotation.Constructor(
name = {"Modifiers", "ID", "Arg", "Init"},
type = {"Modifiers", "String", "List", "Opt"},
kind = {"Child", "Token", "List", "Opt"}
)
public EnumConstant(Modifiers p0, String p1, List p2, Opt p3) {
setChild(p0, 0);
setID(p1);
setChild(p2, 1);
setChild(p3, 2);
}
/**
* @declaredat ASTNode:26
*/
public EnumConstant(Modifiers p0, beaver.Symbol p1, List p2, Opt p3) {
setChild(p0, 0);
setID(p1);
setChild(p2, 1);
setChild(p3, 2);
}
/** @apilevel low-level
* @declaredat ASTNode:33
*/
protected int numChildren() {
return 3;
}
/**
* @apilevel internal
* @declaredat ASTNode:39
*/
public boolean mayHaveRewrite() {
return false;
}
/** @apilevel internal
* @declaredat ASTNode:43
*/
public void flushAttrCache() {
super.flushAttrCache();
isEffectivelyFinal_reset();
throwTypes_reset();
getTypeAccess_reset();
localMethodsSignatureMap_reset();
}
/** @apilevel internal
* @declaredat ASTNode:51
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:55
*/
public EnumConstant clone() throws CloneNotSupportedException {
EnumConstant node = (EnumConstant) super.clone();
return node;
}
/** @apilevel internal
* @declaredat ASTNode:60
*/
public EnumConstant copy() {
try {
EnumConstant node = (EnumConstant) clone();
node.parent = null;
if (children != null) {
node.children = (ASTNode[]) children.clone();
}
return node;
} catch (CloneNotSupportedException e) {
throw new Error("Error: clone not supported for " + getClass().getName());
}
}
/**
* Create a deep copy of the AST subtree at this node.
* The copy is dangling, i.e. has no parent.
* @return dangling copy of the subtree at this node
* @apilevel low-level
* @deprecated Please use treeCopy or treeCopyNoTransform instead
* @declaredat ASTNode:79
*/
@Deprecated
public EnumConstant fullCopy() {
return treeCopyNoTransform();
}
/**
* Create a deep copy of the AST subtree at this node.
* The copy is dangling, i.e. has no parent.
* @return dangling copy of the subtree at this node
* @apilevel low-level
* @declaredat ASTNode:89
*/
public EnumConstant treeCopyNoTransform() {
EnumConstant tree = (EnumConstant) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
switch (i) {
case 3:
tree.children[i] = null;
continue;
}
ASTNode child = (ASTNode) children[i];
if (child != null) {
child = child.treeCopyNoTransform();
tree.setChild(child, i);
}
}
}
return tree;
}
/**
* Create a deep copy of the AST subtree at this node.
* The subtree of this node is traversed to trigger rewrites before copy.
* The copy is dangling, i.e. has no parent.
* @return dangling copy of the subtree at this node
* @apilevel low-level
* @declaredat ASTNode:114
*/
public EnumConstant treeCopy() {
EnumConstant tree = (EnumConstant) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
switch (i) {
case 3:
tree.children[i] = null;
continue;
}
ASTNode child = (ASTNode) getChild(i);
if (child != null) {
child = child.treeCopy();
tree.setChild(child, i);
}
}
}
return tree;
}
/** @apilevel internal
* @declaredat ASTNode:133
*/
protected boolean is$Equal(ASTNode node) {
return super.is$Equal(node) && (tokenString_ID == ((EnumConstant) node).tokenString_ID);
}
/**
* Replaces the Modifiers child.
* @param node The new node to replace the Modifiers child.
* @apilevel high-level
*/
public void setModifiers(Modifiers node) {
setChild(node, 0);
}
/**
* Retrieves the Modifiers child.
* @return The current node used as the Modifiers child.
* @apilevel high-level
*/
@ASTNodeAnnotation.Child(name="Modifiers")
public Modifiers getModifiers() {
return (Modifiers) getChild(0);
}
/**
* Retrieves the Modifiers child.
* This method does not invoke AST transformations.
* @return The current node used as the Modifiers child.
* @apilevel low-level
*/
public Modifiers getModifiersNoTransform() {
return (Modifiers) getChildNoTransform(0);
}
/**
* Replaces the lexeme ID.
* @param value The new value for the lexeme ID.
* @apilevel high-level
*/
public void setID(String value) {
tokenString_ID = value;
}
/** @apilevel internal
*/
protected String tokenString_ID;
/**
*/
public int IDstart;
/**
*/
public int IDend;
/**
* JastAdd-internal setter for lexeme ID using the Beaver parser.
* @param symbol Symbol containing the new value for the lexeme ID
* @apilevel internal
*/
public void setID(beaver.Symbol symbol) {
if (symbol.value != null && !(symbol.value instanceof String))
throw new UnsupportedOperationException("setID is only valid for String lexemes");
tokenString_ID = (String)symbol.value;
IDstart = symbol.getStart();
IDend = symbol.getEnd();
}
/**
* Retrieves the value for the lexeme ID.
* @return The value for the lexeme ID.
* @apilevel high-level
*/
@ASTNodeAnnotation.Token(name="ID")
public String getID() {
return tokenString_ID != null ? tokenString_ID : "";
}
/**
* Replaces the Arg list.
* @param list The new list node to be used as the Arg list.
* @apilevel high-level
*/
public void setArgList(List list) {
setChild(list, 1);
}
/**
* Retrieves the number of children in the Arg list.
* @return Number of children in the Arg list.
* @apilevel high-level
*/
public int getNumArg() {
return getArgList().getNumChild();
}
/**
* Retrieves the number of children in the Arg list.
* Calling this method will not trigger rewrites.
* @return Number of children in the Arg list.
* @apilevel low-level
*/
public int getNumArgNoTransform() {
return getArgListNoTransform().getNumChildNoTransform();
}
/**
* Retrieves the element at index {@code i} in the Arg list.
* @param i Index of the element to return.
* @return The element at position {@code i} in the Arg list.
* @apilevel high-level
*/
public Expr getArg(int i) {
return (Expr) getArgList().getChild(i);
}
/**
* Check whether the Arg list has any children.
* @return {@code true} if it has at least one child, {@code false} otherwise.
* @apilevel high-level
*/
public boolean hasArg() {
return getArgList().getNumChild() != 0;
}
/**
* Append an element to the Arg list.
* @param node The element to append to the Arg list.
* @apilevel high-level
*/
public void addArg(Expr node) {
List list = (parent == null) ? getArgListNoTransform() : getArgList();
list.addChild(node);
}
/** @apilevel low-level
*/
public void addArgNoTransform(Expr node) {
List list = getArgListNoTransform();
list.addChild(node);
}
/**
* Replaces the Arg list element at index {@code i} with the new node {@code node}.
* @param node The new node to replace the old list element.
* @param i The list index of the node to be replaced.
* @apilevel high-level
*/
public void setArg(Expr node, int i) {
List list = getArgList();
list.setChild(node, i);
}
/**
* Retrieves the Arg list.
* @return The node representing the Arg list.
* @apilevel high-level
*/
@ASTNodeAnnotation.ListChild(name="Arg")
public List getArgList() {
List list = (List) getChild(1);
return list;
}
/**
* Retrieves the Arg list.
* This method does not invoke AST transformations.
* @return The node representing the Arg list.
* @apilevel low-level
*/
public List getArgListNoTransform() {
return (List) getChildNoTransform(1);
}
/**
* @return the element at index {@code i} in the Arg list without
* triggering rewrites.
*/
public Expr getArgNoTransform(int i) {
return (Expr) getArgListNoTransform().getChildNoTransform(i);
}
/**
* Retrieves the Arg list.
* @return The node representing the Arg list.
* @apilevel high-level
*/
public List getArgs() {
return getArgList();
}
/**
* Retrieves the Arg list.
* This method does not invoke AST transformations.
* @return The node representing the Arg list.
* @apilevel low-level
*/
public List getArgsNoTransform() {
return getArgListNoTransform();
}
/**
* Replaces the optional node for the Init child. This is the Opt
* node containing the child Init, not the actual child!
* @param opt The new node to be used as the optional node for the Init child.
* @apilevel low-level
*/
public void setInitOpt(Opt opt) {
setChild(opt, 2);
}
/**
* Replaces the (optional) Init child.
* @param node The new node to be used as the Init child.
* @apilevel high-level
*/
public void setInit(Expr node) {
getInitOpt().setChild(node, 0);
}
/**
* Check whether the optional Init child exists.
* @return {@code true} if the optional Init child exists, {@code false} if it does not.
* @apilevel high-level
*/
public boolean hasInit() {
return getInitOpt().getNumChild() != 0;
}
/**
* Retrieves the (optional) Init child.
* @return The Init child, if it exists. Returns {@code null} otherwise.
* @apilevel low-level
*/
public Expr getInit() {
return (Expr) getInitOpt().getChild(0);
}
/**
* Retrieves the optional node for the Init child. This is the Opt
node containing the child Init, not the actual child!
* @return The optional node for child the Init child.
* @apilevel low-level
*/
@ASTNodeAnnotation.OptChild(name="Init")
public Opt getInitOpt() {
return (Opt) getChild(2);
}
/**
* Retrieves the optional node for child Init. This is the Opt
node containing the child Init, not the actual child!
* This method does not invoke AST transformations.
* @return The optional node for child Init.
* @apilevel low-level
*/
public Opt getInitOptNoTransform() {
return (Opt) getChildNoTransform(2);
}
/**
* Retrieves the TypeAccess child.
* This method does not invoke AST transformations.
* @return The current node used as the TypeAccess child.
* @apilevel low-level
*/
public Access getTypeAccessNoTransform() {
return (Access) getChildNoTransform(3);
}
/**
* Retrieves the child position of the optional child TypeAccess.
* @return The the child position of the optional child TypeAccess.
* @apilevel low-level
*/
protected int getTypeAccessChildPosition() {
return 3;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:50
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:50")
public boolean isEnumConstant() {
boolean isEnumConstant_value = true;
return isEnumConstant_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:54
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:54")
public String name() {
String name_value = getID();
return name_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:212
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:212")
public boolean isField() {
boolean isField_value = true;
return isField_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:214
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:214")
public boolean isPublic() {
boolean isPublic_value = true;
return isPublic_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:215
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:215")
public boolean isStatic() {
boolean isStatic_value = true;
return isStatic_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:216
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:216")
public boolean isFinal() {
boolean isFinal_value = true;
return isFinal_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:217
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:217")
public boolean isTransient() {
boolean isTransient_value = getModifiers().isTransient();
return isTransient_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:218
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:218")
public boolean isVolatile() {
boolean isVolatile_value = getModifiers().isVolatile();
return isVolatile_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:219
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:219")
public boolean isSynthetic() {
boolean isSynthetic_value = getModifiers().isSynthetic();
return isSynthetic_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:220
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:220")
public boolean isClassVariable() {
boolean isClassVariable_value = true;
return isClassVariable_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:221
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:221")
public boolean isInstanceVariable() {
boolean isInstanceVariable_value = false;
return isInstanceVariable_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:222
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:222")
public boolean isLocalVariable() {
boolean isLocalVariable_value = false;
return isLocalVariable_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:223
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:223")
public boolean isBlank() {
boolean isBlank_value = !hasInit();
return isBlank_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:224
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:224")
public boolean isParameter() {
boolean isParameter_value = false;
return isParameter_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:225
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:225")
public boolean isMethodParameter() {
boolean isMethodParameter_value = false;
return isMethodParameter_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:226
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:226")
public boolean isConstructorParameter() {
boolean isConstructorParameter_value = false;
return isConstructorParameter_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:227
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:227")
public boolean isExceptionHandlerParameter() {
boolean isExceptionHandlerParameter_value = !hasInit();
return isExceptionHandlerParameter_value;
}
/** @apilevel internal */
private void isEffectivelyFinal_reset() {
isEffectivelyFinal_computed = null;
}
/** @apilevel internal */
protected ASTState.Cycle isEffectivelyFinal_computed = null;
/** @apilevel internal */
protected boolean isEffectivelyFinal_value;
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:228
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:228")
public boolean isEffectivelyFinal() {
ASTState state = state();
if (isEffectivelyFinal_computed == ASTState.NON_CYCLE || isEffectivelyFinal_computed == state().cycle()) {
return isEffectivelyFinal_value;
}
isEffectivelyFinal_value = isFinal();
if (state().inCircle()) {
isEffectivelyFinal_computed = state().cycle();
} else {
isEffectivelyFinal_computed = ASTState.NON_CYCLE;
}
return isEffectivelyFinal_value;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:230
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:230")
public boolean accessibleFrom(TypeDecl type) {
{
if (isPublic()) {
return true;
} else if (isProtected()) {
if (hostPackage().equals(type.hostPackage())) {
return true;
}
if (type.withinBodyThatSubclasses(hostType()) != null) {
return true;
}
return false;
} else if (isPrivate()) {
return hostType().topLevelType() == type.topLevelType();
} else {
return hostPackage().equals(type.hostPackage());
}
}
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:248
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:248")
public boolean isConstant() {
boolean isConstant_value = true;
return isConstant_value;
}
/** The constant value of an enum constant is the ID.
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:251
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:251")
public Constant constant() {
Constant constant_value = Constant.create(getID());
return constant_value;
}
/** @apilevel internal */
private void throwTypes_reset() {
throwTypes_computed = null;
throwTypes_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle throwTypes_computed = null;
/** @apilevel internal */
protected Collection throwTypes_value;
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:253
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:253")
public Collection throwTypes() {
ASTState state = state();
if (throwTypes_computed == ASTState.NON_CYCLE || throwTypes_computed == state().cycle()) {
return throwTypes_value;
}
throwTypes_value = throwTypes_compute();
if (state().inCircle()) {
throwTypes_computed = state().cycle();
} else {
throwTypes_computed = ASTState.NON_CYCLE;
}
return throwTypes_value;
}
/** @apilevel internal */
private Collection throwTypes_compute() {
Collection tts = new LinkedList();
tts.add(type());
return tts;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:275
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:275")
public TypeDecl type() {
TypeDecl type_value = hostType();
return type_value;
}
/** @apilevel internal */
private void getTypeAccess_reset() {
getTypeAccess_computed = false;
getTypeAccess_value = null;
}
/** @apilevel internal */
protected boolean getTypeAccess_computed = false;
/** @apilevel internal */
protected Access getTypeAccess_value;
/**
* @attribute syn nta
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:277
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isNTA=true)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:277")
public Access getTypeAccess() {
ASTState state = state();
if (getTypeAccess_computed) {
return (Access) getChild(getTypeAccessChildPosition());
}
state().enterLazyAttribute();
getTypeAccess_value = hostType().createQualifiedAccess();
setChild(getTypeAccess_value, getTypeAccessChildPosition());
getTypeAccess_computed = true;
state().leaveLazyAttribute();
Access node = (Access) this.getChild(getTypeAccessChildPosition());
return node;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:801
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:801")
public SimpleSet localMethodsSignature(String signature) {
{
SimpleSet set = localMethodsSignatureMap().get(signature);
if (set != null) {
return set;
}
return emptySet();
}
}
/** @apilevel internal */
private void localMethodsSignatureMap_reset() {
localMethodsSignatureMap_computed = null;
localMethodsSignatureMap_value = null;
}
/** @apilevel internal */
protected ASTState.Cycle localMethodsSignatureMap_computed = null;
/** @apilevel internal */
protected Map> localMethodsSignatureMap_value;
/** Maps method signature to method declaration.
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:810
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:810")
public Map> localMethodsSignatureMap() {
ASTState state = state();
if (localMethodsSignatureMap_computed == ASTState.NON_CYCLE || localMethodsSignatureMap_computed == state().cycle()) {
return localMethodsSignatureMap_value;
}
localMethodsSignatureMap_value = localMethodsSignatureMap_compute();
if (state().inCircle()) {
localMethodsSignatureMap_computed = state().cycle();
} else {
localMethodsSignatureMap_computed = ASTState.NON_CYCLE;
}
return localMethodsSignatureMap_value;
}
/** @apilevel internal */
private Map> localMethodsSignatureMap_compute() {
Map> map = new HashMap>(
getNumBodyDecl());
for (int i = 0; i < getNumBodyDecl(); i++) {
if (getBodyDecl(i) instanceof MethodDecl) {
MethodDecl decl = (MethodDecl) getBodyDecl(i);
putSimpleSetElement(map, decl.signature(), decl);
}
}
return map;
}
/**
* @attribute syn
* @aspect Enums
* @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:835
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Enums", declaredAt="/home/jesper/git/extendj/java5/frontend/Enums.jrag:835")
public boolean implementsMethod(MethodDecl method) {
{
SimpleSet methods = localMethodsSignature(method.signature());
if (methods.isSingleton()) {
MethodDecl n = methods.singletonValue();
if (!n.isAbstract()) {
return true;
}
}
return false;
}
}
/** @return {@code true} if the field declaration is inside this node.
* @attribute syn
* @aspect DeclareBeforeUse
* @declaredat /home/jesper/git/extendj/java4/frontend/DeclareBeforeUse.jrag:46
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="DeclareBeforeUse", declaredAt="/home/jesper/git/extendj/java4/frontend/DeclareBeforeUse.jrag:46")
public boolean declaredIn(Variable decl) {
boolean declaredIn_Variable_value = this == decl || declaredBefore(decl);
return declaredIn_Variable_value;
}
/**
* @attribute syn
* @aspect EnumsCodegen
* @declaredat /home/jesper/git/extendj/java5/backend/EnumsCodegen.jrag:43
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="EnumsCodegen", declaredAt="/home/jesper/git/extendj/java5/backend/EnumsCodegen.jrag:43")
public int flags() {
{
int flags = Modifiers.ACC_ENUM;
if (isPublic()) {
flags |= Modifiers.ACC_PUBLIC;
}
if (isPrivate()) {
flags |= Modifiers.ACC_PRIVATE;
}
if (isProtected()) {
flags |= Modifiers.ACC_PROTECTED;
}
if (isStatic()) {
flags |= Modifiers.ACC_STATIC;
}
if (isFinal()) {
flags |= Modifiers.ACC_FINAL;
}
if (isVolatile()) {
flags |= Modifiers.ACC_VOLATILE;
}
if (isTransient()) {
flags |= Modifiers.ACC_TRANSIENT;
}
if (isSynthetic()) {
flags |= Modifiers.ACC_SYNTHETIC;
}
return flags;
}
}
/**
* @attribute syn
* @aspect Modifiers
* @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:278
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Modifiers", declaredAt="/home/jesper/git/extendj/java4/frontend/Modifiers.jrag:278")
public boolean isProtected() {
boolean isProtected_value = getModifiers().isProtected();
return isProtected_value;
}
/**
* @attribute syn
* @aspect Modifiers
* @declaredat /home/jesper/git/extendj/java4/frontend/Modifiers.jrag:280
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="Modifiers", declaredAt="/home/jesper/git/extendj/java4/frontend/Modifiers.jrag:280")
public boolean isPrivate() {
boolean isPrivate_value = getModifiers().isPrivate();
return isPrivate_value;
}
/**
* @attribute syn
* @aspect GenericsCodegen
* @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:157
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="GenericsCodegen", declaredAt="/home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:157")
public TypeDecl erasedType() {
TypeDecl erasedType_value = type();
return erasedType_value;
}
/**
* @attribute inh
* @aspect NestedTypes
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:637
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH)
@ASTNodeAnnotation.Source(aspect="NestedTypes", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:637")
public String hostPackage() {
String hostPackage_value = getParent().Define_hostPackage(this, null);
return hostPackage_value;
}
/**
* @attribute inh
* @aspect LookupParTypeDecl
* @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1400
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH)
@ASTNodeAnnotation.Source(aspect="LookupParTypeDecl", declaredAt="/home/jesper/git/extendj/java5/frontend/Generics.jrag:1400")
public FieldDecl fieldDecl() {
FieldDecl fieldDecl_value = getParent().Define_fieldDecl(this, null);
return fieldDecl_value;
}
/**
* @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:131
* @apilevel internal
*/
public boolean Define_mayUseAnnotationTarget(ASTNode _callerNode, ASTNode _childNode, String name) {
if (getModifiersNoTransform() != null && _callerNode == getModifiers()) {
// @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:147
return name.equals("FIELD");
}
else {
return getParent().Define_mayUseAnnotationTarget(this, _callerNode, name);
}
}
/**
* @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:131
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute mayUseAnnotationTarget
*/
protected boolean canDefine_mayUseAnnotationTarget(ASTNode _callerNode, ASTNode _childNode, String name) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:223
* @apilevel internal
*/
public boolean Define_inStaticContext(ASTNode _callerNode, ASTNode _childNode) {
int childIndex = this.getIndexOfChild(_callerNode);
return isStatic();
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:223
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute inStaticContext
*/
protected boolean canDefine_inStaticContext(ASTNode _callerNode, ASTNode _childNode) {
return true;
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36
* @apilevel internal
*/
public NameType Define_nameType(ASTNode _callerNode, ASTNode _childNode) {
if (getTypeAccessNoTransform() != null && _callerNode == getTypeAccess()) {
// @declaredat /home/jesper/git/extendj/java5/frontend/Enums.jrag:628
return NameType.TYPE_NAME;
}
else {
return getParent().Define_nameType(this, _callerNode);
}
}
/**
* @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36
* @apilevel internal
* @return {@code true} if this node has an equation for the inherited attribute nameType
*/
protected boolean canDefine_nameType(ASTNode _callerNode, ASTNode _childNode) {
return true;
}
/** @apilevel internal */
public ASTNode rewriteTo() {
return super.rewriteTo();
}
/** @apilevel internal */
public boolean canRewrite() {
return false;
}
}