ca.odell.glazedlists.calculation
Class AbstractCalculation<N>
java.lang.Object
ca.odell.glazedlists.calculation.AbstractCalculation<N>
- All Implemented Interfaces:
- Calculation<N>
- Direct Known Subclasses:
- AbstractCompositeCalculation, AbstractEventListCalculation
public abstract class AbstractCalculation<N>
- extends java.lang.Object
- implements Calculation<N>
Eases the burdens of implementing any type of Calculation. It stores the
last numeric result which represents the Calculation. It provides support
for managing the PropertyChangeListeners and firing value changes to them.
- Author:
- James Lemieux
|
Method Summary |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
|
protected void |
fireValueChange(N oldValue,
N newValue)
A convenience method for firing a PropertyChangeEvent describing a
change in the value of this calculation. |
java.lang.String |
getName()
|
N |
getValue()
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
|
void |
setName(java.lang.String name)
Adjusts the Calculation to have the new name; |
protected void |
setValue(N value)
Subclasses should call this method in order to update the value that is
reported from this calculation. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractCalculation
public AbstractCalculation(N initialValue)
- Parameters:
initialValue - the value that should immediately be reported as the
value of this Calculation
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
- Specified by:
addPropertyChangeListener in interface Calculation<N>
- Parameters:
pcl - a PropertyChangeListener to notify any time the
value changes
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
- Specified by:
removePropertyChangeListener in interface Calculation<N>
- Parameters:
pcl - a PropertyChangeListener which should no longer be notified
of value changes
getName
public java.lang.String getName()
- Specified by:
getName in interface Calculation<N>
- Returns:
- a human readable name for this Calculation
setName
public void setName(java.lang.String name)
- Description copied from interface:
Calculation
- Adjusts the Calculation to have the new
name;
- Specified by:
setName in interface Calculation<N>
- Parameters:
name - the new human-readable name of this Calculation
getValue
public N getValue()
- Specified by:
getValue in interface Calculation<N>
- Returns:
- the latest calculated value
setValue
protected void setValue(N value)
- Subclasses should call this method in order to update the value that is
reported from this calculation. Note: this method does NOT fire a
PropertyChangeEvent. Subclasses must do that at appropriate times using
fireValueChange(Object, Object).
- Parameters:
value - the new value of this calculation
fireValueChange
protected void fireValueChange(N oldValue,
N newValue)
- A convenience method for firing a PropertyChangeEvent describing a
change in the value of this calculation.
- Parameters:
oldValue - the old value reported from this calculationnewValue - the new value reported from this calculation
Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by abuild at 2011-01-06 6:55