📄 blocknode.java
字号:
package ast.statement;
// children : all assignment on this account block
public class BlockNode extends ast.statement.StatementNode {
protected java.util.Vector children;
public BlockNode () {
children = new java.util.Vector ();
}
public void codegen () {
int i = 1;
for (java.util.Enumeration e = children.elements(); e.hasMoreElements(); ) {
ast.IJSubNode node = (ast.IJSubNode)e.nextElement ();
codegen.WriteCode.genComment ("Stat. " + i++);
node.codegen ();
}
}
public int getDepth () {
int depth = 0;
for (int i = 0; i < children.size(); ++i) {
ast.IJSubNode n = (ast.IJSubNode)children.elementAt(i);
int ndepth = n.getDepth() + 1;
if (depth < ndepth)
depth = ndepth;
}
return depth;
}
public void addChild(ast.IJSubNode n) {
children.addElement (n);
}
public String toString () {
return "{}";
}
public String toString (String prefix) {
return prefix + "{}";
}
public void dump(String prefix) {
System.out.println(prefix + toString());
for (int i = 0; i < children.size(); ++i) {
ast.IJSubNode n = (ast.IJSubNode)children.elementAt(i);
n.dump(prefix + " ");
}
}
public String getXMLType () {
return "block";
}
public void genXML (java.io.PrintStream p, String prefix) {
p.println (prefix + "<block>");
for (int i = 0; i < children.size(); ++i) {
ast.IJSubNode n = (ast.IJSubNode)children.elementAt(i);
n.genXML (p, prefix + " ");
}
p.println (prefix + "</block>");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -