net.sourceforge.fuzzyservices.beans
Class Rule

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

public class Rule
extends Object
implements VetoableChangeListener, Serializable

This class represents a rule according to JavaBeans conventions.

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

Field Summary
static String AGGREGATION_OPERTAOR_PROPERTY
          Bound property name for aggregationOperator.
static String ANTECEDENTS_PROPERTY
          Bound property name for antecedents.
static String CERTAINTY_OPERATOR_PROPERTY
          Bound property name for certaintyOperator.
static String CERTAINTY_PROPERTY
          Bound property name for certainty.
static String CONSEQUENTS_PROPERTY
          Bound property name for consequents.
static String INFERENCE_OPERATOR_PROPERTY
          Bound property name for inferenceOperator.
 
Constructor Summary
Rule()
          Default Rule constructor.
Rule(Antecedent[] newAntecedents, Consequent[] newConsequents, Operator newAggregationOperator, Operator newInferenceOperator, Operator newCertaintyOperator, float newCertainty)
          Constructs a new rule with specified property values.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 Object clone()
           
 boolean equals(Object obj)
           
 Operator getAggregationOperator()
          Returns the aggregation operator of this rule.
 Antecedent[] getAntecedents()
          Returns all antecedents of this rule.
 Antecedent getAntecedents(int index)
          Gets the antecedent located at the specified index of this rule.
 float getCertainty()
          Returns the certainty of this rule.
 Operator getCertaintyOperator()
          Returns the certainty operator of this rule.
 Consequent[] getConsequents()
          Returns all consequents of this rule.
 Consequent getConsequents(int index)
          Gets the consequent located at the specified index of this rule.
 int getId()
          Returns the technical identifier (e.g. within a database).
 Operator getInferenceOperator()
          Returns the inference operator of this rule.
 int hashCode()
           
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void setAggregationOperator(Operator newAggregationOperator)
          Sets the aggregation operator of this rule.
 void setAntecedents(Antecedent[] newAntecedents)
          Defines new antecedents for this rule.
 void setAntecedents(int index, Antecedent newAntecedents)
          Replaces a antecedent of this rule.
 void setCertainty(float newCertainty)
          Sets the certainty for this rule.
 void setCertaintyOperator(Operator newCertaintyOperator)
          Sets the certainty operator of this rule.
 void setConsequents(Consequent[] newConsequents)
          Defines new consequents for this rule.
 void setConsequents(int index, Consequent newConsequents)
          Replaces a consequent of this rule.
 void setInferenceOperator(Operator anInferenceOperator)
          Sets the inference operator of this rule.
 String toString()
           
 void vetoableChange(PropertyChangeEvent evt)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ANTECEDENTS_PROPERTY

public static final String ANTECEDENTS_PROPERTY
Bound property name for antecedents.

See Also:
Constant Field Values

CONSEQUENTS_PROPERTY

public static final String CONSEQUENTS_PROPERTY
Bound property name for consequents.

See Also:
Constant Field Values

AGGREGATION_OPERTAOR_PROPERTY

public static final String AGGREGATION_OPERTAOR_PROPERTY
Bound property name for aggregationOperator.

See Also:
Constant Field Values

CERTAINTY_OPERATOR_PROPERTY

public static final String CERTAINTY_OPERATOR_PROPERTY
Bound property name for certaintyOperator.

See Also:
Constant Field Values

INFERENCE_OPERATOR_PROPERTY

public static final String INFERENCE_OPERATOR_PROPERTY
Bound property name for inferenceOperator.

See Also:
Constant Field Values

CERTAINTY_PROPERTY

public static final String CERTAINTY_PROPERTY
Bound property name for certainty.

See Also:
Constant Field Values
Constructor Detail

Rule

public Rule()
Default Rule constructor. This constructor sets the default operators specified in Rule, and registers itself as vetoable change listeners.

See Also:
Rule.getDefaultAggregationOperator(), Rule.getDefaultCertaintyOperator(), Rule.getDefaultInferenceOperator()

Rule

public Rule(Antecedent[] newAntecedents,
            Consequent[] newConsequents,
            Operator newAggregationOperator,
            Operator newInferenceOperator,
            Operator newCertaintyOperator,
            float newCertainty)
Constructs a new rule with specified property values.

Parameters:
newAntecedents - The new value for the property antecedents.
newConsequents - The new value for the property consequents.
newAggregationOperator - The new value for the property aggregationOperator.
newInferenceOperator - The new value for the property inferenceOperator.
newCertaintyOperator - The new value for the property certaintyOperator.
newCertainty - The new value for the property certainty.
Method Detail

getId

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

Returns:
the ID

getAntecedents

public Antecedent[] getAntecedents()
Returns all antecedents of this rule.

Returns:
the antecedents property
See Also:
setAntecedents(net.sourceforge.fuzzyservices.beans.Antecedent[])

getAntecedents

public Antecedent getAntecedents(int index)
Gets the antecedent located at the specified index of this rule.

Parameters:
index - the position of the antecedent to be returned.
Returns:
the antecedent located at the specified index.
See Also:
setAntecedents(net.sourceforge.fuzzyservices.beans.Antecedent[])

getConsequents

public Consequent[] getConsequents()
Returns all consequents of this rule.

Returns:
the consequents property
See Also:
setConsequents(net.sourceforge.fuzzyservices.beans.Consequent[])

getConsequents

public Consequent getConsequents(int index)
Gets the consequent located at the specified index of this rule.

Parameters:
index - the position of the consequent to be returned.
Returns:
the consequent located at the specified index.
See Also:
setConsequents(net.sourceforge.fuzzyservices.beans.Consequent[])

getAggregationOperator

public Operator getAggregationOperator()
Returns the aggregation operator of this rule.

Returns:
the aggregationOperator property
See Also:
setAggregationOperator(net.sourceforge.fuzzyservices.beans.Operator)

getCertaintyOperator

public Operator getCertaintyOperator()
Returns the certainty operator of this rule.

Returns:
the certaintyOperator property
See Also:
setCertaintyOperator(net.sourceforge.fuzzyservices.beans.Operator)

getInferenceOperator

public Operator getInferenceOperator()
Returns the inference operator of this rule.

Returns:
the inferenceOperator property
See Also:
setInferenceOperator(net.sourceforge.fuzzyservices.beans.Operator)

getCertainty

public float getCertainty()
Returns the certainty of this rule.

Returns:
the certainty property
See Also:
setCertainty(float)

setAggregationOperator

public void setAggregationOperator(Operator newAggregationOperator)
Sets the aggregation operator of this rule. It has to fulfill the t-norm.

Parameters:
newAggregationOperator - The new value for the property.
See Also:
getAggregationOperator()

setAntecedents

public void setAntecedents(Antecedent[] newAntecedents)
Defines new antecedents for this rule.

Parameters:
newAntecedents - An array with antecedents
See Also:
getAntecedents(int)

setAntecedents

public void setAntecedents(int index,
                           Antecedent newAntecedents)
Replaces a antecedent of this rule.

Parameters:
index - The index value into the property array.
newAntecedents - A new antecedent for this rule
See Also:
getAntecedents(int)

setCertainty

public void setCertainty(float newCertainty)
Sets the certainty for this rule.

Parameters:
newCertainty - The new value for the property.
See Also:
getCertainty()

setCertaintyOperator

public void setCertaintyOperator(Operator newCertaintyOperator)
Sets the certainty operator of this rule. It has to fulfill the t-norm.

Parameters:
newCertaintyOperator - The new value for the property.
See Also:
getCertaintyOperator()

setConsequents

public void setConsequents(Consequent[] newConsequents)
Defines new consequents for this rule.

Parameters:
newConsequents - An array with consequents
See Also:
getConsequents()

setConsequents

public void setConsequents(int index,
                           Consequent newConsequents)
Replaces a consequent of this rule.

Parameters:
index - The index value into the property array.
newConsequents - A new consequent for this rule
See Also:
getConsequents()

setInferenceOperator

public void setInferenceOperator(Operator anInferenceOperator)
Sets the inference operator of this rule. It has to fulfill the t-norm.

Parameters:
anInferenceOperator - The new value for the property.
See Also:
getInferenceOperator()

vetoableChange

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

addPropertyChangeListener

public 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 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


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