JIVE Platform
Release 0.3.1

edu.bsu.cs.jive.contour
Interface InteractiveContourModel

All Superinterfaces:
ContourModel, Iterable<Contour>

public interface InteractiveContourModel
extends ContourModel

Identifies a contour model that supports forward and reverse program execution.

An interactive contour model will throw an exception if the client tries to modify the state of the contour model while stepping back through previous states.


Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.bsu.cs.jive.contour.ContourModel
ContourModel.Exporter, ContourModel.Importer, ContourModel.Listener, ContourModel.Visitor
 
Method Summary
 boolean canStepBackward()
          Returns true if this interactive contour model can step backwards.
 boolean canStepForwardThroughRecordedStates()
          Returns true if this interactive contour model can step forward through pre-recorded states.
 int countTransactions()
          Count the number of transactions in this interactive contour model.
 long getEventNumber(int transactionIndex)
          Returns the number of the event which initiated the transaction identified by the supplied index.
 int getNextTransactionIndex()
          Get the index of the next transaction, the transaction that would be played if we call stepForward().
 int getPrevTransactionIndex()
          Get the index of the previous transaction, the transaction that would be played if we call stepBackward().
 int getTransactionIndex(long eventNumber)
          Returns the index of the transaction created as a result of the event with the supplied event number.
 boolean readyToRecord()
          Indicates if this object is in a state that is ready to record a transaction.
 void stepBackward()
          Play a step-backward transaction.
 void stepForward()
          Play a step-forward transaction.
 
Methods inherited from interface edu.bsu.cs.jive.contour.ContourModel
addListener, contains, contains, countChildren, countChildren, export, getChildren, getChildren, getChildren, getChildren, getContour, getModelLock, getParent, getParent, getRoots, getRoots, removeListener, size, visitBreadthFirst, visitDepthFirst
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

countTransactions

int countTransactions()
Count the number of transactions in this interactive contour model.

Returns:
transaction count

stepForward

void stepForward()
                 throws NoSuchElementException
Play a step-forward transaction. This only works if there is a transaction available to be committed.

This is a synchronous method: when it returns, the stepping backward has completed. (Do not confuse this with a synchronized method.)

Throws:
NoSuchElementException - if there is no forward step to be executed.

stepBackward

void stepBackward()
                  throws NoSuchElementException,
                         IndexOutOfBoundsException
Play a step-backward transaction. This is only possible if there is a transaction to roll back.

This is a synchronous method: when it returns, the stepping backward has completed. (Do not confuse this with a synchronized method.)

Throws:
NoSuchElementException - if the step backwards cannot be completed because that information is either not available (not cached).
IndexOutOfBoundsException - if the request was to move back from the initial state (state zero).

getNextTransactionIndex

int getNextTransactionIndex()
Get the index of the next transaction, the transaction that would be played if we call stepForward().

Returns:
index of the next (forward) transaction
Throws:
NoSuchElementException - if there is no recorded "next" transaction that can be committed.

getPrevTransactionIndex

int getPrevTransactionIndex()
Get the index of the previous transaction, the transaction that would be played if we call stepBackward().

Returns:
index of the previous (backward) transaction.
Throws:
NoSuchElementException - if there is no recorded "previous transaction that can be rolled back.

readyToRecord

boolean readyToRecord()
Indicates if this object is in a state that is ready to record a transaction. The model is ready to record if it is not playing back through history, meaning that there are no future transactions recorded and all previous transactions are committed.

Returns:
true if this is ready to record

canStepBackward

boolean canStepBackward()
Returns true if this interactive contour model can step backwards.

Returns:
true if there are recorded states and we can step backwards

canStepForwardThroughRecordedStates

boolean canStepForwardThroughRecordedStates()
Returns true if this interactive contour model can step forward through pre-recorded states.

Returns:
true if there are pre-recorded states through which we can step forward
See Also:
readyToRecord()

getTransactionIndex

int getTransactionIndex(long eventNumber)
Returns the index of the transaction created as a result of the event with the supplied event number.

Parameters:
eventNumber - the event resulting in the transaction
Returns:
the transaction index corresponding to the event number
Throws:
NoSuchElementException - if there is no such transaction

getEventNumber

long getEventNumber(int transactionIndex)
Returns the number of the event which initiated the transaction identified by the supplied index.

Parameters:
transactionIndex - the transaction index resulting from the event number
Returns:
the event number corresponding to the transaction index

JIVE Platform
Release 0.3.1