edu.memphis.ccrg.lida.framework.strategies
Class LinearDecayStrategy

java.lang.Object
  extended by edu.memphis.ccrg.lida.framework.initialization.InitializableImpl
      extended by edu.memphis.ccrg.lida.framework.strategies.StrategyImpl
          extended by edu.memphis.ccrg.lida.framework.strategies.LinearDecayStrategy
All Implemented Interfaces:
Initializable, DecayStrategy, Strategy

public class LinearDecayStrategy
extends StrategyImpl
implements DecayStrategy

Basic DecayStrategy governed by a linear curve.

Author:
Ryan J. McCall, Javier Snaider

Constructor Summary
LinearDecayStrategy()
          Creates a new instance of LinearCurve.
 
Method Summary
 double decay(double currentActivation, long ticks, java.util.Map<java.lang.String,? extends java.lang.Object> params)
          Decays the current activation according to some internal decay function.
 double decay(double currentActivation, long ticks, java.lang.Object... params)
          Decays the current activation according to some internal decay function.
 void init()
          If this method is overridden, this init() must be called first! i.e.
 
Methods inherited from class edu.memphis.ccrg.lida.framework.initialization.InitializableImpl
containsParameter, getParam, getParameters, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.Initializable
containsParameter, getParam, getParameters, init
 

Constructor Detail

LinearDecayStrategy

public LinearDecayStrategy()
Creates a new instance of LinearCurve. Values for slope and intercept are set to the default ones.

Method Detail

init

public void init()
If this method is overridden, this init() must be called first! i.e. super.init(); Will set parameters with the following names:

m slope of the decay function
If any parameter is not specified its default value will be used.

Specified by:
init in interface Initializable
Overrides:
init in class InitializableImpl
See Also:
Initializable

decay

public double decay(double currentActivation,
                    long ticks,
                    java.lang.Object... params)
Decays the current activation according to some internal decay function.

Specified by:
decay in interface DecayStrategy
Parameters:
currentActivation - activation of the entity before decay.
ticks - The number of ticks to decay.
params - optionally accepts 1 double parameter specifying the slope of decay ticks and activations.
Returns:
new activation

decay

public double decay(double currentActivation,
                    long ticks,
                    java.util.Map<java.lang.String,? extends java.lang.Object> params)
Decays the current activation according to some internal decay function.

Specified by:
decay in interface DecayStrategy
Parameters:
currentActivation - activation of the entity before decay.
ticks - how much time has passed since last decay
params - optionally accepts 1 parameter specifying the slope of decay ticks and activations.
Returns:
new activation amount