|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.EventObject | +--jade.util.Event
This class represents a generic event carrying some information
(accessible in the form of Object
parameters) and
provides support for synchronous processing through the
waitUntilProcessed()
and notifyProcessed()
methods.
This class can be effectively used in combination with the
InputQueue
class to support a synchronization between an
external therad (posting events in the InputQueue
)
and the Agent thread (processing the events).
InputQueue
,
Serialized FormField Summary | |
protected int |
type
The type of this event. |
Fields inherited from class java.util.EventObject |
source |
Constructor Summary | |
Event(int type,
java.lang.Object source)
Construct an Event of a given type produced by
the indicated source |
|
Event(int type,
java.lang.Object source,
java.lang.Object info)
Construct an Event of a given type produced by
the indicated source and carrying a given information. |
Method Summary | |
void |
addParameter(java.lang.Object obj)
Add a parameter to this Event object |
java.lang.Object |
getParameter(int index)
Retrieve an element of the event parameter list. |
int |
getType()
Retrieve the type of this event. |
void |
notifyProcessed(java.lang.Object result)
Wakes up threads waiting for the processing of this Event
object within the waitUntilProcessed() method. |
void |
resetProcessed()
Reset the "processed" status of this Event |
java.lang.Object |
waitUntilProcessed()
Blocks the calling thread until the notifyProcessed()
method is called. |
Methods inherited from class java.util.EventObject |
getSource, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int type
Constructor Detail |
public Event(int type, java.lang.Object source)
Event
of a given type produced by
the indicated source
type
- The type of the eventsource
- The source that generated the eventpublic Event(int type, java.lang.Object source, java.lang.Object info)
Event
of a given type produced by
the indicated source and carrying a given information.
type
- The type of the eventsource
- The source that generated the eventinfo
- The information associated to the event. This value
is handled as the first parameter of the event and can be
accessed using the getParameter(0)
methodMethod Detail |
public int getType()
Event
objectpublic void addParameter(java.lang.Object obj)
Event
object
obj
- The parameter to be addedpublic java.lang.Object getParameter(int index)
index
- The index of the parameter to retrieve.
Event
object.public java.lang.Object waitUntilProcessed() throws java.lang.InterruptedException
notifyProcessed()
method is called.
Event
object as set by the notifyProcessed()
method.
java.lang.InterruptedException
public void notifyProcessed(java.lang.Object result)
Event
object within the waitUntilProcessed()
method.
result
- The result of the processing. This value is passed
to the waked threads as the result of the waitUntilProcessed()
method.public void resetProcessed()
Event
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |