org.vizzini.ai.geneticalgorithm
Class AbstractContext

java.lang.Object
  extended by org.vizzini.ai.geneticalgorithm.AbstractContext
All Implemented Interfaces:
IContext
Direct Known Subclasses:
AntContext, DefaultContext

public abstract class AbstractContext
extends Object
implements IContext

Provides base functionality for a context in a genetic algorithm.

Since:
v0.3
Version:
v0.3
Author:
Jeffrey M. Thompson

Constructor Summary
AbstractContext()
           
 
Method Summary
 void add(IFitnessCase fitnessCase)
          Add the given fitness case.
 IFitnessCase getCurrentFitnessCase()
          Return the current fitness case.
 int getCurrentFitnessCaseIndex()
          Return the index of the current fitness case.
 int getFitnessCaseCount()
          Return the fitness case count.
 Object getStateVariable(String name)
          Return the state variable with the given name.
 void incrementCurrentFitnessCase()
          Move to the next fitness case.
 void reset()
          Reset to the initial settings.
 void setStateVariable(String name, Object value)
          Set the state variable with the given name to the given value.
 String toString()
          Return a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractContext

public AbstractContext()
Method Detail

add

public void add(IFitnessCase fitnessCase)
Add the given fitness case.

Specified by:
add in interface IContext
Parameters:
fitnessCase - Fitness case.
Since:
v0.3

getCurrentFitnessCase

public IFitnessCase getCurrentFitnessCase()
Return the current fitness case.

Specified by:
getCurrentFitnessCase in interface IContext
Since:
v0.3

getCurrentFitnessCaseIndex

public int getCurrentFitnessCaseIndex()
Return the index of the current fitness case.

Specified by:
getCurrentFitnessCaseIndex in interface IContext
Since:
v0.3

getFitnessCaseCount

public int getFitnessCaseCount()
Return the fitness case count.

Specified by:
getFitnessCaseCount in interface IContext
Since:
v0.3

getStateVariable

public Object getStateVariable(String name)
Return the state variable with the given name.

Specified by:
getStateVariable in interface IContext
Parameters:
name - State variable name.
Since:
v0.3

incrementCurrentFitnessCase

public void incrementCurrentFitnessCase()
Move to the next fitness case. If the current case index is equal to the number of cases, reset to zero.

Specified by:
incrementCurrentFitnessCase in interface IContext
Since:
v0.3

reset

public void reset()
Reset to the initial settings.

Specified by:
reset in interface IContext
Since:
v0.3

setStateVariable

public void setStateVariable(String name,
                             Object value)
Set the state variable with the given name to the given value.

Specified by:
setStateVariable in interface IContext
Parameters:
name - State variable name.
value - State variable value.
Since:
v0.3

toString

public String toString()
Return a string representation of this object.

Overrides:
toString in class Object
Since:
v0.3


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02