org.extendj.ast.Dims Maven / Gradle / Ivy
/* This file was generated with JastAdd2 (http://jastadd.org) version 2.3.0 */
package org.extendj.ast;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
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.*;
import java.util.zip.*;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import org.jastadd.util.PrettyPrintable;
import org.jastadd.util.PrettyPrinter;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.jastadd.util.*;
import java.io.File;
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;
/**
* @ast node
* @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:224
* @astdecl Dims : ASTNode ::= [Expr];
* @production Dims : {@link ASTNode} ::= [{@link Expr}];
*/
public class Dims extends ASTNode implements Cloneable {
/**
* @aspect Java4PrettyPrint
* @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd:325
*/
public void prettyPrint(PrettyPrinter out) {
out.print("[");
out.print(getExprOpt());
out.print("]");
}
/**
* @declaredat ASTNode:1
*/
public Dims() {
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];
setChild(new Opt(), 0);
}
/**
* @declaredat ASTNode:14
*/
@ASTNodeAnnotation.Constructor(
name = {"Expr"},
type = {"Opt"},
kind = {"Opt"}
)
public Dims(Opt p0) {
setChild(p0, 0);
}
/** @apilevel low-level
* @declaredat ASTNode:23
*/
protected int numChildren() {
return 1;
}
/**
* @apilevel internal
* @declaredat ASTNode:29
*/
public boolean mayHaveRewrite() {
return false;
}
/** @apilevel internal
* @declaredat ASTNode:33
*/
public void flushAttrCache() {
super.flushAttrCache();
}
/** @apilevel internal
* @declaredat ASTNode:37
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:41
*/
public Dims clone() throws CloneNotSupportedException {
Dims node = (Dims) super.clone();
return node;
}
/** @apilevel internal
* @declaredat ASTNode:46
*/
public Dims copy() {
try {
Dims node = (Dims) 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:65
*/
@Deprecated
public Dims 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:75
*/
public Dims treeCopyNoTransform() {
Dims tree = (Dims) 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:95
*/
public Dims treeCopy() {
Dims tree = (Dims) 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:109
*/
protected boolean is$Equal(ASTNode node) {
return super.is$Equal(node);
}
/**
* Replaces the optional node for the Expr child. This is the Opt
* node containing the child Expr, not the actual child!
* @param opt The new node to be used as the optional node for the Expr child.
* @apilevel low-level
*/
public void setExprOpt(Opt opt) {
setChild(opt, 0);
}
/**
* Replaces the (optional) Expr child.
* @param node The new node to be used as the Expr child.
* @apilevel high-level
*/
public void setExpr(Expr node) {
getExprOpt().setChild(node, 0);
}
/**
* Check whether the optional Expr child exists.
* @return {@code true} if the optional Expr child exists, {@code false} if it does not.
* @apilevel high-level
*/
public boolean hasExpr() {
return getExprOpt().getNumChild() != 0;
}
/**
* Retrieves the (optional) Expr child.
* @return The Expr child, if it exists. Returns {@code null} otherwise.
* @apilevel low-level
*/
public Expr getExpr() {
return (Expr) getExprOpt().getChild(0);
}
/**
* Retrieves the optional node for the Expr child. This is the Opt
node containing the child Expr, not the actual child!
* @return The optional node for child the Expr child.
* @apilevel low-level
*/
@ASTNodeAnnotation.OptChild(name="Expr")
public Opt getExprOpt() {
return (Opt) getChild(0);
}
/**
* Retrieves the optional node for child Expr. This is the Opt
node containing the child Expr, not the actual child!
* This method does not invoke AST transformations.
* @return The optional node for child Expr.
* @apilevel low-level
*/
public Opt getExprOptNoTransform() {
return (Opt) getChildNoTransform(0);
}
/** @apilevel internal */
public ASTNode rewriteTo() {
return super.rewriteTo();
}
/** @apilevel internal */
public boolean canRewrite() {
return false;
}
}