enumerator.java
来自「plugin for eclipse」· Java 代码 · 共 104 行
JAVA
104 行
/*
* Created on May 9, 2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package isis.anp.nesc.ot;
import isis.anp.common.TNode;
import isis.anp.nesc.NesCEmitter;
import isis.anp.nesc.ot.scope.Scope;
import isis.anp.nesc.ot.scope.Symbol;
import isis.anp.nesc.ot.types.EnumType;
import antlr.RecognitionException;
/**
* @author sallai
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Enumerator implements Symbol {
TNode defNode;
String name;
Expression expression;
Scope parentScope;
EnumType type;
public TNode getDefNode() {
return defNode;
}
public void setDefNode(TNode defNode) {
this.defNode = defNode;
this.name = defNode.getText();
}
public Expression getExpression() {
return expression;
}
public void setExpression(Expression e) {
this.expression = e;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
if(defNode!=null) {
defNode.setText(name);
}
}
public TNode getNameNode() {
return getDefNode();
}
public void setNameNode(TNode n) {
setDefNode(n);
}
public void setParentScope(Scope parentScope) {
this.parentScope = parentScope;
}
public Scope getParentScope() {
return parentScope;
}
public String getHierarchicalName() {
StringBuffer sb = new StringBuffer();
if (getParentScope() != null) {
sb.append(getParentScope().getHierarchicalName());
}
sb.append("::");
sb.append(getName());
return sb.toString();
}
/**
* @param type
*/
public void setType(EnumType type) {
this.type = type;
}
/**
* @return Returns the type.
*/
public EnumType getType() {
return type;
}
public void outline(Outline o) {
NesCEmitter e = new NesCEmitter(o);
try {
e.enumerator(this.defNode);
} catch(RecognitionException ex) {
o.append("/* Exception while printing out enumerator constant: +" + ex.toString() +" */");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?