All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class guinea.logic.Item

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

public class Item
extends Object
implements Cloneable, PropertyLoader, PropertySaver, Serializable
Items are used in two ways. First, the item's are used to store the parameters of the test item. For example, it can contain the names of the samples to be played and other parameters. Second, the item is used to store the results of the item (the answers the subject gave) and other information such as duration of the item test, subject ID of the subject who gave the answers and session ID of the test session.


Variable Index

· ABORTED
The test session was aborted while testing this item.
· DONE
Test item has been tested succesfully.
· ERROR
An error occured while testing this item.
· isTemplate
Is this item a item template.
· status
Status of test item.
· template
The template that was used to create this item by copying it.
· TIMED_OUT
Time limit expired while testing this item.
· UNPROCESSED
Test item has not been processed yet.

Constructor Index

· Item()

Method Index

· clearAllAnswers()
Remove all answers from the answers list.
· clearAnswer(String)
Remove an answer from the answers list.
· clone()
Clone the item object.
· getAnswer(String)
Get an answer given to this item.
· getAnswers()
Get all answers as a table.
· getDuration()
Get the time it took to test this item.
· getItemID()
Get the item ID of this test item.
· getItemTemplate()
Get the template item this item is based on.
· getNumSwitches()
Get the number of times the subject switched between samples.
· getParameter(String)
Get a parameter by name.
· getParameterNames()
· getSessionID()
Get the session ID of this test item.
· getStartTime()
Get the starting time of the test of this item.
· getStatus()
Get the status of the test item.
· getSubjectID()
Get the subject ID of this test item.
· getTemplateCopy()
Get a copy of this item used as a template.
· hasTimedOut()
· isTemplate()
Is this item an template? Templates are used as bases for other items.
· isTested()
· main(String[])
· propertyLoad(Properties, String)
Load information from properties to this item.
· propertySave(ExtProperties)
Saves item's information to properties.
· setAnswer(String, Object)
Set an answer to this item.
· setAnswers(Hashtable)
Copies answers to this item from a hash table.
· setDuration(long)
Set the time it took to test this item.
· setItemID(String)
Set the item ID of this test item.
· setItemTemplate(Item)
Set the template for this item.
· setNumSwitches(int)
Set the number of times the subject switched between samples.
· setParameter(String, Object)
Set value of a parameter.
· setSessionID(String)
Set the session ID of this test item.
· setStartTime(long)
Set the starting time of the test of this item.
· setStatus(int)
· setSubjectID(String)
Set the subject ID of this test item.
· setTemplate(boolean)
Set this item as an template.

Variables

· isTemplate
 protected boolean isTemplate
Is this item a item template.

· template
 protected Item template
The template that was used to create this item by copying it.

See Also:
getTemplateCopy
· UNPROCESSED
 public static final int UNPROCESSED
Test item has not been processed yet.

See Also:
status
· DONE
 public static final int DONE
Test item has been tested succesfully.

See Also:
status
· TIMED_OUT
 public static final int TIMED_OUT
Time limit expired while testing this item.

See Also:
status
· ABORTED
 public static final int ABORTED
The test session was aborted while testing this item.

See Also:
status
· ERROR
 public static final int ERROR
An error occured while testing this item.

See Also:
status
· status
 protected int status
Status of test item. Before item has been tested, it is usually zero. After testing has been done, the status may be either done, timed out, aborted, or error.

Constructors

· Item
 public Item()

Methods

· setNumSwitches
 public void setNumSwitches(int num)
Set the number of times the subject switched between samples.

Parameters:
num - Number of switches.
· getNumSwitches
 public int getNumSwitches()
Get the number of times the subject switched between samples.

Returns:
Number of switches.
· setSessionID
 public void setSessionID(String id)
Set the session ID of this test item.

Parameters:
id - the session ID.
· getSessionID
 public String getSessionID()
Get the session ID of this test item.

· setSubjectID
 public void setSubjectID(String id)
Set the subject ID of this test item.

Parameters:
id - the subject ID.
· getSubjectID
 public String getSubjectID()
Get the subject ID of this test item.

· setItemID
 public void setItemID(String id)
Set the item ID of this test item.

Parameters:
id - the item ID.
· getItemID
 public String getItemID()
Get the item ID of this test item.

· setStartTime
 public void setStartTime(long stamp)
Set the starting time of the test of this item.

Parameters:
stamp - the time stamp in milliseconds.
See Also:
currentTimeMillis
· getStartTime
 public long getStartTime()
Get the starting time of the test of this item.

Returns:
the time stamp in milliseconds.
· setDuration
 public void setDuration(long millis)
Set the time it took to test this item.

Parameters:
millis - duration in milliseconds.
· getDuration
 public long getDuration()
Get the time it took to test this item.

Returns:
duration in milliseconds.
· isTemplate
 public boolean isTemplate()
Is this item an template? Templates are used as bases for other items.

Returns:
true if this item is a template.
· setTemplate
 public void setTemplate(boolean isTemplate)
Set this item as an template.

Parameters:
isTemplate - true if this item is a template, false if not.
· getItemTemplate
 public Item getItemTemplate()
Get the template item this item is based on.

Returns:
A template item or null if this item had no template.
· setItemTemplate
 public void setItemTemplate(Item template)
Set the template for this item.

Parameters:
template - A item template.
· setParameter
 public void setParameter(String pname,
                          Object value)
Set value of a parameter.

Parameters:
pname - Name of the parameter.
value - Value of the parameter.
· setAnswer
 public void setAnswer(String name,
                       Object answer)
Set an answer to this item.

Parameters:
name - Name of the question (a question ID).
answer - The answer object. If answer is null, the answer for that question is removed from the questions list (with clearAnswer()).
· getAnswer
 public Object getAnswer(String name)
Get an answer given to this item.

Parameters:
name - the name of question (a question ID)
Returns:
the answer or null if answer with that name was not given.
· clearAnswer
 public Object clearAnswer(String name)
Remove an answer from the answers list.

Parameters:
name - The name of the guestion (a question ID) whose answer to remove.
Returns:
The removed answer from the answers list or null there wasn't an answer for that question in the list.
· clearAllAnswers
 public Dictionary clearAllAnswers()
Remove all answers from the answers list.

Returns:
The answers of the item before clearing them or null if answer list was initially empty.
· getAnswers
 public Hashtable getAnswers()
Get all answers as a table.

Returns:
a Hashtable containg the answers with question IDs as keys.
· setAnswers
 public void setAnswers(Hashtable answers)
Copies answers to this item from a hash table.

Parameters:
answers - a Hashtable containing answers with question IDs as keys.
· getParameter
 public Object getParameter(String pname)
Get a parameter by name.

Parameters:
pname - name of parameter
Returns:
returns value of parameter or null if not found
· getParameterNames
 public String[] getParameterNames()
· getStatus
 public int getStatus()
Get the status of the test item. It shows whether the item has been tested and how succesfull the item was (OK, time-out, aborted, or error occured.

Returns:
Status code.
See Also:
status
· setStatus
 public void setStatus(int status)
· hasTimedOut
 public boolean hasTimedOut()
· isTested
 public boolean isTested()
· propertySave
 public void propertySave(ExtProperties p)
Saves item's information to properties.

Parameters:
p - where to save information.
· propertyLoad
 public void propertyLoad(Properties p,
                          String name) throws IllegalArgumentException
Load information from properties to this item.

· getTemplateCopy
 public Item getTemplateCopy()
Get a copy of this item used as a template. This is same as clone() except that a copied item is not a template and its template is set to this template object. This method is used when loading test items from file.

Returns:
A copy of an item.
· clone
 public Object clone()
Clone the item object.

Returns:
A clone of the item.
Overrides:
clone in class Object
· main
 public static void main(String args[]) throws Exception

All Packages  Class Hierarchy  This Package  Previous  Next  Index