one.world.core
Class Event

java.lang.Object
  |
  +--one.world.core.Tuple
        |
        +--one.world.core.Event
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
AnnounceEvent, BindingRequest, BindingResponse, ChunkRequest, ChunkResponse, DynamicTuple, ElectionEvent, EmptyEvent, ExceptionalEvent, HttpEvent, IdEvent, IdsEvent, IteratorRequest, IteratorResponse, JoinRequest, JoinResponse, ListenResponse, LogEvent, Message, PingPongEvent, QueryResponse, RemoteEvent, ResolutionRequest, ResolutionResponse, TupleEvent, TypedEvent

public abstract class Event
extends Tuple

The superclass of all events. Event objects are tuples that encapsulate all necessary state when notifying an EventHandler of the occurence of some logical event.

Version:
$Revision: 1.14 $
See Also:
Serialized Form

Field Summary
 Object closure
          The closure for this event.
 EventHandler source
          The source for this event.
 
Fields inherited from class one.world.core.Tuple
CLOSURE, id, ID, META_DATA, metaData, SOURCE
 
Constructor Summary
Event()
          Create a new, empty event.
Event(EventHandler source, Object closure)
          Create a new event with the specified source and closure.
Event(Guid id, EventHandler source, Object closure)
          Create a new event with the specified ID, source, and closure.
 
Method Summary
 void validate()
          Validate this event.
 
Methods inherited from class one.world.core.Tuple
clone, containsNonSymbolicHandler, equals, fields, get, getMetaData, getType, hasField, hashCode, hasMetaData, remove, set, setMetaData, toString, wrap
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

source

public EventHandler source
The source for this event. The source of an event indicates the resource that originally creates the event. Typically, this field points to an event handler that can be used for call-backs in request-response interactions. The source of an event must not be null.

closure

public Object closure
The closure for this event. The closure of an event is an opaque object that is simply passed through. Typically, a "client" in a request-response interaction uses the closure to distinguish between several response events processed by the same event handler.
Constructor Detail

Event

public Event()
Create a new, empty event.

Event

public Event(EventHandler source,
             Object closure)
Create a new event with the specified source and closure. This constructor creates a new event with the specified source and closure. The ID field is assigned a new GUID.
Parameters:
source - The source for the new event.
closure - The closure for the new event.

Event

public Event(Guid id,
             EventHandler source,
             Object closure)
Create a new event with the specified ID, source, and closure.
Parameters:
id - The ID for the new event.
source - The source for the new event.
closure - The closure for the new event.
Method Detail

validate

public void validate()
              throws TupleException
Validate this event. This method ensures that the source of an event is not null. It also validates the closure, if that object is validatable. Classes that override this method must first call the corresponding method in their superclass.
Overrides:
validate in class Tuple
Following copied from class: one.world.core.Tuple
Throws:
TupleException - Signals that the tuple is either malformed (i.e., does not conform to the tuple specification) or invalid (i.e., does not conform to the semantic constraints of its type).
See Also:
MalformedTupleException, InvalidTupleException, Type.validate(Class)


(C) Copyright 2001 UW CSE