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

📄 fuzzysystem.java

📁 A Java class representation of a fuzzy cognitive map which contains a set of factors and relationsh
💻 JAVA
字号:
/*Fuzzy Cognitive MapCopyright (c) 2001, Guillermo Ochoa de AspuruThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.http://www.gnu.org================================================Author: Guillermo Ochoa de Aspuru        http://www.ochoadeaspuru.com        guillermo@ochoadeaspuru.com================================================Change Log:Date          Version        Who25 Nov 2001 - 0.0            G. Ochoa de AspuruCreated*/import java.util.*;/**This class represents a fuzzy system (also know as a fuzzy cognitivemap). The fuzzy system contains a set of factors and relationships between them.@author Guillermo Ochoa de Aspuru*/public class FuzzySystem {	// Vector of Factor. The factors of this fuzzy map.	private Vector factorCollection;	// The name of this fuzzy system	private String systemName;		/** 	Default constructor.	*/	FuzzySystem()	{		this("");	}		/**	Constructor.	@param n the name of this fuzzy system.	*/	FuzzySystem(final String n)	{		systemName = n;		factorCollection = new Vector();	}		/**	Returns the name of this fuzzy system.	@return the name of this fuzzy map.	*/	public String getName()	{		return systemName;	}		/**	Sets the name of this fuzzy system.	@param n the name for this fuzzy system.	*/	public void setName(final String n)	{		systemName = n;	}		/**	Returns the number of factors of this fuzzy system.	@return the number of factors.	*/	public int getNumberOfFactors()	{		return factorCollection.size();	}		/**	Returns a reference to one of the factors of this	fuzzy system.	@param index the index of the factor required (zero based).	@return the factor of this fuzzy system at the required position.	*/	public Factor getFactorByIndex(int index)	{		return (Factor)(factorCollection.elementAt(index));	}		/**	Returns the collection of factors of this fuzzy map.	@return a <code>Vector</code> of <code>Factor</code> objects.	*/	public Vector getFactors()	{		return factorCollection;	}		/**	Sets the collection of factors of this fuzzy map.	@param a <code>Vector</code> of <code>Factor</code> objects.	*/	public void setFactors(Vector f)	{		factorCollection = f;	}		/**	Adds a factor to this fuzzy system.	@param a <code>Factor</code> object to be added to this	fuzzy map.	*/	public void addFactor(Factor f)	{		factorCollection.addElement(f);	}		/**	Removes the factor of this system at the indicated position.	@param index the position of the factor to be removed (zero based).	*/	public void removeFactorByIndex(int index)	{		// Get the factor to be removed		Factor removedFactor = (Factor)(factorCollection.elementAt(index));					// Remove the factor from the collection of factors		factorCollection.removeElementAt(index);					// Loop over the remaining factors of the collection of factors		// and remove the factor as a cause		for (int j = 0; j < factorCollection.size(); ++j) {			((Factor)(factorCollection.elementAt(j))).removeCause(removedFactor);		}	}		/**	Removes all the factors of this fuzzy system.	*/	public void removeAllFactors()	{		factorCollection.removeAllElements();	}}

⌨️ 快捷键说明

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