nescincludefile.java

来自「plugin for eclipse」· Java 代码 · 共 73 行

JAVA
73
字号
/*
 * 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 java.util.ArrayList;
import java.util.Collection;
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 NesCIncludeFile extends NesCFile {
	ArrayList externalList = new ArrayList();
	
	public void outline(Outline o) {
		o.addTabs();
		o.append("/* NesC Include File: " + this.getFileName() + " */\n");
		o.incTabs();
		Iterator i = externalList.iterator();
		while (i.hasNext()) {
			Object obj = (Object) i.next();

			if (obj instanceof Declaration) {
				Declaration decl = (Declaration) obj;
				decl.outline(o);
				if(!(obj instanceof FunctionDefinition)) {
					o.append(";");
				}
			}

			if (obj instanceof AsmExpr) {
				AsmExpr a = (AsmExpr) obj;
				a.outline(o);
			}
			
			if (obj instanceof TNode) {
				TNode n = (TNode) obj;
				// o.append("/* TNode */");
				o.addTabs();
				o.append(n.getText());
			}
		
			if (obj instanceof TypelessDeclaration) {
				TypelessDeclaration tld = (TypelessDeclaration) obj;
				tld.outline(o);
			}
			
			o.addNewLine();
			
		}
		o.decTabs();
	}

	public void addExternal(Object o) {
		if(o instanceof ArrayList) {
			externalList.addAll((Collection) o);
		} else {
			externalList.add(o);
		}
	}
	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?