org.jastadd.ast.AST.Parameter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jastadd Show documentation
Show all versions of jastadd Show documentation
A metacompilation framework for Java using attribute grammars.
/* This file was generated with JastAdd2 (http://jastadd.org) version 2.2.2 */
package org.jastadd.ast.AST;
import java.util.*;
import java.io.*;
import org.jastadd.ast.AST.*;
import org.jastadd.jrag.*;
import org.jastadd.jrag.AST.ASTCompilationUnit;
import org.jastadd.jrag.AST.ASTBlock;
import org.jastadd.JastAdd;
import java.nio.charset.StandardCharsets;
import org.jastadd.jrag.AST.ASTAspectMethodDeclaration;
import org.jastadd.jrag.AST.ASTAspectRefineMethodDeclaration;
import org.jastadd.jrag.AST.ASTAspectFieldDeclaration;
import org.jastadd.jrag.ClassBodyObject;
import java.io.PrintStream;
import org.jastadd.ast.AST.Token;
import org.jastadd.ast.AST.SimpleNode;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jastadd.jrag.AST.ASTExpression;
import org.jastadd.jrag.Unparser;
import org.jastadd.Problem;
import java.util.Set;
import java.util.HashSet;
import java.util.Collection;
import java.util.regex.*;
import org.jastadd.Configuration;
import org.jastadd.tinytemplate.*;
/**
* @ast node
* @declaredat /jastadd/src/jastadd/ast/Ast.ast:42
* @production Parameter : {@link ASTNode} ::= <Type:String> <Name:String>;
*/
public class Parameter extends ASTNode implements Cloneable {
/**
* @declaredat ASTNode:1
*/
public Parameter(int i) {
super(i);
}
/**
* @declaredat ASTNode:5
*/
public Parameter(Ast p, int i) {
this(i);
parser = p;
}
/**
* @declaredat ASTNode:10
*/
public Parameter() {
this(0);
}
/**
* Initializes the child array to the correct size.
* Initializes List and Opt nta children.
* @apilevel internal
* @ast method
* @declaredat ASTNode:19
*/
public void init$Children() {
}
/**
* @declaredat ASTNode:21
*/
public Parameter(String p0, String p1) {
setType(p0);
setName(p1);
}
/**
* @declaredat ASTNode:25
*/
public void dumpTree(String indent, java.io.PrintStream out) {
out.print(indent + "Parameter");
out.print("\"" + getType() + "\"");
out.print("\"" + getName() + "\"");
String childIndent = indent + " ";
for (int i = 0; i < getNumChild(); i++) {
getChild(i).dumpTree(childIndent, out);
}
}
/**
* @declaredat ASTNode:34
*/
public Object jjtAccept(AstVisitor visitor, Object data) {
return visitor.visit(this, data);
}
/**
* @declaredat ASTNode:37
*/
public void jjtAddChild(Node n, int i) {
checkChild(n, i);
super.jjtAddChild(n, i);
}
/**
* @declaredat ASTNode:41
*/
public void checkChild(Node n, int i) {
}
/** @apilevel low-level
* @declaredat ASTNode:44
*/
public int getNumChild() {
return 0;
}
/**
* @apilevel internal
* @declaredat ASTNode:50
*/
public boolean mayHaveRewrite() {
return false;
}
/** @apilevel internal
* @declaredat ASTNode:54
*/
public void flushAttrCache() {
super.flushAttrCache();
}
/** @apilevel internal
* @declaredat ASTNode:58
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:62
*/
public Parameter clone() throws CloneNotSupportedException {
Parameter node = (Parameter) super.clone();
return node;
}
/** @apilevel internal
* @declaredat ASTNode:67
*/
public Parameter copy() {
try {
Parameter node = (Parameter) 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:86
*/
@Deprecated
public Parameter 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:96
*/
public Parameter treeCopyNoTransform() {
Parameter tree = (Parameter) 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:116
*/
public Parameter treeCopy() {
doFullTraversal();
return treeCopyNoTransform();
}
/** @apilevel internal
* @declaredat ASTNode:121
*/
protected boolean is$Equal(ASTNode node) {
return super.is$Equal(node) && (tokenString_Type == ((Parameter) node).tokenString_Type) && (tokenString_Name == ((Parameter) node).tokenString_Name);
}
/**
* Replaces the lexeme Type.
* @param value The new value for the lexeme Type.
* @apilevel high-level
*/
public void setType(String value) {
tokenString_Type = value;
}
/** @apilevel internal
*/
protected String tokenString_Type;
/**
* Retrieves the value for the lexeme Type.
* @return The value for the lexeme Type.
* @apilevel high-level
*/
@ASTNodeAnnotation.Token(name="Type")
public String getType() {
return tokenString_Type != null ? tokenString_Type : "";
}
/**
* Replaces the lexeme Name.
* @param value The new value for the lexeme Name.
* @apilevel high-level
*/
public void setName(String value) {
tokenString_Name = value;
}
/** @apilevel internal
*/
protected String tokenString_Name;
/**
* Retrieves the value for the lexeme Name.
* @return The value for the lexeme Name.
* @apilevel high-level
*/
@ASTNodeAnnotation.Token(name="Name")
public String getName() {
return tokenString_Name != null ? tokenString_Name : "";
}
/** @apilevel internal */
protected int getTypeInSignature_visited = -1;
/**
* @attribute syn
* @aspect AttributeNamesAndTypes
* @declaredat /jastadd/src/jastadd/ast/NameBinding.jrag:41
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="AttributeNamesAndTypes", declaredAt="/jastadd/src/jastadd/ast/NameBinding.jrag:41")
public String getTypeInSignature() {
if (getTypeInSignature_visited == state().boundariesCrossed) {
throw new RuntimeException("Circular definition of attribute Parameter.getTypeInSignature().");
}
getTypeInSignature_visited = state().boundariesCrossed;
String getTypeInSignature_value = convTypeNameToSignature(getType());
getTypeInSignature_visited = -1;
return getTypeInSignature_value;
}
/** @apilevel internal */
public ASTNode rewriteTo() {
return super.rewriteTo();
}
}