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

📄 decisionregion.java,v

📁 完整的模式识别库
💻 JAVA,V
字号:
head	1.3;access;symbols;locks; strict;comment	@# @;1.3date	2005.06.10.18.38.38;	author rirwin;	state Exp;branches;next	1.2;1.2date	2005.03.10.23.14.31;	author patil;	state Exp;branches;next	1.1;1.1date	2004.12.28.00.04.32;	author patil;	state Exp;branches;next	;desc@@1.3log@Establishing RCS version.@text@/** * file: DecisionRegion.java * */// 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: DecisionRegion * * class that stores the point of the various decision regions computed * */public class DecisionRegion implements Cloneable {    // *********************************************************************    //    // declare global variables and components    //    // *********************************************************************    // declate a vector to hold the initial guesses - means    //    public Vector<MyPoint> guesses;    // declare a vector to hold the decision region points    //    public Vector<DataSet> decisionRegion;    // *********************************************************************    //    // declare class constructors    //    // *********************************************************************    /**     * default class constructor     *     */    DecisionRegion()     {	// initialize the objects	//	decisionRegion = new Vector<DataSet>();    }    /**     * initializes the name and points included in the data set     *          * @@param   String name: name of the data set     * @@param   Vector vec: points included in the decision region     */    DecisionRegion(String name, Vector<MyPoint> vec)     {		// initialize the object and add the data set	//	decisionRegion = new Vector<DataSet>();	decisionRegion.addElement(new DataSet(name, vec));    }    // *********************************************************************    //    // declare class methods    //    // *********************************************************************        /**     * get the specified decision region     *     * @@param  name name of the decision region     *     * @@return  decision region points     */    public Vector<MyPoint> getRegion(String name)     {	// declare local variables	//	Vector<MyPoint> vec = new Vector<MyPoint>();	// check if the decision region is already present	//	for (int i = 0; i < decisionRegion.size(); i++) 	{	    // retrieve the specified data set	    //	    DataSet dataset = (DataSet)decisionRegion.elementAt(i);	    if (name.equals(dataset.getName())) 	    {		// retrieve the decision region		//		vec = (Vector<MyPoint>)dataset.getDataSet();		return vec;	    }	}		// return an empty region if it is not present	//	return vec;    }    /**     * get the number of data sets currently stored     *     * @@return  the number of data sets currently stored     */    public int getNumRegions()     {	// return the number of data sets stored	//	return (int)decisionRegion.size();    }    /**     * method retrieves a given data set based on the index     *     * @@param index the index of the data set     * @@return a given data set based on the index     */    public Vector<MyPoint> getRegion(int index) {		// get the required data set	//	DataSet dataset = (DataSet)decisionRegion.elementAt(index);	// return the required data set	//	return (Vector<MyPoint>)dataset.getDataSet();    }    /**     * method retrieves the initial guesses - means of the data sets     *     * @@return  the initial guesses - means of the data sets     */    public Vector<MyPoint> getGuesses()     {	// return the initial guesses	//	return (Vector<MyPoint>)guesses;    }    /**     * method sets the initial guesses - means of the data sets     *     * @@param  vec initial guesses     */    public void setGuesses(Vector<MyPoint> vec)     {	// set the initial guesses	//	guesses = (Vector<MyPoint>)vec;    }    /**     * add a set a decision region points     *     * @@param vec decision region points     */    public void addRegion(Vector<MyPoint> vec)     {	// add the data set to the existing list	//	decisionRegion.addElement(new DataSet(vec));    }    /**     * add a set a decision region points     *     * @@param vec decision region points     * @@param name name of the decision region     */    public void addRegion(Vector<MyPoint> vec, String name)     {	// declare local variables	//	boolean flag = false;	// check if the decision region is already present	//	for (int i = 0; i < decisionRegion.size(); i++) 	{	    // retrieve the specified data set	    //	    DataSet dataset = (DataSet)decisionRegion.elementAt(i);	    if (name.equals(dataset.getName())) 	    {		// update the decision region if already present		//		flag = true;		dataset.loadDataSet(vec);	    }	}	// if the decision region is not present then add it	//	if (!flag) 	{	    decisionRegion.addElement(new DataSet(name, vec));	}    }    /**     * add a point to the deciosion region     *     * @@param p decision region point     * @@param name name of the decision region     */    public void addPoint(MyPoint p, String name)     {	// declare local variables	//	boolean flag = false;	// add the point to the decision region	//	for (int i = 0; i < decisionRegion.size(); i++) 	{	    // retrieve the specified data set	    //	    DataSet dataset = (DataSet)decisionRegion.elementAt(i);	    if (name.equals(dataset.getName())) 	    {		// add the point the data set		//		flag = true;		dataset.addPoint(p);	    }	}	// if the decision region is not present then add it	//	if (!flag) 	{	    decisionRegion.addElement(new DataSet(name, p));	}    }    /**     * clears the specified decision region     *     * @@param name name of the decision region     */    public void clearRegion(String name)     {	// clear the decision region	//		for (int i = 0; i < decisionRegion.size(); i++) 	{	    	    // retrieve the specified data set	    //	    DataSet dataset = (DataSet)decisionRegion.elementAt(i);	    	    if (name.equals(dataset.getName())) 	    {				// clear all point from the decision region		//		dataset.clearDataSet();	    }	}    }        /**     * clears all decision regions     *     */    public void clearAllRegions()     {	// clear all decision region	//		for (int i = 0; i < decisionRegion.size(); i++) 	{	    // retrieve the specified data set	    //	    DataSet dataset = (DataSet)decisionRegion.elementAt(i);	    // clear the data set	    //	    dataset.clearDataSet();	}	// clear all decision regions	//	if (decisionRegion.size() > 0) 	{	    decisionRegion.removeAllElements();	}    }    public Vector<DataSet> getRegions()    {	return decisionRegion;    }    public DecisionRegion copy()    {	try 	{	    return (DecisionRegion)clone();	}	catch (CloneNotSupportedException e) 	{}		return null;	    }}@1.2log@comments style changed to Java Documentation Style@text@d6 1d23 1a23 1class DecisionRegion implements Cloneable d34 1a34 1    public Vector guesses;d38 1a38 1    public Vector decisionRegion;a46 5     * method: DecisionRegion     *     * @@param   none     * @@return  none     *d55 1a55 1	decisionRegion = new Vector();d59 2a60 2     * method: DecisionRegion     *a62 5     *     * @@return  none     *     * initializes the name and points included in the data set     *d64 1a64 1    DecisionRegion(String name, Vector vec) d69 1a69 1	decisionRegion = new Vector();d80 1a80 1     * method: getRegiond82 1a82 1     * @@param   String name: name of the decision regiona84 3     *     * get the specified decision region     *d86 1a86 1    public Vector getRegion(String name) d91 1a91 1	Vector vec = new Vector();d107 1a107 1		vec = (Vector)dataset.getDataSet();a117 5     * method: getNumRegions     *     * @@param   none     * @@return  none     *d120 1a130 5     * method: getRegion     *     * @@param   int index: the index of the data set     * @@return  none     *d133 2d136 1a136 1    public Vector getRegion(int index) {d144 1a144 1	return (Vector)dataset.getDataSet();a147 5     * method: getGuesses     *     * @@param   none     * @@return  none     *d150 1d152 1a152 1    public Vector getGuesses() d157 1a157 1	return (Vector)guesses;a160 5     * method: setGuesses     *     * @@param   Vector vec: initial guesses     * @@return  none     *d163 1d165 1a165 1    public void setGuesses(Vector vec) d170 1a170 1	guesses = (Vector)vec;a173 6     * method: addRegion     *     * @@param   Vector vec: decision region points     *     * @@return  none     *d176 1d178 1a178 1    public void addRegion(Vector vec) a186 7     * method: addRegion     *     * @@param   Vector vec: decision region points     * @@param   String name: name of the decision region     *     * @@return  none     *d189 2d192 1a192 1    public void addRegion(Vector vec, String name) a226 7     * method: addPoint     *     * @@param   Point p: decision region point     * @@param   String name: name of the decision region     *     * @@return  none     *d229 2a266 6     * method: clearRegion     *     * @@param   String name: name of the decision region     *     * @@return  none     *d269 1a293 5     * method: clearAllRegions     *     * @@param   none     * @@return  none     *d322 1a322 1    public Vector getRegions()@1.1log@Initial revision@text@d1 4a4 2// file: DecisionRegion.java//d16 8a23 5// class: DecisionRegion//// class that stores the point of the various decision regions computed//class DecisionRegion implements Cloneable {d45 11a55 8    // method: DecisionRegion    //    // arguments: none    // return   : none    //    // default class constructor    //    DecisionRegion() {d62 13a74 11    // method: DecisionRegion    //    // arguments:    //    String name: name of the data set    //    Vector vec: points included in the decision region    //    // return   : none    //    // initializes the name and points included in the data set    //    DecisionRegion(String name, Vector vec) {d88 12a99 10    // method: getRegion    //    // arguments:     //    String name: name of the decision region    //    // return   : decision region points    //    // get the specified decision region    //    public Vector getRegion(String name) {d107 2a108 1	for (int i = 0; i < decisionRegion.size(); i++) {d114 2a115 1	    if (name.equals(dataset.getName())) {d129 11a139 8    // method: getNumRegions    //    // arguments: none    // return   : none    //    // get the number of data sets currently stored    //    public int getNumRegions() {d146 9a154 8    // method: getRegion    //    // arguments:     //    int index: the index of the data set    // return   : none    //    // method retrieves a given data set based on the index    //d166 11a176 8    // method: getGuesses    //    // arguments: none    // return   : none    //    // method retrieves the initial guesses - means of the data sets    //    public Vector getGuesses() {d183 11a193 9    // method: setGuesses    //    // arguments:     //    Vector vec: initial guesses    // return   : none    //    // method sets the initial guesses - means of the data sets    //    public void setGuesses(Vector vec) {d200 12a211 10    // method: addRegion    //    // arguments:     //    Vector vec: decision region points    //    // return   : none    //    // add a set a decision region points    //    public void addRegion(Vector vec) {d218 13a230 11    // method: addRegion    //    // arguments:     //    Vector vec: decision region points    //    String name: name of the decision region    //    // return   : none    //    // add a set a decision region points    //    public void addRegion(Vector vec, String name) {d238 2a239 1	for (int i = 0; i < decisionRegion.size(); i++) {d245 2a246 1	    if (name.equals(dataset.getName())) {d257 2a258 1	if (!flag) {d263 13a275 11    // method: addPoint    //    // arguments:     //    Point p: decision region point    //    String name: name of the decision region    //    // return   : none    //    // add a point to the deciosion region    //    public void addPoint(MyPoint p, String name) {d283 2a284 1	for (int i = 0; i < decisionRegion.size(); i++) {d290 2a291 1	    if (name.equals(dataset.getName())) {d302 2a303 1	if (!flag) {d308 12a319 10    // method: clearRegion    //    // arguments:     //    String name: name of the decision region    //    // return   : none    //    // clears the specified decision region    //    public void clearRegion(String name) {d323 3a325 2	for (int i = 0; i < decisionRegion.size(); i++) {d329 3a331 2	    if (name.equals(dataset.getName())) {d339 12a350 9    // method: clearAllRegions    //    // arguments: none    // return   : none    //    // clears all decision regions    //    public void clearAllRegions() {d354 2a355 1	for (int i = 0; i < decisionRegion.size(); i++) {d368 2a369 1	if (decisionRegion.size() > 0) {d381 2a382 1	try {d386 1a386 1	    {}a391 2//// end of file@

⌨️ 快捷键说明

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