ch.tatool.core.element.handler.score
Class AdaptiveScoreAndLevelHandler

java.lang.Object
  extended by ch.tatool.core.element.AbstractPropertyHolder
      extended by ch.tatool.core.element.NodeImpl
          extended by ch.tatool.core.element.handler.score.AbstractPointsAndLevelHandler
              extended by ch.tatool.core.element.handler.score.AdaptiveScoreAndLevelHandler
All Implemented Interfaces:
PointsAndLevelHandler, PropertyHolder, Node, ExecutionPhaseListener

public class AdaptiveScoreAndLevelHandler
extends AbstractPointsAndLevelHandler

Adaptive Score and Level Algorithm The score and level algorithm adapts itself to the performance of the user. After a given interval of trials the algorithm sets a benchmark according to the performance of the user. This benchmark will then be used to compare to the actual performance after the next interval of trials. Given the user beats his own benchmark, a level-up will be triggered and a new benchmark will be set. If the user can't beat his own benchmark, he has to continue trying.

Author:
Andre Locher

Nested Class Summary
 
Nested classes/interfaces inherited from interface ch.tatool.core.element.handler.score.PointsAndLevelHandler
PointsAndLevelHandler.LevelListener, PointsAndLevelHandler.PointAdaptor
 
Field Summary
static int ADAPT
           
static int INCREASE
           
static String PROPERTY_BENCHMARK
           
static String PROPERTY_BENCHMARK_COUNTER
           
static String PROPERTY_MAXPOINTS
           
static String PROPERTY_PERFORMANCE
           
static String PROPERTY_TOTALPOINTS
           
static int REDUCE
           
static int RESET
           
 
Fields inherited from class ch.tatool.core.element.handler.score.AbstractPointsAndLevelHandler
startLevel, startMaxPoints, startMinPoints, startPoints, ZERO_POINTS
 
Constructor Summary
AdaptiveScoreAndLevelHandler()
           
 
Method Summary
protected  int checkLevelChange(ExecutionContext context, int currentLevel)
          Overwrite to implement a different level/points logic.
 double getBenchmarkRaise()
           
 int getBenchmarkSampleSize()
           
 double getMaxBenchmark()
           
 double getMinBenchmark()
           
 int getNumRetriesBenchmark()
           
 int getNumRetriesTimer()
           
 void initializeAlgorithm(ExecutionContext event)
          Initializes the algorithm with the values of the DB.
protected  void initializeHandler(ExecutionContext context)
          Initializes the algorithm with the values of the DB at session start
 void setBenchmarkRaise(double benchmarkRaise)
           
 void setBenchmarkSampleSize(int benchmarkSampleSize)
           
 void setMaxBenchmark(double maxBenchmark)
           
 void setMinBenchmark(double minBenchmark)
           
 void setNumRetriesBenchmark(int numRetriesBenchmark)
           
 void setNumRetriesTimer(int numRetriesTimer)
           
 
Methods inherited from class ch.tatool.core.element.handler.score.AbstractPointsAndLevelHandler
getDescription, informLevelChangeListeners, processExecutionPhase, processLevel, processPoints, setDescription, updateStatusRegion, updateTotals
 
Methods inherited from class ch.tatool.core.element.NodeImpl
assignParent, assignParent, assignParents, getId, getLocalId, getParent, setId, setLocalId, setParent
 
Methods inherited from class ch.tatool.core.element.AbstractPropertyHolder
clearProperties, getKeys, getProperty, removeProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ch.tatool.element.Node
getParent, setParent
 
Methods inherited from interface ch.tatool.data.PropertyHolder
clearProperties, getId, getKeys, getProperty, removeProperty, setProperty
 

Field Detail

PROPERTY_BENCHMARK

public static final String PROPERTY_BENCHMARK
See Also:
Constant Field Values

PROPERTY_BENCHMARK_COUNTER

public static final String PROPERTY_BENCHMARK_COUNTER
See Also:
Constant Field Values

PROPERTY_PERFORMANCE

public static final String PROPERTY_PERFORMANCE
See Also:
Constant Field Values

PROPERTY_TOTALPOINTS

public static final String PROPERTY_TOTALPOINTS
See Also:
Constant Field Values

PROPERTY_MAXPOINTS

public static final String PROPERTY_MAXPOINTS
See Also:
Constant Field Values

RESET

public static final int RESET
See Also:
Constant Field Values

INCREASE

public static final int INCREASE
See Also:
Constant Field Values

REDUCE

public static final int REDUCE
See Also:
Constant Field Values

ADAPT

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

AdaptiveScoreAndLevelHandler

public AdaptiveScoreAndLevelHandler()
Method Detail

initializeHandler

protected void initializeHandler(ExecutionContext context)
Initializes the algorithm with the values of the DB at session start

Specified by:
initializeHandler in class AbstractPointsAndLevelHandler

initializeAlgorithm

public void initializeAlgorithm(ExecutionContext event)
Initializes the algorithm with the values of the DB.


checkLevelChange

protected int checkLevelChange(ExecutionContext context,
                               int currentLevel)
Description copied from class: AbstractPointsAndLevelHandler
Overwrite to implement a different level/points logic. Default logic simply uses += level = > +- 100.

Specified by:
checkLevelChange in class AbstractPointsAndLevelHandler
Returns:
the new level. This can be the old level value

getBenchmarkSampleSize

public int getBenchmarkSampleSize()

setBenchmarkSampleSize

public void setBenchmarkSampleSize(int benchmarkSampleSize)

getBenchmarkRaise

public double getBenchmarkRaise()

setBenchmarkRaise

public void setBenchmarkRaise(double benchmarkRaise)

getMinBenchmark

public double getMinBenchmark()

setMinBenchmark

public void setMinBenchmark(double minBenchmark)

getMaxBenchmark

public double getMaxBenchmark()

setMaxBenchmark

public void setMaxBenchmark(double maxBenchmark)

getNumRetriesTimer

public int getNumRetriesTimer()

setNumRetriesTimer

public void setNumRetriesTimer(int numRetriesTimer)

getNumRetriesBenchmark

public int getNumRetriesBenchmark()

setNumRetriesBenchmark

public void setNumRetriesBenchmark(int numRetriesBenchmark)


Copyright © 2012. All Rights Reserved.