org.qtitools.qti.node.test.flow
Class DefaultItemFlow

java.lang.Object
  extended by org.qtitools.qti.node.test.flow.DefaultItemFlow
All Implemented Interfaces:
java.io.Serializable, ItemFlow

public class DefaultItemFlow
extends java.lang.Object
implements ItemFlow

Default implementation of item flow.

Author:
Jiri Kajaba
See Also:
Serialized Form

Field Summary
protected  ItemRefNode current
           
protected  StartNode start
           
 
Constructor Summary
DefaultItemFlow(AssessmentTest test)
          Constructs item flow.
 
Method Summary
protected  ItemRefNode findPrevItemRef(boolean includeFinished)
           
 AssessmentItemRef getCurrentItemRef()
          Gets current item reference (can be null).
 TestPart getCurrentTestPart()
          Gets parent test part of current item reference (can be null).
 AssessmentItemRef getNextItemRef(boolean includeFinished)
          Gets first next item reference in test (can be null).
 AssessmentItemRef getPrevItemRef(boolean includeFinished)
          Gets first previous item reference in current test part (can be null).
 AssessmentTest getTest()
          Gets assessment test of this item flow.
 boolean hasNextItemRef(boolean includeFinished)
          Returns true if there is any next item reference in current test part; false otherwise.
 boolean hasPrevItemRef(boolean includeFinished)
          Returns true if there is any previous item reference in current test part; false otherwise.
 boolean isFinished()
          Returns true if there are no more item references to be presented; false otherwise.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

start

protected StartNode start

current

protected ItemRefNode current
Constructor Detail

DefaultItemFlow

public DefaultItemFlow(AssessmentTest test)
Constructs item flow.

Parameters:
test - assessment test
Method Detail

isFinished

public boolean isFinished()
Description copied from interface: ItemFlow
Returns true if there are no more item references to be presented; false otherwise.

Convenient method for getTest().isFinished().

Specified by:
isFinished in interface ItemFlow
Returns:
true if there are no more item references to be presented; false otherwise

getTest

public AssessmentTest getTest()
Description copied from interface: ItemFlow
Gets assessment test of this item flow.

Specified by:
getTest in interface ItemFlow
Returns:
assessment test of this item flow

getCurrentTestPart

public TestPart getCurrentTestPart()
Description copied from interface: ItemFlow
Gets parent test part of current item reference (can be null).

Result is null before test starts and after test finishes.

Specified by:
getCurrentTestPart in interface ItemFlow
Returns:
parent test part of current item reference (can be null)

getCurrentItemRef

public AssessmentItemRef getCurrentItemRef()
Description copied from interface: ItemFlow
Gets current item reference (can be null).

Result is null before test starts and after test finishes.

Specified by:
getCurrentItemRef in interface ItemFlow
Returns:
current item reference (can be null)

hasPrevItemRef

public boolean hasPrevItemRef(boolean includeFinished)
Description copied from interface: ItemFlow
Returns true if there is any previous item reference in current test part; false otherwise.

Previous item reference means any item reference which was presented before current item reference.

Returns false before test starts and after test finishes (current test part is null).

Specified by:
hasPrevItemRef in interface ItemFlow
Parameters:
includeFinished - whether consider already finished item references
Returns:
true if there is any previous item reference in current test part; false otherwise

getPrevItemRef

public AssessmentItemRef getPrevItemRef(boolean includeFinished)
Description copied from interface: ItemFlow
Gets first previous item reference in current test part (can be null).

First previous item reference means item reference with the highest lower presented time than current item reference. (First left item reference from current item reference on time axis.)

Specified by:
getPrevItemRef in interface ItemFlow
Parameters:
includeFinished - whether consider already finished item references
Returns:
first previous item reference in current test part (can be null)

findPrevItemRef

protected ItemRefNode findPrevItemRef(boolean includeFinished)

hasNextItemRef

public boolean hasNextItemRef(boolean includeFinished)
Description copied from interface: ItemFlow
Returns true if there is any next item reference in current test part; false otherwise.

Next item reference means any item reference which was (or will be) presented after current item reference.

Returns false before test starts and after test finishes (current test part is null).

In linear individual mode this method can be called only when current item is finished!

Specified by:
hasNextItemRef in interface ItemFlow
Parameters:
includeFinished - whether consider already finished item references
Returns:
true if there is any next item reference in current test part; false otherwise

getNextItemRef

public AssessmentItemRef getNextItemRef(boolean includeFinished)
Description copied from interface: ItemFlow
Gets first next item reference in test (can be null).

First next item reference means item reference with the lowest higher presented time than current item reference. (First right item reference from current item reference on time axis.)

This is the only one method which can cross boundary of current test part. Once boundary is crossed, there is no way how to go back!

In linear individual mode this method can be called only when current item is finished!

Specified by:
getNextItemRef in interface ItemFlow
Parameters:
includeFinished - whether consider already finished item references
Returns:
first next item reference in test (can be null)

toString

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


Copyright © 2009. All Rights Reserved.