jist.runtime
Class EventLocation

java.lang.Object
  extended by jist.runtime.Event
      extended by jist.runtime.EventLocation

 class EventLocation
extends Event

Extends Event to include its originating location. Note: These events should only be used for debugging purposes, and not for running full-speed simulations, since generating the source location is slow.

Since:
JIST1.0
Version:
$Id: EventLocation.java,v 1.12 2004/04/06 16:07:43 barr Exp $
Author:
Rimon Barr <barr+jist@cs.cornell.edu>

Nested Class Summary
 
Nested classes/interfaces inherited from class jist.runtime.Event
Event.Continuation, Event.ContinuationFrame, Event.EventComparator
 
Field Summary
private  java.lang.String file
          Filename where event was generated.
private  int line
          Line where event was generated.
private  Event source
          Event that generated this event.
 
Fields inherited from class jist.runtime.Event
args, cont, method, ref, time
 
Constructor Summary
EventLocation()
          Create an empty Event with location information, used by EventPool.
EventLocation(long time, java.lang.reflect.Method method, EntityRef ref, java.lang.Object[] args)
          Create an initialized Event with location information.
 
Method Summary
 void compute()
          Initialize event structure with information about where it originated.
private  void computeLocation()
          Computes the originating source location (if possible) for an event.
private  void computeSource()
          Computes the originating source runtime events (if possible) for an event.
 Event getSource()
          Return the event that generated this event.
static void printEventTrace()
          Display event causality trace on System error stream.
 java.lang.String toString()
          Return string representation of Event including its originating location.
 
Methods inherited from class jist.runtime.Event
equals, getArgsString, getClassString, getContinuationString, getEntityString, getMethodString, getModifiersString, getTimeString, getTypeString, hashCode, set
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

file

private java.lang.String file
Filename where event was generated.


line

private int line
Line where event was generated.


source

private Event source
Event that generated this event.

Constructor Detail

EventLocation

public EventLocation()
Create an empty Event with location information, used by EventPool.


EventLocation

public EventLocation(long time,
                     java.lang.reflect.Method method,
                     EntityRef ref,
                     java.lang.Object[] args)
Create an initialized Event with location information.

Parameters:
time - simulation time at which the event should be processed
method - method to be invoked for event processing
ref - entity reference to receive event
args - arguments to be passed to entity for processing
Method Detail

compute

public void compute()
Initialize event structure with information about where it originated.


computeLocation

private void computeLocation()
Computes the originating source location (if possible) for an event. This is performed by throwing an exception, catching it, and inspecting the stack. Consequently, it is slow (generating the exception, walking the stack) and should be turned on only for debugging purposes. It may be possible to use the rewriter to glean this information instead, but this is so much simpler, and good enough.


computeSource

private void computeSource()
Computes the originating source runtime events (if possible) for an event. This is performed by looking at current event in the active controller.


toString

public java.lang.String toString()
Return string representation of Event including its originating location.

Overrides:
toString in class Event
Returns:
string representation of Event including originating location

getSource

public Event getSource()
Return the event that generated this event.

Returns:
event that generated this event.

printEventTrace

public static void printEventTrace()
Display event causality trace on System error stream.