⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nodelist.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
字号:
/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

package eti.bi.alphaminer.vo;


import java.io.Serializable;
import java.util.Hashtable;


/**
 * NodeList is a class responsible to store a number of nodes of a specified type.
 */
public class NodeList implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Type of nodes stored in this NodeList
	 */
	private int m_NodeListType;
	
	/**
	 * A Hashtable storing a number of node ID, node pairs
	 */
	private Hashtable<String, Object> m_NodeList;
	
	/**
	 * Contructs a NodeList
	 */
	public NodeList() {
	}
	
	/**
	 * Contructs a NodeList to store a specific type of node.
	 * @param a_NodeListType type of node to be stored.
	 */
	public NodeList(int a_NodeListType) {
		m_NodeListType = a_NodeListType;
		m_NodeList = new Hashtable<String, Object>();
	}

	/**
	 * Gets type of node stored in the NodeList.
	 * @return type of node stored.
	 */
	public int getNodeListType() {
		return m_NodeListType;
	}

	/**
	 * Sets type of node stored in the NodeList.
	 * @param a_Type type of node to be set.
	 */
	public void setNodeListType(int a_Type) {
		m_NodeListType = a_Type;
	}

	/**
	 * Gets a collection of nodes stored.
	 * @return Hashtable storing all nodes.
	 */
	public Hashtable<String, Object> getNodeList() {
		return m_NodeList;
	}

	/**
	 * Sets a collection of nodes stored in the NodeList.
	 * @param a_NodeList a collection of nodes.
	 */
	public void setNodeList(Hashtable<String, Object> a_NodeList) {
		m_NodeList = a_NodeList;
	}

	/**
	 * Gets all nodes stored in the NodeList.
	 * @return an array of nodes stored in the NodeList.
	 */
	public Node[] getNodeListArray() {
		Object[] objects = m_NodeList.values().toArray();
		if (objects == null)
			return null;

		Node[] nodes = new Node[objects.length];
		for (int i = 0; i < objects.length; i++)
			nodes[i] = (Node) objects[i];

		return nodes;
	}

	/**
	 * Gets a specific Node from the NodeList.
	 * @param a_NodeID ID of the node to be obtained.
	 * @return Node of the specified node ID.
	 */
	public Node getNode(String a_NodeID) {
		if (a_NodeID == null)
			System.err.println("In NodeList:getNode: node id is null");
		return (Node) m_NodeList.get(a_NodeID);
	}

	/**
	 * Sets a specific Node in the NodeList.
	 * @param a_NodeID ID of the node to be set.
	 * @param a_Node Node instance to be set.
	 */
	public void setNode(String a_NodeID, Node a_Node) {
		if (a_NodeID == null)
			System.err.println("In NodeList:setNode: node id is null");
		if (a_Node == null)
			System.err.println("In NodeList:setNode: node is null");
		m_NodeList.put(a_NodeID, a_Node);
	}

	/**
	 * Sets a specific Operator Node in the NodeList.
	 * @param a_NodeID ID of the node to be set.
	 * @param a_Node Node instance to be set.
	 */
	public void setOperatorNode(String a_NodeID, IOperatorNode a_Node) {
		if (a_NodeID == null)
			System.err.println("In NodeList:setNode: node id is null");
		if (a_Node == null)
			System.err.println("In NodeList:setNode: node is null");
		m_NodeList.put(a_NodeID, a_Node);
	}

	/**
	 * Removes a specific Node.
	 * @param a_NodeID ID of the node to be removed.
	 */
	public void removeNode(String a_NodeID) {
		if (a_NodeID == null)
			System.err.println("In NodeList:removeNode: node id is null");
		m_NodeList.remove(a_NodeID);
	}

	/**
	 * Gets the number of nodes stored in the NodeList.
	 * @return number of nodes stored in the NodeList.
	 */
	public int getNodeListSize() {
		return m_NodeList.size();
	}

	public boolean containNodeID(String a_ID)
	{
		return m_NodeList.containsKey(a_ID);
	}
}

⌨️ 快捷键说明

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