compoundstatement.java
来自「plugin for eclipse」· Java 代码 · 共 102 行
JAVA
102 行
/*
* 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.nesc.ot.scope.Scope;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* @author sallai
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class CompoundStatement extends Statement {
ArrayList declarations = new ArrayList();
ArrayList statements = new ArrayList();
Scope scope;
public void addDeclarations(List declnList) {
declarations.addAll(declnList);
// set this compoundstatement as parent of the declarations
Iterator i = declnList.iterator();
while (i.hasNext()) {
Declaration d = (Declaration) i.next();
d.setParent(this);
}
}
public void addStatements(List stList) {
statements.addAll(stList);
// set this compoundstatement as parent of the statements
Iterator i = stList.iterator();
while (i.hasNext()) {
Statement s = (Statement) i.next();
s.setParent(this);
}
}
public void setScope(Scope scope) {
this.scope = scope;
}
public void outline(Outline o) {
o.addTabs();
if(this.isAtomic()) {
o.append("atomic");
o.ensureSpace();
}
o.append("{\n");
Iterator i = declarations.iterator();
while (i.hasNext()) {
Declaration d = (Declaration) i.next();
o.incTabs();
d.outline(o);
o.decTabs();
o.append(";\n");
}
// o.append("\n");
Iterator j = statements.iterator();
while (j.hasNext()) {
Statement s = (Statement) j.next();
o.incTabs();
s.outline(o);
o.decTabs();
o.append("\n");
}
o.addTabs();
o.append("}");
}
/**
* @return Returns the declarations.
*/
public ArrayList getDeclarations() {
return declarations;
}
/**
* @return Returns the scope.
*/
public Scope getScope() {
return scope;
}
/**
* @return Returns the statements.
*/
public ArrayList getStatements() {
return statements;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?