All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.extendj.ast.Case 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/java4/grammar/Java.ast:336
* @astdecl Case : Stmt;
* @production Case : {@link Stmt};
*/
public abstract class Case extends Stmt implements Cloneable {
/**
* @aspect CreateBCode
* @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1612
*/
public void createBCode(CodeGeneration gen) {
gen.addLabel(label());
}
/**
* @declaredat ASTNode:1
*/
public Case() {
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() {
}
/** @apilevel low-level
* @declaredat ASTNode:13
*/
protected int numChildren() {
return 0;
}
/**
* @apilevel internal
* @declaredat ASTNode:19
*/
public boolean mayHaveRewrite() {
return false;
}
/** @apilevel internal
* @declaredat ASTNode:23
*/
public void flushAttrCache() {
super.flushAttrCache();
assignedBefore_Variable_reset();
assignedAfter_Variable_reset();
unassignedAfter_Variable_reset();
label_reset();
previousCase_Case_reset();
}
/** @apilevel internal
* @declaredat ASTNode:32
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/** @apilevel internal
* @declaredat ASTNode:36
*/
public Case clone() throws CloneNotSupportedException {
Case node = (Case) 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:47
*/
@Deprecated
public abstract Case 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:55
*/
public abstract Case 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:63
*/
public abstract Case treeCopy();
/**
* @return {@code true} if this case label has the same constant value as
* the argument case label.
* @attribute syn
* @aspect NameCheck
* @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:667
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="NameCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/NameCheck.jrag:667")
public abstract boolean constValue(Case c);
/**
* @attribute syn
* @aspect UnreachableStatements
* @declaredat /home/jesper/git/extendj/java4/frontend/UnreachableStatements.jrag:127
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="UnreachableStatements", declaredAt="/home/jesper/git/extendj/java4/frontend/UnreachableStatements.jrag:127")
public boolean reachable() {
boolean reachable_value = getParent().getParent() instanceof Block && ((Block) getParent().getParent()).reachable();
return reachable_value;
}
/** @apilevel internal */
private void assignedBefore_Variable_reset() {
assignedBefore_Variable_values = null;
}
protected java.util.Map assignedBefore_Variable_values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="DefiniteAssignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:731")
public boolean assignedBefore(Variable v) {
Object _parameters = v;
if (assignedBefore_Variable_values == null) assignedBefore_Variable_values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (assignedBefore_Variable_values.containsKey(_parameters)) {
Object _cache = assignedBefore_Variable_values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (Boolean) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
assignedBefore_Variable_values.put(_parameters, _value);
_value.value = true;
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
boolean new_assignedBefore_Variable_value;
do {
_value.cycle = state.nextCycle();
new_assignedBefore_Variable_value = getParent().getParent() instanceof Block
&& ((Block) getParent().getParent()).assignedBefore(v)
&& super.assignedBefore(v);
if (((Boolean)_value.value) != new_assignedBefore_Variable_value) {
state.setChangeInCycle();
_value.value = new_assignedBefore_Variable_value;
}
} while (state.testAndClearChangeInCycle());
assignedBefore_Variable_values.put(_parameters, new_assignedBefore_Variable_value);
state.leaveCircle();
return new_assignedBefore_Variable_value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
boolean new_assignedBefore_Variable_value = getParent().getParent() instanceof Block
&& ((Block) getParent().getParent()).assignedBefore(v)
&& super.assignedBefore(v);
if (((Boolean)_value.value) != new_assignedBefore_Variable_value) {
state.setChangeInCycle();
_value.value = new_assignedBefore_Variable_value;
}
return new_assignedBefore_Variable_value;
} else {
return (Boolean) _value.value;
}
}
/** @apilevel internal */
private void assignedAfter_Variable_reset() {
assignedAfter_Variable_values = null;
}
protected java.util.Map assignedAfter_Variable_values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="DefiniteAssignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:264")
public boolean assignedAfter(Variable v) {
Object _parameters = v;
if (assignedAfter_Variable_values == null) assignedAfter_Variable_values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (assignedAfter_Variable_values.containsKey(_parameters)) {
Object _cache = assignedAfter_Variable_values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (Boolean) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
assignedAfter_Variable_values.put(_parameters, _value);
_value.value = true;
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
boolean new_assignedAfter_Variable_value;
do {
_value.cycle = state.nextCycle();
new_assignedAfter_Variable_value = assignedBefore(v);
if (((Boolean)_value.value) != new_assignedAfter_Variable_value) {
state.setChangeInCycle();
_value.value = new_assignedAfter_Variable_value;
}
} while (state.testAndClearChangeInCycle());
assignedAfter_Variable_values.put(_parameters, new_assignedAfter_Variable_value);
state.leaveCircle();
return new_assignedAfter_Variable_value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
boolean new_assignedAfter_Variable_value = assignedBefore(v);
if (((Boolean)_value.value) != new_assignedAfter_Variable_value) {
state.setChangeInCycle();
_value.value = new_assignedAfter_Variable_value;
}
return new_assignedAfter_Variable_value;
} else {
return (Boolean) _value.value;
}
}
/**
* @attribute syn
* @aspect DefiniteUnassignment
* @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:1390
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="DefiniteUnassignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:1390")
public boolean unassignedBefore(Variable v) {
boolean unassignedBefore_Variable_value = getParent().getParent() instanceof Block
&& ((Block) getParent().getParent()).unassignedBefore(v)
&& super.unassignedBefore(v);
return unassignedBefore_Variable_value;
}
/** @apilevel internal */
private void unassignedAfter_Variable_reset() {
unassignedAfter_Variable_values = null;
}
protected java.util.Map unassignedAfter_Variable_values;
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN, isCircular=true)
@ASTNodeAnnotation.Source(aspect="DefiniteUnassignment", declaredAt="/home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:895")
public boolean unassignedAfter(Variable v) {
Object _parameters = v;
if (unassignedAfter_Variable_values == null) unassignedAfter_Variable_values = new java.util.HashMap(4);
ASTState.CircularValue _value;
if (unassignedAfter_Variable_values.containsKey(_parameters)) {
Object _cache = unassignedAfter_Variable_values.get(_parameters);
if (!(_cache instanceof ASTState.CircularValue)) {
return (Boolean) _cache;
} else {
_value = (ASTState.CircularValue) _cache;
}
} else {
_value = new ASTState.CircularValue();
unassignedAfter_Variable_values.put(_parameters, _value);
_value.value = true;
}
ASTState state = state();
if (!state.inCircle() || state.calledByLazyAttribute()) {
state.enterCircle();
boolean new_unassignedAfter_Variable_value;
do {
_value.cycle = state.nextCycle();
new_unassignedAfter_Variable_value = unassignedBefore(v);
if (((Boolean)_value.value) != new_unassignedAfter_Variable_value) {
state.setChangeInCycle();
_value.value = new_unassignedAfter_Variable_value;
}
} while (state.testAndClearChangeInCycle());
unassignedAfter_Variable_values.put(_parameters, new_unassignedAfter_Variable_value);
state.leaveCircle();
return new_unassignedAfter_Variable_value;
} else if (_value.cycle != state.cycle()) {
_value.cycle = state.cycle();
boolean new_unassignedAfter_Variable_value = unassignedBefore(v);
if (((Boolean)_value.value) != new_unassignedAfter_Variable_value) {
state.setChangeInCycle();
_value.value = new_unassignedAfter_Variable_value;
}
return new_unassignedAfter_Variable_value;
} else {
return (Boolean) _value.value;
}
}
/**
* @attribute syn
* @aspect StringsInSwitch
* @declaredat /home/jesper/git/extendj/java7/frontend/StringsInSwitch.jrag:61
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="StringsInSwitch", declaredAt="/home/jesper/git/extendj/java7/frontend/StringsInSwitch.jrag:61")
public boolean isDefaultCase() {
boolean isDefaultCase_value = false;
return isDefaultCase_value;
}
/**
* @attribute syn
* @aspect PreciseRethrow
* @declaredat /home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:78
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="PreciseRethrow", declaredAt="/home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:78")
public boolean modifiedInScope(Variable var) {
boolean modifiedInScope_Variable_value = false;
return modifiedInScope_Variable_value;
}
/** @apilevel internal */
private void label_reset() {
label_computed = null;
}
/** @apilevel internal */
protected ASTState.Cycle label_computed = null;
/** @apilevel internal */
protected int label_value;
/**
* @attribute syn
* @aspect CreateBCode
* @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1610
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN)
@ASTNodeAnnotation.Source(aspect="CreateBCode", declaredAt="/home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1610")
public int label() {
ASTState state = state();
if (label_computed == ASTState.NON_CYCLE || label_computed == state().cycle()) {
return label_value;
}
label_value = hostType().constantPool().newLabel();
if (state().inCircle()) {
label_computed = state().cycle();
} else {
label_computed = ASTState.NON_CYCLE;
}
return label_value;
}
/**
* Finds the first case label that has the same constant expression as
* this case label in the immediately enclosing switch statement.
* @attribute inh
* @aspect NameCheck
* @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:594
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH)
@ASTNodeAnnotation.Source(aspect="NameCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/NameCheck.jrag:594")
public Case previousCase(Case c) {
Object _parameters = c;
if (previousCase_Case_computed == null) previousCase_Case_computed = new java.util.HashMap(4);
if (previousCase_Case_values == null) previousCase_Case_values = new java.util.HashMap(4);
ASTState state = state();
if (previousCase_Case_values.containsKey(_parameters)
&& previousCase_Case_computed.containsKey(_parameters)
&& (previousCase_Case_computed.get(_parameters) == ASTState.NON_CYCLE || previousCase_Case_computed.get(_parameters) == state().cycle())) {
return (Case) previousCase_Case_values.get(_parameters);
}
Case previousCase_Case_value = getParent().Define_previousCase(this, null, c);
if (state().inCircle()) {
previousCase_Case_values.put(_parameters, previousCase_Case_value);
previousCase_Case_computed.put(_parameters, state().cycle());
} else {
previousCase_Case_values.put(_parameters, previousCase_Case_value);
previousCase_Case_computed.put(_parameters, ASTState.NON_CYCLE);
}
return previousCase_Case_value;
}
/** @apilevel internal */
private void previousCase_Case_reset() {
previousCase_Case_computed = null;
previousCase_Case_values = null;
}
/** @apilevel internal */
protected java.util.Map previousCase_Case_values;
/** @apilevel internal */
protected java.util.Map previousCase_Case_computed;
/**
* @attribute inh
* @aspect TypeCheck
* @declaredat /home/jesper/git/extendj/java4/frontend/TypeCheck.jrag:485
*/
@ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH)
@ASTNodeAnnotation.Source(aspect="TypeCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeCheck.jrag:485")
public TypeDecl switchType() {
TypeDecl switchType_value = getParent().Define_switchType(this, null);
return switchType_value;
}
/** @apilevel internal */
public ASTNode rewriteTo() {
return super.rewriteTo();
}
/** @apilevel internal */
public boolean canRewrite() {
return false;
}
}