net.sourceforge.fuzzyservices.beans
Class RuleBase

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

public class RuleBase
extends Object
implements VetoableChangeListener, Serializable

This class represents a rule base according to JavaBeans conventions.

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

Field Summary
static String ACCUMULATION_OPERATOR_PROPERTY
          Bound property name for accumulationOperator.
static String NAME_PROPERTY
          Bound property name for name.
static String RULES_PROPERTY
          Bound property name for rules.
 
Constructor Summary
RuleBase()
          Default RuleBase constructor.
RuleBase(String newName)
          Constructs a new rule base with given name.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 Object clone()
           
 boolean equals(Object obj)
           
 Operator getAccumulationOperator()
          Returns the accumulation operator of this rule base.
 int getId()
          Returns the technical identifier (e.g. within a database).
 String getName()
          Returns the name of this rule base.
 Rule[] getRules()
          Returns all rules of this rule base.
 Rule getRules(int index)
          Gets the rule located at the specified index of this rule base.
 int hashCode()
           
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void setAccumulationOperator(Operator newAccumulationOperator)
          Sets the accumulation operator of this rule base.
 void setName(String newName)
          Sets the name of this rule base.
 void setRules(int index, Rule newRule)
          Replaces the rule at the position index of the rule base.
 void setRules(Rule[] newRules)
          Fills the rule base with rules.
 String toString()
           
 String toString(boolean withRules)
          Returns a textual representation of the rule base
 void vetoableChange(PropertyChangeEvent evt)
           
 
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

RULES_PROPERTY

public static final String RULES_PROPERTY
Bound property name for rules.

See Also:
Constant Field Values

ACCUMULATION_OPERATOR_PROPERTY

public static final String ACCUMULATION_OPERATOR_PROPERTY
Bound property name for accumulationOperator.

See Also:
Constant Field Values
Constructor Detail

RuleBase

public RuleBase()
Default RuleBase constructor. This constructor sets a default accumulation operator specified in RuleBase, and registers itself as a vetoable change listener.

See Also:
RuleBase.getDefaultAccumulationOperator()

RuleBase

public RuleBase(String newName)
Constructs a new rule base with given name.

Parameters:
newName - The new value for the property.
Method Detail

getId

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

Returns:
the ID

getName

public final String getName()
Returns the name of this rule base.

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

getRules

public final Rule[] getRules()
Returns all rules of this rule base.

Returns:
the rules property
See Also:
setRules(net.sourceforge.fuzzyservices.beans.Rule[])

getRules

public final Rule getRules(int index)
Gets the rule located at the specified index of this rule base.

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

getAccumulationOperator

public final Operator getAccumulationOperator()
Returns the accumulation operator of this rule base.

Returns:
the accumulationOperator property
See Also:
setAccumulationOperator(net.sourceforge.fuzzyservices.beans.Operator)

setAccumulationOperator

public final void setAccumulationOperator(Operator newAccumulationOperator)
Sets the accumulation operator of this rule base.

Parameters:
newAccumulationOperator - The new value for the property.
See Also:
getAccumulationOperator()

setName

public final void setName(String newName)
Sets the name of this rule base.

Parameters:
newName - The new value for the property.
See Also:
getName()

setRules

public final void setRules(Rule[] newRules)
Fills the rule base with rules.

Parameters:
newRules - an array with rules.
See Also:
getRules()

setRules

public final void setRules(int index,
                           Rule newRule)
Replaces the rule at the position index of the rule base.

Parameters:
index - The index value into the property array.
newRule - the new rule for the rule base.
See Also:
getRules(int)

vetoableChange

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

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 withRules)
Returns a textual representation of the rule base

Parameters:
withRules - true if all rule definitions are also returned, false otherwise.
Returns:
a string representation of the rule base
See Also:
Rule.toString()


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