orc.trace
Class BackwardEventCursor

java.lang.Object
  extended by orc.trace.BackwardEventCursor
All Implemented Interfaces:
EventCursor

public class BackwardEventCursor
extends java.lang.Object
implements EventCursor

Wrap a cursor to provide strong backward references. This is likely to waste memory but is the only way to allow arbitrary bidirectional queries.

Author:
quark

Nested Class Summary
 
Nested classes/interfaces inherited from interface orc.trace.EventCursor
EventCursor.EndOfStream
 
Constructor Summary
BackwardEventCursor(EventCursor cursor)
           
 
Method Summary
 BackwardEventCursor backward()
          Return a cursor to the previous event in the stream.
 Event current()
          Return the current event in the stream.
 BackwardEventCursor forward()
          Return a cursor to the next event in the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BackwardEventCursor

public BackwardEventCursor(EventCursor cursor)
Method Detail

current

public Event current()
Description copied from interface: EventCursor
Return the current event in the stream.

Specified by:
current in interface EventCursor

forward

public BackwardEventCursor forward()
                            throws EventCursor.EndOfStream
Description copied from interface: EventCursor
Return a cursor to the next event in the stream. Why "forward" instead of "next"? To avoid confusion with the temporal logic "next" operator which evaluates a predicate at the next location. Also because I prefer the symmetry of forward/backward to next/previous.

Specified by:
forward in interface EventCursor
Throws:
EventCursor.EndOfStream

backward

public BackwardEventCursor backward()
                             throws EventCursor.EndOfStream
Description copied from interface: EventCursor
Return a cursor to the previous event in the stream.

Specified by:
backward in interface EventCursor
Throws:
EventCursor.EndOfStream