net.sourceforge.fuzzyservices.beans
Class LinguisticVariable

java.lang.Object
  extended by net.sourceforge.fuzzyservices.beans.LinguisticVariable
All Implemented Interfaces:
Serializable

public class LinguisticVariable
extends Object
implements Serializable

This class represents a linguistic variable according to JavaBeans conventions.

Version:
1.0
Author:
Uwe Weng
See Also:
LinguisticVariable, Serialized Form

Field Summary
static String LINGUISTIC_TERMS_PROPERTY
          Bound property name for linguisticTerms.
static String NAME_PROPERTY
          Bound property name for name.
 
Constructor Summary
LinguisticVariable()
          Default LinguisticVariable constructor.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 void addVetoableChangeListener(VetoableChangeListener listener)
          Adds a VetoableChangeListener to the listener list.
 Object clone()
           
 boolean contains(LinguisticTerm linguisticTerm)
          Tests whether or not the linguisticTerm is part of this linguistic variable.
 boolean equals(Object obj)
           
 int getId()
          Returns the technical identifier (e.g. within a database).
 LinguisticTerm getLinguisticTerm(String aName)
          Gets the linguistic term with the specified name of this linguistic variable.
 LinguisticTerm[] getLinguisticTerms()
          Returns all linguistic terms of this linguistic variable.
 LinguisticTerm getLinguisticTerms(int index)
          Gets the linguistic term located at the specified index of this linguistic variable.
 String getName()
          Returns the name of this linguistic variable.
 int hashCode()
           
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Removes a VetoableChangeListener from the listener list.
 void setLinguisticTerms(int index, LinguisticTerm newLinguisticTerms)
          Replaces a linguistic term of this linguistic variable.
 void setLinguisticTerms(LinguisticTerm[] newLinguisticTerms)
          Defines new linguistic terms for this linguistic variable.
 void setName(String newName)
          Sets the name of this linguistic variable.
 String toString()
           
 String toString(boolean withTerms)
          Returns a textual representation of the linguistic variable
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_PROPERTY

public static final String NAME_PROPERTY
Bound property name for name.

See Also:
Constant Field Values

LINGUISTIC_TERMS_PROPERTY

public static final String LINGUISTIC_TERMS_PROPERTY
Bound property name for linguisticTerms.

See Also:
Constant Field Values
Constructor Detail

LinguisticVariable

public LinguisticVariable()
Default LinguisticVariable constructor.

Method Detail

getId

public int getId()
Returns the technical identifier (e.g. within a database).

Returns:
the ID

getName

public String getName()
Returns the name of this linguistic variable.

Returns:
the name property
See Also:
setName(java.lang.String)

getLinguisticTerms

public LinguisticTerm[] getLinguisticTerms()
Returns all linguistic terms of this linguistic variable.

Returns:
the linguisticTerms property
See Also:
setLinguisticTerms(LinguisticTerm[])

getLinguisticTerms

public LinguisticTerm getLinguisticTerms(int index)
                                  throws ArrayIndexOutOfBoundsException
Gets the linguistic term located at the specified index of this linguistic variable.

Parameters:
index - the position of the linguistic term to be returned.
Returns:
the linguistic term located at the specified index.
Throws:
ArrayIndexOutOfBoundsException - if index is an invalid position
See Also:
setLinguisticTerms(LinguisticTerm[])

getLinguisticTerm

public LinguisticTerm getLinguisticTerm(String aName)
Gets the linguistic term with the specified name of this linguistic variable.

Parameters:
aName - the name of the linguistic term to be returned.
Returns:
the linguistic term with the specified name.
See Also:
setLinguisticTerms(LinguisticTerm[])

setLinguisticTerms

public final void setLinguisticTerms(LinguisticTerm[] newLinguisticTerms)
                              throws IllegalArgumentException,
                                     PropertyVetoException
Defines new linguistic terms for this linguistic variable.

Parameters:
newLinguisticTerms - An array with linguistic terms
Throws:
IllegalArgumentException - if there are identical terms
PropertyVetoException - when the attempt to set the property is vetoed by a listener
See Also:
getLinguisticTerms()

setLinguisticTerms

public final void setLinguisticTerms(int index,
                                     LinguisticTerm newLinguisticTerms)
                              throws ArrayIndexOutOfBoundsException,
                                     IllegalArgumentException,
                                     PropertyVetoException
Replaces a linguistic term of this linguistic variable.

Parameters:
index - The index value into the property array.
newLinguisticTerms - A new linguistic term for this linguistic variable
Throws:
ArrayIndexOutOfBoundsException - if index is an invalid position
IllegalArgumentException - if there are identical terms
PropertyVetoException - when the attempt to set the property is vetoed by a listener
See Also:
getLinguisticTerms()

setName

public final void setName(String newName)
                   throws PropertyVetoException
Sets the name of this linguistic variable.

Parameters:
newName - The new value for the property.
Throws:
PropertyVetoException - when the attempt to set the property is vetoed by a listener
See Also:
getName()

contains

public final boolean contains(LinguisticTerm linguisticTerm)
Tests whether or not the linguisticTerm is part of this linguistic variable.

Parameters:
linguisticTerm - The linguistic term to check
Returns:
true if the linguisticTerm is part of this linguistic variable, false otherwise.
See Also:
setLinguisticTerms(LinguisticTerm[])

addVetoableChangeListener

public final void addVetoableChangeListener(VetoableChangeListener listener)
Adds a VetoableChangeListener to the listener list. The listener is registered for all properties.

Parameters:
listener - the VetoableChangeListener to be added

removeVetoableChangeListener

public final void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a VetoableChangeListener from the listener list. This removes a VetoableChangeListener that was registered for all properties.

Parameters:
listener - the VetoableChangeListener to be removed

addPropertyChangeListener

public final void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. The listener is registered for all properties.

A PropertyChangeEvent will get fired in response to setting a bound property.

Parameters:
listener - the PropertyChangeListener to be added

removePropertyChangeListener

public final void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener - the PropertyChangeListener to be removed

clone

public Object clone()
Overrides:
clone in class Object

equals

public final boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(boolean withTerms)
Returns a textual representation of the linguistic variable

Parameters:
withTerms - true if all linguistic term definitions are also returned, false otherwise.
Returns:
a string representation of the linguistic variable
See Also:
LinguisticTerm.toString()


Copyright © 2007-2012 Fuzzy Services. All Rights Reserved.