📄 interface.java
字号:
/*
* Created on May 8, 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 java.util.ArrayList;
import java.util.Iterator;
/**
* @author sallai
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Interface {
TNode defNode;
TNode nameNode;
String name;
// parent
NesCInterfaceFile interfaceFile;
// list of function declarations
ArrayList functionDeclarations = new ArrayList();
/**
* @return Returns the interfaceNameNode.
*/
public TNode getNameNode() {
return nameNode;
}
/**
* @param interfaceNameNode The interfaceNameNode to set.
*/
public void setNameNode(TNode interfaceNameNode) {
this.nameNode = interfaceNameNode;
this.name = interfaceNameNode.getText();
}
/**
* @param decl
*/
public void addFunctionDeclaration(FunctionDeclaration decl) {
functionDeclarations.add(decl);
if(decl!=null) {
decl.setParent(this);
}
}
/**
* @return Returns the interfaceName.
*/
public String getName() {
return name;
}
/**
* @param interfaceName The interfaceName to set.
*/
public void setName(String interfaceName) {
this.name = interfaceName;
if(nameNode!=null) {
nameNode.setText(interfaceName);
}
}
/**
* @return Returns the defNode.
*/
public TNode getDefNode() {
return defNode;
}
/**
* @param defNode The defNode to set.
*/
public void setDefNode(TNode defNode) {
this.defNode = defNode;
}
/**
* @return Returns the functionDeclarations.
*/
public ArrayList getFunctionDeclarations() {
return functionDeclarations;
}
public void outline(Outline o) {
o.addTabs();
o.append("interface");
o.ensureSpace();
o.append(getName());
o.append(" {\n");
Iterator i = getFunctionDeclarations().iterator();
while (i.hasNext()) {
FunctionDeclaration d = (FunctionDeclaration) i.next();
o.incTabs();
d.outline(o);
o.append(';');
o.append("\n");
o.decTabs();
}
o.addTabs();
o.append("}\n");
}
/**
* @param file
*/
public void setInterfaceFile(NesCInterfaceFile file) {
this.interfaceFile = file;
}
/**
* @return Returns the interfaceFile.
*/
public NesCInterfaceFile getInterfaceFile() {
return interfaceFile;
}
/**
* Alias for getInterfaceFile().
* @return parent interface file.
*/
public NesCInterfaceFile getParent() {
return getInterfaceFile();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -