orc.trace.events
Class Event

java.lang.Object
  extended by orc.trace.events.Event
All Implemented Interfaces:
java.io.Serializable, Locatable, Located, RecordTerm, Term
Direct Known Subclasses:
BlockEvent, ChokeEvent, DieEvent, ErrorEvent, ForkEvent, FreeEvent, PrintEvent, PublishEvent, PullEvent, ReceiveEvent, SendEvent, StoreEvent, UnblockEvent

public abstract class Event
extends java.lang.Object
implements java.io.Serializable, RecordTerm, Locatable

Base class for trace events.

Author:
quark
See Also:
Serialized Form

Field Summary
protected  EventCursor cursor
           
protected  SourceLocation location
           
protected  long seq
           
protected  Handle<ForkEvent> thread
           
 
Constructor Summary
Event()
           
 
Method Summary
abstract
<V> V
accept(Visitor<V> visitor)
           
 EventCursor getCursor()
          Get the event cursor which produced this event.
 Term getProperty(java.lang.String key)
           
 long getSeq()
          Get the sequence number, which uniquely identifies this event.
 SourceLocation getSourceLocation()
           
 Term getSourceLocationTerm()
           
 ForkEvent getThread()
          A thread is represented by the ForkEvent which spawned it.
abstract  java.lang.String getType()
          Return a string name for the type of event.
 void prettyPrint(java.io.Writer out, int indent)
          Pretty-print the term to out.
 void prettyPrintProperties(java.io.Writer out, int indent)
           
protected  void prettyPrintProperty(java.io.Writer out, int indent, java.lang.String key, Term value)
           
 void setCursor(EventCursor cursor)
          Used by implementations of EventCursor to associate this event with a location in an event stream.
 void setSeq(long seq)
          Used by implementations of EventCursor to set the event's sequence number.
 void setSourceLocation(SourceLocation location)
           
 void setThread(ForkEvent thread)
           
 java.lang.String toString()
          Return a human-readable short label for the event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

thread

protected Handle<ForkEvent> thread

location

protected SourceLocation location

cursor

protected transient EventCursor cursor

seq

protected transient long seq
Constructor Detail

Event

public Event()
Method Detail

setThread

public void setThread(ForkEvent thread)

getThread

public ForkEvent getThread()
A thread is represented by the ForkEvent which spawned it.


setSourceLocation

public void setSourceLocation(SourceLocation location)
Specified by:
setSourceLocation in interface Locatable

getSourceLocation

public SourceLocation getSourceLocation()
Specified by:
getSourceLocation in interface Located

getCursor

public EventCursor getCursor()
Get the event cursor which produced this event.


setCursor

public void setCursor(EventCursor cursor)
Used by implementations of EventCursor to associate this event with a location in an event stream. Clients shouldn't call this.


getSeq

public long getSeq()
Get the sequence number, which uniquely identifies this event.


setSeq

public void setSeq(long seq)
Used by implementations of EventCursor to set the event's sequence number. Clients shouldn't call this.


toString

public java.lang.String toString()
Return a human-readable short label for the event.

Overrides:
toString in class java.lang.Object

getType

public abstract java.lang.String getType()
Return a string name for the type of event. Used in pattern matching.


accept

public abstract <V> V accept(Visitor<V> visitor)

getProperty

public Term getProperty(java.lang.String key)
Specified by:
getProperty in interface RecordTerm

getSourceLocationTerm

public Term getSourceLocationTerm()

prettyPrintProperties

public void prettyPrintProperties(java.io.Writer out,
                                  int indent)
                           throws java.io.IOException
Throws:
java.io.IOException

prettyPrintProperty

protected void prettyPrintProperty(java.io.Writer out,
                                   int indent,
                                   java.lang.String key,
                                   Term value)
                            throws java.io.IOException
Throws:
java.io.IOException

prettyPrint

public void prettyPrint(java.io.Writer out,
                        int indent)
                 throws java.io.IOException
Description copied from interface: Term
Pretty-print the term to out. If the term is multiple lines, each newline should be followed by at least indent tabs. The value should not begin or end with a newline.

Specified by:
prettyPrint in interface Term
Throws:
java.io.IOException
See Also:
Terms.indent(Writer, int)