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

📄 dataset.java

📁 包含了模式识别中常用的一些分类器设计算法
💻 JAVA
字号:
/** * file: DataSet.java * * last edited: Ryan Irwin * */// import necessary java libraries//import java.awt.*;import java.util.*;//These imports are not needed - Phil T. 6-23-03//import javax.swing.border.*;//import java.awt.event.*;//import javax.swing.*;/** * class that stores the point of the various decision regions computed * */class DataSet {    // *********************************************************************    //    // declare global variables and components    //    // *********************************************************************        // declare global variables    //    public String name;              // name tag associated with the data set    public Vector<MyPoint> points;   // samples associated with the data set    public Color color;              // color associated with data set samples    // ********************************************************************    //    // declare class constructors    //    // ********************************************************************    /**     * default class constructor     *     */    DataSet() {	// initialize the objects	//	name = new String();	points = new Vector<MyPoint>();    }    /**     * initializes the points included in the data set     *     * @param   vec Vector of points included in the data set     *     */    DataSet(Vector<MyPoint> vec) {		// initialize the variables	//	name = new String("none");	points = vec;    }    /**     * method: DataSet     *     * @param   nam name of the data set     * @param   vec points included in the data set     *     * @return  none     *     * initializes the name and points included in the data set     *     */    DataSet(String n, Vector<MyPoint> vec) {		// initialize the variables	//	name = n;	points = vec;    }    /**     * initializes the name and a point to the decision region     *     * @param  n String name of the data set     * @param  p MyPoint value of new decision region point     */    DataSet(String n, MyPoint p) {		// initialize the variables	//	name = n;	points = new Vector<MyPoint>();	points.addElement(p);    }    // *********************************************************************    //    // declare class methods    //    // *********************************************************************    /**     * set the name of the data set     *     * @param  n data set name     *     */    public void setName(String n) {	name = n;    }    /**     * retrieves the data set name     *     * return   data set name     */    public String getName() {	return name;    }    /**     * load a new data set     *     * @param   vec Vector of new data set     *     */    public void loadDataSet(Vector<MyPoint> vec) {	points = vec;    }    /**     * clear the data set presently loaded     *     */    public void clearDataSet() {	points.removeAllElements();    }    /**     * add a new point to the data set     *     * @param   p MyPoint variable to add     *     */    public void addPoint(MyPoint p) {	points.addElement(p);    }    /**     * retrieves the point at a particular index     *     * @param  index index of the point     *     * @return  the indexed point     *     */    public MyPoint getPointAt(int index) {	return (MyPoint)points.elementAt(index);    }    /**     * retrieves the point corresponding to the data set     *     * @return  point of the data set     */    public Vector<MyPoint> getDataSet() {	return (Vector<MyPoint>)points;    }    /**     * retrieves the size of the data set     *     * @return  data set size     */    public int dataSetSize() {	return points.size();    }}

⌨️ 快捷键说明

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