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

📄 inputvectors.java

📁 som with java for clustering map and prépare map for lvq
💻 JAVA
字号:
package fi.javasom.jsom;
/**
 * This is the main container for the input vectors.
 *
 *  Copyright (C) 2001  Tomi Suuronen
 *
 *  @version 1.0
 *
 *  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

import fi.javasom.jsom.SomNode;
import java.util.Vector;

public class InputVectors
{
	private Vector input; //input vectors

	/**
	 * Main constructor for this map. Used to contain all the input vectors.
	*/
	public InputVectors()
	{
		input = new Vector(0,10);
	}

	/**
	 * Adds a new input vector.
	 *
	 * @param SomNode node - the SomNode object added
	*/
	public void addInputVector(SomNode node)
	{
		input.addElement(node);
	}

	/**
	 * Returns a input vector from the specified index.
	 *
	 * @param int index - the index of SomNode.
	 * @return SomNode - returns the SomNode object at the specified index.
	*/
	public SomNode getSomNodeAt(int index)
	{
		return ((SomNode)input.elementAt(index));
	}

	/**
	 * Returns a Node values of a specific input vector from the specified index.
	 *
	 * @param int index - the index of SomNode.
	 * @return double[] - returns the Node values from the specified index.
	*/
	public double[] getNodeValuesAt(int index)
	{
		SomNode cache = (SomNode)input.elementAt(index);
		return (cache.getValues());
	}

	/**
	 * Sets the node values at a specific node.
	 *
	 * @param int index - index of the SomNode
	 * @param double[] values - values of the SomNode
	*/
	public void setNodeValuesAt(int index,double[] values)
	{
		SomNode cache = (SomNode)input.elementAt(index);
		cache.setValues(values);
		input.setElementAt(cache,index);
	}

	/**
	 * Returns a Node label of a specific input vector from the specified index.
	 *
	 * @param int index - the index of SomNode.
	 * @return String - returns the Node label from the specified index.
	*/
	public String getNodeLabelAt(int index)
	{
		SomNode cache = (SomNode)input.elementAt(index);
		return (cache.getLabel());
	}

	/**
	 * Returns the number of input vectors.
	 *
	 * @return int - returns the number of input vectors.
	*/
	public int getCount()
	{
		return input.size();
	}
}

⌨️ 快捷键说明

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