rails.game.model
Class CalculatedMoneyModel

java.lang.Object
  extended by java.util.Observable
      extended by rails.game.model.ModelObject
          extended by rails.game.model.CalculatedMoneyModel

public class CalculatedMoneyModel
extends ModelObject

This class allows calculated values to be used as model objects by using reflection. The value to be calculated is obtained by calling a method specified by name. This method must return an Integer and may not have any parameters.

Author:
Erik Vos

Field Summary
static int SUPPRESS_ZERO
           
 
Fields inherited from class rails.game.model.ModelObject
dependents, log, option
 
Constructor Summary
CalculatedMoneyModel(java.lang.Object object, java.lang.String methodName)
           
 
Method Summary
protected  int calculate()
           
 java.lang.String getText()
          The object that is sent to the Observer along with a notification.
 
Methods inherited from class rails.game.model.ModelObject
addDependent, addObserver, getUpdate, removeDependent, resetOption, setOption, update
 
Methods inherited from class java.util.Observable
clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUPPRESS_ZERO

public static final int SUPPRESS_ZERO
See Also:
Constant Field Values
Constructor Detail

CalculatedMoneyModel

public CalculatedMoneyModel(java.lang.Object object,
                            java.lang.String methodName)
Method Detail

calculate

protected int calculate()

getText

public java.lang.String getText()
Description copied from class: ModelObject
The object that is sent to the Observer along with a notification. The default result is the Observable's toString(), but it can be overridden where needed.

Specified by:
getText in class ModelObject
Returns: