All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class guinea.logic.TAFCRule

java.lang.Object
   |
   +----guinea.logic.TAFCRule

public abstract class TAFCRule
extends Object
implements Serializable
A TAFC rule is a rule that what happens next based on subject's answer. The rule may decide that testing this item has been finished, or it can change the direction where to level is next going.

See Also:
TAFCTrial, TAFCTest

Variable Index

· finished
Has the rule finished.
· group
The current group.
· GROUP_DOWN
The group is 'DOWN'.
· GROUP_SAME
The group is 'SAME' (no change in direction).
· GROUP_UP
The group is 'UP'.
· prevAnswer
The previous answer from the subject.
· trials
A list of trials in this rule.

Constructor Index

· TAFCRule()

Method Index

· calcLevel()
Calculate the volume level for the current step.
· continueRun()
Still continue with the item? Usually this will return false when the maximum number of runs has been exceeded.
· getAnswer()
Get the answer from this rule when the rule has ended.
· getInitialLevel()
Get the rule's initial volume level.
· getLevel()
Get current level from the rule.
· getMaxRuns()
Get the maximum number of runs for this rule.
· getNumTrials()
Get the number of trials in the trial list.
· getRule(int)
Get a TAFC rule object for given type.
· getRunFirstIndex(int)
Get the index of the first trial that is a part of a given 'run'.
· getRunLastIndex(int)
Get the index of the last trial that is a part of a given 'run'.
· getStepSize()
Get the rule's step size.
· getTrial(int)
Get a trial info object from rule's trial history list.
· getTrials()
Get the vector of trials from the rule.
· markResponse(boolean)
Set answer from subject for the current trial.
· nextGroup(boolean)
Does the decision whether to change direction or not.
· reset()
Reset the TAFC rule to initial values.
· setInitialLevel(Volume)
Set initial level for rule.
· setMaxRuns(int)
Set maximum number of runs for this rule.
· setStepSize(Volume)
Set the step size of rule.

Variables

· finished
 protected boolean finished
Has the rule finished.

· trials
 protected transient Vector trials
A list of trials in this rule.

· prevAnswer
 protected transient boolean prevAnswer
The previous answer from the subject.

· GROUP_UP
 protected static final int GROUP_UP
The group is 'UP'.

· GROUP_SAME
 protected static final int GROUP_SAME
The group is 'SAME' (no change in direction).

· GROUP_DOWN
 protected static final int GROUP_DOWN
The group is 'DOWN'.

· group
 protected transient int group
The current group.

Constructors

· TAFCRule
 public TAFCRule()

Methods

· reset
 public void reset()
Reset the TAFC rule to initial values. It sets the current level to initial level, current run number, trial number and step to zero. The group is set to DOWN. List of trials is empty.

· setInitialLevel
 public void setInitialLevel(Volume level)
Set initial level for rule.

Parameters:
level - the initial volume level.
· getInitialLevel
 public Volume getInitialLevel()
Get the rule's initial volume level.

Returns:
The initial level of the rule.
· setStepSize
 public void setStepSize(Volume step)
Set the step size of rule.

Parameters:
step - the size of step.
· getStepSize
 public Volume getStepSize()
Get the rule's step size.

Returns:
The size of a single step.
· setMaxRuns
 public void setMaxRuns(int num)
Set maximum number of runs for this rule.

Parameters:
num - maximum number of runs.
· getMaxRuns
 public int getMaxRuns()
Get the maximum number of runs for this rule.

Returns:
The maximum number of runs for this rule.
· markResponse
 public void markResponse(boolean answer)
Set answer from subject for the current trial. Uses the nextGroup() method to decide where to go during next trial.

Parameters:
answer - true if subject has pressed button, etc.
See Also:
nextGroup, calcLevel
· getLevel
 public Volume getLevel()
Get current level from the rule.

Returns:
the current volume level.
· continueRun
 public boolean continueRun()
Still continue with the item? Usually this will return false when the maximum number of runs has been exceeded.

Returns:
whether to continue (true) or end (false).
· getAnswer
 public Object getAnswer()
Get the answer from this rule when the rule has ended.

Returns:
the answer (volume level) as a Volume object.
· getTrials
 public Vector getTrials()
Get the vector of trials from the rule.

Returns:
trials as a Vector.
· getRule
 public static TAFCRule getRule(int type)
Get a TAFC rule object for given type. Rule type 1 is the 'simple up-down procedure'. More rules will probably be added later.

Parameters:
type - the type of the rule.
Returns:
a new TAFC rule object for the specified type.
· nextGroup
 protected abstract int nextGroup(boolean answer)
Does the decision whether to change direction or not. The decision is based on subject's answer. More complicated rules may use a larger history of trials of this rule. This method is called by the markResponse() method.

Parameters:
answer - the last answer given by subject.
See Also:
getTrials, trials, markResponse
· calcLevel
 protected Volume calcLevel()
Calculate the volume level for the current step. It is called by the markResponse() method after it has set the correct ster for the next trial. The default is to use level initialLevel + stepSize * step as the next level. Calculations are made in decibel scale.

Returns:
Volume level for current (or actually the next) trial.
· getTrial
 protected TAFCTrial getTrial(int index)
Get a trial info object from rule's trial history list.

Parameters:
index - the index of trial.
Returns:
A TAFC test trial object.
· getNumTrials
 protected int getNumTrials()
Get the number of trials in the trial list.

Returns:
Number of trials in the trial list.
· getRunFirstIndex
 protected int getRunFirstIndex(int run)
Get the index of the first trial that is a part of a given 'run'.

Parameters:
run - the run number.
Returns:
The index of the first trial for the given run or returns -1 if given run is not found in the trial list.
· getRunLastIndex
 protected int getRunLastIndex(int run)
Get the index of the last trial that is a part of a given 'run'.

Parameters:
run - the run number.
Returns:
The index of the last trial for the given run.

All Packages  Class Hierarchy  This Package  Previous  Next  Index