net.sourceforge.fuzzyservices.beans
Class FuzzyLRNumber

java.lang.Object
  extended by net.sourceforge.fuzzyservices.beans.FuzzyLRNumber
All Implemented Interfaces:
PropertyChangeListener, VetoableChangeListener, Serializable, EventListener

public class FuzzyLRNumber
extends Object
implements Serializable, PropertyChangeListener, VetoableChangeListener

This class represents a fuzzy number of type LR according to JavaBeans conventions.

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

Field Summary
static String ALPHA_PROPERTY
          Bound property name for alpha.
static String BETA_PROPERTY
          Bound property name for beta.
static String MEMBERSHIP_FUNCTION_PROPERTY
          Bound property name for membershipFunction.
static String NEGATIVE_PROPERTY
          Bound property name for negative.
static String POSITIVE_PROPERTY
          Bound property name for positive.
 
Constructor Summary
FuzzyLRNumber()
          Default FuzzyNumberBean constructor.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 Object clone()
           
 boolean equals(Object obj)
           
 float getAlpha()
          Returns the spread on the left falling edge.
 float getBeta()
          Returns the spread on the right falling edge.
 int getId()
          Returns the technical identifier (e.g. within a database).
 MembershipFunction getMembershipFunction()
          Returns the membership function.
 int hashCode()
           
 void invert()
          Inverts this fuzzy LR number.
 boolean isNegative()
          Checks whether the fuzzy number of type LR is negative.
 boolean isPositive()
          Checks whether the fuzzy number of type LR is positive.
 void negate()
          Negates this fuzzy LR number.
 void propertyChange(PropertyChangeEvent evt)
           
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void setMembershipFunction(MembershipFunction newMembershipFunction)
          Sets the membership function.
 String toString()
           
 String toString(boolean withMembershipFunction)
          Returns a textual representation of the fuzzy LR number
 void vetoableChange(PropertyChangeEvent evt)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MEMBERSHIP_FUNCTION_PROPERTY

public static final String MEMBERSHIP_FUNCTION_PROPERTY
Bound property name for membershipFunction.

See Also:
Constant Field Values

NEGATIVE_PROPERTY

public static final String NEGATIVE_PROPERTY
Bound property name for negative.

See Also:
Constant Field Values

POSITIVE_PROPERTY

public static final String POSITIVE_PROPERTY
Bound property name for positive.

See Also:
Constant Field Values

ALPHA_PROPERTY

public static final String ALPHA_PROPERTY
Bound property name for alpha.

See Also:
Constant Field Values

BETA_PROPERTY

public static final String BETA_PROPERTY
Bound property name for beta.

See Also:
Constant Field Values
Constructor Detail

FuzzyLRNumber

public FuzzyLRNumber()
Default FuzzyNumberBean constructor. This constructor creates a valid default fuzzy number of type LR with the coordinates (0.0, 0.0), (1.0, 1.0) and (2.0, 0.0). Hence, this number has got an alpha = beta = 1.0.

Method Detail

getId

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

Returns:
the ID

getMembershipFunction

public final MembershipFunction getMembershipFunction()
Returns the membership function.

Returns:
the membershipFunction property
See Also:
setMembershipFunction(MembershipFunction)

setMembershipFunction

public final void setMembershipFunction(MembershipFunction newMembershipFunction)
Sets the membership function.

Parameters:
newMembershipFunction - The new value for the property.
See Also:
getMembershipFunction()

getAlpha

public final float getAlpha()
Returns the spread on the left falling edge. It is the so-called alpha value.

Returns:
the spread alpha

getBeta

public final float getBeta()
Returns the spread on the right falling edge. It is the so-called beta value.

Returns:
the spread beta

invert

public final void invert()
                  throws PropertyVetoException
Inverts this fuzzy LR number.

Throws:
PropertyVetoException - when the attempt to set the property is vetoed by a listener

isNegative

public final boolean isNegative()
Checks whether the fuzzy number of type LR is negative. A fuzzy LR number is negative if degree of membership is only greater than zero when x is lower than zero.

Returns:
true if fuzzy LR number is negative, false otherwise

isPositive

public final boolean isPositive()
Checks whether the fuzzy number of type LR is positive. A fuzzy LR number is positive if degree of membership is only greater than zero when x is also greater than zero.

Returns:
true if fuzzy LR number is positive, false otherwise

negate

public final void negate()
                  throws PropertyVetoException
Negates this fuzzy LR number.

Throws:
PropertyVetoException - when the attempt to set the property is vetoed by a listener

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

propertyChange

public final void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener

vetoableChange

public final void vetoableChange(PropertyChangeEvent evt)
                          throws PropertyVetoException
Specified by:
vetoableChange in interface VetoableChangeListener
Throws:
PropertyVetoException

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 withMembershipFunction)
Returns a textual representation of the fuzzy LR number

Parameters:
withMembershipFunction - true if all points of membership function are also returned, false otherwise.
Returns:
a string representation of the fuzzy LR number
See Also:
MembershipFunction.toString()


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