All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.extendj.ast.ImportDecl 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;
/**
 * An abstract import declaration.
 * 
 * 

Multiple concrete subclasses exist for different kind of * import declarations. More import declarations were added in Java 5. * * See JLS 6 §7.5. * @ast node * @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:61 * @astdecl ImportDecl : ASTNode ::= Access; * @production ImportDecl : {@link ASTNode} ::= {@link Access}; */ public abstract class ImportDecl extends ASTNode implements Cloneable { /** * @declaredat ASTNode:1 */ public ImportDecl() { 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[1]; } /** * @declaredat ASTNode:13 */ @ASTNodeAnnotation.Constructor( name = {"Access"}, type = {"Access"}, kind = {"Child"} ) public ImportDecl(Access p0) { setChild(p0, 0); } /** @apilevel low-level * @declaredat ASTNode:22 */ protected int numChildren() { return 1; } /** * @apilevel internal * @declaredat ASTNode:28 */ public boolean mayHaveRewrite() { return false; } /** @apilevel internal * @declaredat ASTNode:32 */ public void flushAttrCache() { super.flushAttrCache(); importedTypes_String_reset(); importedTypes_reset(); importedFields_String_reset(); importedMethods_String_reset(); } /** @apilevel internal * @declaredat ASTNode:40 */ public void flushCollectionCache() { super.flushCollectionCache(); } /** @apilevel internal * @declaredat ASTNode:44 */ public ImportDecl clone() throws CloneNotSupportedException { ImportDecl node = (ImportDecl) super.clone(); return node; } /** * 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:55 */ @Deprecated public abstract ImportDecl fullCopy(); /** * 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:63 */ public abstract ImportDecl treeCopyNoTransform(); /** * 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:71 */ public abstract ImportDecl treeCopy(); /** * Replaces the Access child. * @param node The new node to replace the Access child. * @apilevel high-level */ public void setAccess(Access node) { setChild(node, 0); } /** * Retrieves the Access child. * @return The current node used as the Access child. * @apilevel high-level */ @ASTNodeAnnotation.Child(name="Access") public Access getAccess() { return (Access) getChild(0); } /** * Retrieves the Access child. *

This method does not invoke AST transformations.

* @return The current node used as the Access child. * @apilevel low-level */ public Access getAccessNoTransform() { return (Access) getChildNoTransform(0); } /** * @attribute syn * @aspect Names * @declaredat /home/jesper/git/extendj/java4/frontend/QualifiedNames.jrag:60 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Names", declaredAt="/home/jesper/git/extendj/java4/frontend/QualifiedNames.jrag:60") public String typeName() { { Access a = getAccess().lastAccess(); String name = a.isTypeAccess() ? ((TypeAccess) a).nameWithPackage() : ""; while (a.hasPrevExpr() && a.prevExpr() instanceof Access) { Access pred = (Access) a.prevExpr(); if (pred.isTypeAccess()) { name = ((TypeAccess) pred).nameWithPackage() + "." + name; } a = pred; } return name; } } /** @apilevel internal */ private void importedTypes_String_reset() { importedTypes_String_computed = null; importedTypes_String_values = null; } /** @apilevel internal */ protected java.util.Map importedTypes_String_values; /** @apilevel internal */ protected java.util.Map importedTypes_String_computed; /** * @attribute syn * @aspect TypeScopePropagation * @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:483 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeScopePropagation", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupType.jrag:483") public SimpleSet importedTypes(String name) { Object _parameters = name; if (importedTypes_String_computed == null) importedTypes_String_computed = new java.util.HashMap(4); if (importedTypes_String_values == null) importedTypes_String_values = new java.util.HashMap(4); ASTState state = state(); if (importedTypes_String_values.containsKey(_parameters) && importedTypes_String_computed.containsKey(_parameters) && (importedTypes_String_computed.get(_parameters) == ASTState.NON_CYCLE || importedTypes_String_computed.get(_parameters) == state().cycle())) { return (SimpleSet) importedTypes_String_values.get(_parameters); } SimpleSet importedTypes_String_value = emptySet(); if (state().inCircle()) { importedTypes_String_values.put(_parameters, importedTypes_String_value); importedTypes_String_computed.put(_parameters, state().cycle()); } else { importedTypes_String_values.put(_parameters, importedTypes_String_value); importedTypes_String_computed.put(_parameters, ASTState.NON_CYCLE); } return importedTypes_String_value; } /** @apilevel internal */ private void importedTypes_reset() { importedTypes_computed = null; importedTypes_value = null; } /** @apilevel internal */ protected ASTState.Cycle importedTypes_computed = null; /** @apilevel internal */ protected SimpleSet importedTypes_value; /** * For a single-import declaration this will return a SimpleSet * containing the TypeDecl for the imported type. For dynamic * import declarations this returns the empty set. * @return TypeDecl of imported type wrapped in SimpleSet * @attribute syn * @aspect TypeScopePropagation * @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:500 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeScopePropagation", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupType.jrag:500") public SimpleSet importedTypes() { ASTState state = state(); if (importedTypes_computed == ASTState.NON_CYCLE || importedTypes_computed == state().cycle()) { return importedTypes_value; } importedTypes_value = emptySet(); if (state().inCircle()) { importedTypes_computed = state().cycle(); } else { importedTypes_computed = ASTState.NON_CYCLE; } return importedTypes_value; } /** * @attribute syn * @aspect TypeScopePropagation * @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:531 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="TypeScopePropagation", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupType.jrag:531") public boolean isOnDemand() { boolean isOnDemand_value = false; return isOnDemand_value; } /** @apilevel internal */ private void importedFields_String_reset() { importedFields_String_values = null; } protected java.util.Map importedFields_String_values; @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true) @ASTNodeAnnotation.Source(aspect="StaticImports", declaredAt="/home/jesper/git/extendj/java5/frontend/StaticImports.jrag:63") public SimpleSet importedFields(String name) { Object _parameters = name; if (importedFields_String_values == null) importedFields_String_values = new java.util.HashMap(4); ASTState.CircularValue _value; if (importedFields_String_values.containsKey(_parameters)) { Object _cache = importedFields_String_values.get(_parameters); if (!(_cache instanceof ASTState.CircularValue)) { return (SimpleSet) _cache; } else { _value = (ASTState.CircularValue) _cache; } } else { _value = new ASTState.CircularValue(); importedFields_String_values.put(_parameters, _value); _value.value = emptySet(); } ASTState state = state(); if (!state.inCircle() || state.calledByLazyAttribute()) { state.enterCircle(); SimpleSet new_importedFields_String_value; do { _value.cycle = state.nextCycle(); new_importedFields_String_value = emptySet(); if (!AttributeValue.equals(((SimpleSet)_value.value), new_importedFields_String_value)) { state.setChangeInCycle(); _value.value = new_importedFields_String_value; } } while (state.testAndClearChangeInCycle()); importedFields_String_values.put(_parameters, new_importedFields_String_value); state.leaveCircle(); return new_importedFields_String_value; } else if (_value.cycle != state.cycle()) { _value.cycle = state.cycle(); SimpleSet new_importedFields_String_value = emptySet(); if (!AttributeValue.equals(((SimpleSet)_value.value), new_importedFields_String_value)) { state.setChangeInCycle(); _value.value = new_importedFields_String_value; } return new_importedFields_String_value; } else { return (SimpleSet) _value.value; } } /** @apilevel internal */ private void importedMethods_String_reset() { importedMethods_String_computed = null; importedMethods_String_values = null; } /** @apilevel internal */ protected java.util.Map importedMethods_String_values; /** @apilevel internal */ protected java.util.Map importedMethods_String_computed; /** * @attribute syn * @aspect StaticImports * @declaredat /home/jesper/git/extendj/java5/frontend/StaticImports.jrag:84 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="StaticImports", declaredAt="/home/jesper/git/extendj/java5/frontend/StaticImports.jrag:84") public Collection importedMethods(String name) { Object _parameters = name; if (importedMethods_String_computed == null) importedMethods_String_computed = new java.util.HashMap(4); if (importedMethods_String_values == null) importedMethods_String_values = new java.util.HashMap(4); ASTState state = state(); if (importedMethods_String_values.containsKey(_parameters) && importedMethods_String_computed.containsKey(_parameters) && (importedMethods_String_computed.get(_parameters) == ASTState.NON_CYCLE || importedMethods_String_computed.get(_parameters) == state().cycle())) { return (Collection) importedMethods_String_values.get(_parameters); } Collection importedMethods_String_value = Collections.EMPTY_LIST; if (state().inCircle()) { importedMethods_String_values.put(_parameters, importedMethods_String_value); importedMethods_String_computed.put(_parameters, state().cycle()); } else { importedMethods_String_values.put(_parameters, importedMethods_String_value); importedMethods_String_computed.put(_parameters, ASTState.NON_CYCLE); } return importedMethods_String_value; } /** * @attribute inh * @aspect TypeScopePropagation * @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:529 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH) @ASTNodeAnnotation.Source(aspect="TypeScopePropagation", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupType.jrag:529") public String packageName() { String packageName_value = getParent().Define_packageName(this, null); return packageName_value; } /** * @attribute inh * @aspect NameCheck * @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:51 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH) @ASTNodeAnnotation.Source(aspect="NameCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/NameCheck.jrag:51") public SimpleSet allImportedTypes(String name) { SimpleSet allImportedTypes_String_value = getParent().Define_allImportedTypes(this, null, name); return allImportedTypes_String_value; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/ResolveAmbiguousNames.jrag:86 * @apilevel internal */ public boolean Define_isLeftChildOfDot(ASTNode _callerNode, ASTNode _childNode) { int childIndex = this.getIndexOfChild(_callerNode); return false; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/ResolveAmbiguousNames.jrag:86 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute isLeftChildOfDot */ protected boolean canDefine_isLeftChildOfDot(ASTNode _callerNode, ASTNode _childNode) { return true; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/ResolveAmbiguousNames.jrag:101 * @apilevel internal */ public boolean Define_isRightChildOfDot(ASTNode _callerNode, ASTNode _childNode) { int childIndex = this.getIndexOfChild(_callerNode); return false; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/ResolveAmbiguousNames.jrag:101 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute isRightChildOfDot */ protected boolean canDefine_isRightChildOfDot(ASTNode _callerNode, ASTNode _childNode) { return true; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/ResolveAmbiguousNames.jrag:118 * @apilevel internal */ public Expr Define_prevExpr(ASTNode _callerNode, ASTNode _childNode) { int childIndex = this.getIndexOfChild(_callerNode); return prevExprError(); } /** * @declaredat /home/jesper/git/extendj/java4/frontend/ResolveAmbiguousNames.jrag:118 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute prevExpr */ protected boolean canDefine_prevExpr(ASTNode _callerNode, ASTNode _childNode) { return true; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/ResolveAmbiguousNames.jrag:142 * @apilevel internal */ public Access Define_nextAccess(ASTNode _callerNode, ASTNode _childNode) { int childIndex = this.getIndexOfChild(_callerNode); return nextAccessError(); } /** * @declaredat /home/jesper/git/extendj/java4/frontend/ResolveAmbiguousNames.jrag:142 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute nextAccess */ protected boolean canDefine_nextAccess(ASTNode _callerNode, ASTNode _childNode) { return true; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:34 * @apilevel internal */ public boolean Define_isDest(ASTNode _callerNode, ASTNode _childNode) { if (getAccessNoTransform() != null && _callerNode == getAccess()) { // @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:42 return false; } else { return getParent().Define_isDest(this, _callerNode); } } /** * @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:34 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute isDest */ protected boolean canDefine_isDest(ASTNode _callerNode, ASTNode _childNode) { return true; } /** * @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:44 * @apilevel internal */ public boolean Define_isSource(ASTNode _callerNode, ASTNode _childNode) { if (getAccessNoTransform() != null && _callerNode == getAccess()) { // @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:51 return true; } else { return getParent().Define_isSource(this, _callerNode); } } /** * @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:44 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute isSource */ protected boolean canDefine_isSource(ASTNode _callerNode, ASTNode _childNode) { return true; } /** @apilevel internal */ public ASTNode rewriteTo() { return super.rewriteTo(); } /** @apilevel internal */ public boolean canRewrite() { return false; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy