physis.core.task
Class TaskAdapter

java.lang.Object
  |
  +--physis.core.task.TaskAdapter
All Implemented Interfaces:
Task
Direct Known Subclasses:
Add, Add3Args, Double, Echo, Get, Put, Reverse, Sort, Square, Sub, Triple

public class TaskAdapter
extends java.lang.Object
implements Task

Provides counting and merit-multiplier handling.Subclasses should override the checkActivity, getInputSize and getOutputSize and possibly the getName method and when clearing is not wanted the shouldBeCleared method.


Field Summary
protected  int counter
           
protected  int id
           
protected  double[] meritmultipliers
           
 
Constructor Summary
TaskAdapter()
           
 
Method Summary
 void changeBonuses(double multiplier)
          Multiplies the bonuses via multiplying the bonus's part above 1.0.
 boolean checkActivity(int[] in, int[] out)
          Checks an IO activity whether it performs the represented task.
 int getCounter()
          Gets the value of task counter.
 int getID()
          Returns the internal ID of the task.
 int getInputSize()
          Returns the number of input arguments.
 double getMeritMultiplier(int nth)
          Returns the merit multiplier when the task is performed.
 java.lang.String getName()
          The name equals the class name without the physis.core.task.
 int getNumberOfRewardedPerforms()
          Not all executions of a task are rewarded.
 int getOutputSize()
          Returns the number of generated values.
 void increaseCounter()
          If the task is performed, the counter should be increased.
 void setID(int id_)
          Sets the internal ID
 void setMeritMultipliers(double[] meritms)
          Sets the meritmultipliers.
 boolean shouldBeCleared()
          Clearing is the default.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

counter

protected int counter

meritmultipliers

protected double[] meritmultipliers

id

protected int id
Constructor Detail

TaskAdapter

public TaskAdapter()
Method Detail

setMeritMultipliers

public void setMeritMultipliers(double[] meritms)
Description copied from interface: Task
Sets the meritmultipliers.
Specified by:
setMeritMultipliers in interface Task

getMeritMultiplier

public double getMeritMultiplier(int nth)
Description copied from interface: Task
Returns the merit multiplier when the task is performed.
Specified by:
getMeritMultiplier in interface Task
Following copied from interface: physis.core.task.Task
Parameters:
nth - The number indicating how many times the task was performed.

checkActivity

public boolean checkActivity(int[] in,
                             int[] out)
Description copied from interface: Task
Checks an IO activity whether it performs the represented task.
Specified by:
checkActivity in interface Task

getInputSize

public int getInputSize()
Description copied from interface: Task
Returns the number of input arguments.
Specified by:
getInputSize in interface Task

getOutputSize

public int getOutputSize()
Description copied from interface: Task
Returns the number of generated values.
Specified by:
getOutputSize in interface Task

getNumberOfRewardedPerforms

public int getNumberOfRewardedPerforms()
Description copied from interface: Task
Not all executions of a task are rewarded. It's easy to repeat, but it's hard to invent.
Specified by:
getNumberOfRewardedPerforms in interface Task

changeBonuses

public void changeBonuses(double multiplier)
Description copied from interface: Task
Multiplies the bonuses via multiplying the bonus's part above 1.0.
Specified by:
changeBonuses in interface Task

shouldBeCleared

public boolean shouldBeCleared()
Clearing is the default.
Specified by:
shouldBeCleared in interface Task

increaseCounter

public void increaseCounter()
Description copied from interface: Task
If the task is performed, the counter should be increased.
Specified by:
increaseCounter in interface Task

getCounter

public int getCounter()
Description copied from interface: Task
Gets the value of task counter. It means that the task was performed this many times.
Specified by:
getCounter in interface Task

getName

public java.lang.String getName()
The name equals the class name without the physis.core.task. - prefix.
Specified by:
getName in interface Task

getID

public int getID()
Description copied from interface: Task
Returns the internal ID of the task. This ID is set by TaskFactory. The ID used int the organism's performed tasks table.
Specified by:
getID in interface Task

setID

public void setID(int id_)
Description copied from interface: Task
Sets the internal ID
Specified by:
setID in interface Task

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object