port.java

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

JAVA
134
字号
/*
 * 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.List;


/**
 * @author sallai
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public abstract class Port {
	public class Direction
	{
		public final static int USES = 0;

		public final static int PROVIDES = 1;
	};
	int direction;
	String name;
	TNode nameNode;
	
	ArrayList connections = new ArrayList();
	
	ParameterTypeList parameterTypeList;

	// parent
	Component component;

	public abstract String getPortName();


	public ParameterTypeList getParameterTypeList() {
		return parameterTypeList;
	}

	public void setParameterTypeList(ParameterTypeList parameterTypeList) {
		this.parameterTypeList = parameterTypeList;
		if(parameterTypeList!=null) {
			parameterTypeList.setParent(this);
		}
	}

	void addTabs(StringBuffer sb, int tabs) {
		for(int i=0; i<tabs; ++i) sb.append("\t");
	}

	public abstract void outline(Outline o); 
	

	/**
	 * @param component
	 */
	public void setComponent(Component component) {
		this.component = component;
	}
	/**
	 * @return Returns the component.
	 */
	public Component getComponent() {
		return component;
	}
	
	/**
	 * Alias for getComponent().
	 * @return the parent component.
	 */
	public Component getParent() {
		return getComponent();
	}

	/**
	 * @return Returns the direction.
	 */
	public int getDirection() {
		return direction;
	}
	/**
	 * @param direction The direction to set.
	 */
	public void setDirection(int direction) {
		this.direction = direction;
	}
	/**
	 * @return Returns the alias.
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param alias The alias to set.
	 */
	public void setName(String alias) {
		this.name = alias;
		if(nameNode!=null) {
			nameNode.setText(alias);
		}
	}
	/**
	 * @return Returns the aliasNode.
	 */
	public TNode getNameNode() {
		return nameNode;
	}
	/**
	 * @param aliasNode The aliasNode to set.
	 */
	public void setNameNode(TNode aliasNode) {
		this.nameNode = aliasNode;
		if(aliasNode != null) {
//			System.out.println("Alias is set to: "+aliasNode.getText());
			this.name = aliasNode.getText();
		}
	}
	
	public void addConnection(Connection c) {
		connections.add(c);
	}
	
	public List getConnections() {
		return connections;
	}
	
	public abstract String getTypeString();
}

⌨️ 快捷键说明

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