org.extendj.ast.List Maven / Gradle / Ivy
The newest version!
/* 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
* @astdecl List : ASTNode;
* @production List : {@link ASTNode};
*/
public class List extends ASTNode implements Cloneable, Iterable {
/** Default list pretty printing prints all list elements.
* @aspect PrettyPrintUtil
* @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrintUtil.jrag:178
*/
public void prettyPrint(PrettyPrinter out) {
for (int i = 0; i < getNumChild(); ++i) {
getChild(i).prettyPrint(out);
}
}
/**
* @declaredat ASTNode:1
*/
public List() {
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() {
}
/**
* @declaredat ASTNode:12
*/
public List(T... initialChildren) {
children = new ASTNode[initialChildren.length];
for (int i = 0; i < children.length; ++i) {
addChild(initialChildren[i]);
}
}
/**
* @declaredat ASTNode:20
*/
public List add(T node) {
addChild(node);
return this;
}
/**
* @declaredat ASTNode:25
*/
public List addAll(Iterable extends T> c) {
for (T node : c) {
addChild(node);
}
return this;
}
/**
* @declaredat ASTNode:32
*/
public void insertChild(ASTNode node, int i) {
super.insertChild(node, i);
}
/**
* @declaredat ASTNode:36
*/
public void addChild(T node) {
super.addChild(node);
}
/** @apilevel low-level
* @declaredat ASTNode:41
*/
public void removeChild(int i) {
super.removeChild(i);
}
/**
* @declaredat ASTNode:45
*/
public int getNumChild() {
return getNumChildNoTransform();
}
/** @return an iterator to iterate over elements in this list node.
* @declaredat ASTNode:50
*/
@Override
public java.util.Iterator iterator() {
return astChildIterator();
}
/**
* @apilevel internal
* @declaredat ASTNode:57
*/
public boolean mayHaveRewrite() {
return false;
}
/** @apilevel internal
* @declaredat ASTNode:61
*/
public void flushAttrCache() {
super.flushAttrCache();
}
/** @apilevel internal
* @declaredat ASTNode:65
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:69
*/
public List clone() throws CloneNotSupportedException {
List node = (List) super.clone();
return node;
}
/** @apilevel internal
* @declaredat ASTNode:74
*/
public List copy() {
try {
List node = (List) 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:93
*/
@Deprecated
public List 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:103
*/
public List treeCopyNoTransform() {
List tree = (List) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
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:123
*/
public List treeCopy() {
List tree = (List) copy();
if (children != null) {
for (int i = 0; i < children.length; ++i) {
ASTNode child = (ASTNode) getChild(i);
if (child != null) {
child = child.treeCopy();
tree.setChild(child, i);
}
}
}
return tree;
}
/** @apilevel internal
* @declaredat ASTNode:137
*/
protected boolean is$Equal(ASTNode node) {
return super.is$Equal(node);
}
/** @apilevel internal */
public ASTNode rewriteTo() {
return super.rewriteTo();
}
/** @apilevel internal */
public boolean canRewrite() {
return false;
}
}