parametertypelist.java

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

JAVA
81
字号
/*
 * Created on May 4, 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 java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;


/**
 * @author sallai
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class ParameterTypeList {
//	ArrayList pdList = new ArrayList();
//	HashMap pdMap = new HashMap();
	LinkedHashMap pdMap = new LinkedHashMap();
//	TNode declNode = null;
	boolean varArgsPresent = false;
	Object parent;
	
	public ParameterTypeList() {
	}

	/**
	 * @param pd
	 */
	public void addParameterDeclaration(ParameterDeclaration pd) {
//		pdList.add(pd);
		pdMap.put(pd.getName(), pd);		
	}
	
	public void outline(Outline o) {

		if(!pdMap.isEmpty()) {
			Iterator i = pdMap.values().iterator();
			while (i.hasNext()) {
				ParameterDeclaration pd = (ParameterDeclaration) i.next();
				int tabs = o.getTabs();
				o.setTabs(0);
				pd.outline(o);
				o.setTabs(tabs);
				if(i.hasNext()) o.append(",");
				o.ensureSpace();
			}
			
			if(varArgsPresent) o.append(", ...");
		}
	}

	/**
	 * 
	 */
	public void addVarArgs() {
		varArgsPresent = true;
	}
	
	public Collection getParameterDeclarations() {
		return pdMap.values();
	}

	/**
	 * @param port
	 */
	public void setParent(Object o) {
		this.parent = o;
	}
	/**
	 * @return Returns the parent.
	 */
	public Object getParent() {
		return parent;
	}
}

⌨️ 快捷键说明

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