edu.usc.cse.desi.viewers
Class AvailabilityCalculator

java.lang.Object
  extended byedu.usc.cse.desi.viewers.AbstractCalculator
      extended byedu.usc.cse.desi.viewers.AvailabilityCalculator
All Implemented Interfaces:
java.util.EventListener, java.beans.PropertyChangeListener

public class AvailabilityCalculator
extends AbstractCalculator

This class listens to changes in the model, and when they occur it will update the given label to the correct availability.

Author:
NeLs Started on Jul 29, 2004

Field Summary
 
Fields inherited from class edu.usc.cse.desi.viewers.AbstractCalculator
myLabel, myModel
 
Constructor Summary
AvailabilityCalculator(DESIViewModel model, org.eclipse.swt.widgets.Label label)
           
 
Method Summary
protected  void addThisAsAListenerToModel()
          Add this as a listener to the model.
protected  void calculate()
          Here's where we calculate the availability and print it to the label.
static double calculateAvailability(DESIViewModel model)
          This is a static method that can be used at any time to calculate the availability of a system.
 void propertyChange(java.beans.PropertyChangeEvent arg0)
          When properties change, we have to re-calculate the availability.
protected  void removeThisAsAListenerFromModel()
          I overrode this method:
 
Methods inherited from class edu.usc.cse.desi.viewers.AbstractCalculator
finalize, modelChanged, setMyLabelText
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvailabilityCalculator

public AvailabilityCalculator(DESIViewModel model,
                              org.eclipse.swt.widgets.Label label)
Parameters:
model -
label -
Method Detail

addThisAsAListenerToModel

protected void addThisAsAListenerToModel()
Add this as a listener to the model. I overrode this method:

Specified by:
addThisAsAListenerToModel in class AbstractCalculator
See Also:
AbstractCalculator.addThisAsAListenerToModel()

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent arg0)
When properties change, we have to re-calculate the availability. I overrode this method:

See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

calculateAvailability

public static double calculateAvailability(DESIViewModel model)
This is a static method that can be used at any time to calculate the availability of a system.

Parameters:
model -
Returns:

calculate

protected void calculate()
Here's where we calculate the availability and print it to the label. I overrode this method:

Specified by:
calculate in class AbstractCalculator
See Also:
AbstractCalculator.calculate()

removeThisAsAListenerFromModel

protected void removeThisAsAListenerFromModel()
I overrode this method:

Specified by:
removeThisAsAListenerFromModel in class AbstractCalculator
See Also:
AbstractCalculator.removeThisAsAListenerFromModel()