|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectedu.berkeley.guir.ptk.PTK
edu.berkeley.guir.ptk.output.OutputPolicy
Handles the routing of events to Outputs. An instance of class is initialized by
the PeripheralDisplay class each time makeConnection is
called.
The method run() first starts all the Output threads running. When events arrive, it loops through the Outputs that are installed and asks them if they want the event The Outputs installed correspond to an array of Outputs or a single Output passed into a makeConnection call). Different instances of this class can have different Outputs installed. These control the devices that display data. Default for the run() method is to continue looping through all installed Outputs.
In run(), this policy determines if it should call an Output's handleEvent method by comparing the metadata of the event (and possibly data IDs) with the metadata (and possibly data IDs) the Output indicates it can display.
Developers will rarely need to modify this class or worry about how it works. One case in which developers may want to modify this class is if they want to modify the way in which events are passed to a chain of installed Outputs.
| Field Summary | |
EventPriorityQueue |
inQ
This is the queue that houses incoming events to be processed by this policy. |
protected java.util.Vector |
outputs
The outputs to which this policy will offer the event. |
EventPriorityQueue |
outQ
This is the queue where the policy places processed events. |
| Fields inherited from class edu.berkeley.guir.ptk.PTK |
debug, MAX_DEBUG, MED_DEBUG, MIN_DEBUG, NO_DEBUG |
| Constructor Summary | |
OutputPolicy()
Default constructor which sets all data fields to null. |
|
OutputPolicy(java.util.Vector outputs)
Constructor that takes two parameters. |
|
| Method Summary | |
void |
addOutput(Output out)
Add an Output to this policy. |
Metadata[][] |
getAllMetadata()
Returns an array of Metadata arrays, one for each output installed in outputs. |
Metadata[] |
getFirstMetadata()
Returns an array of the first Metadata for each output installed in outputs. |
void |
run()
Called once when the OutputPolicy thread is started. |
protected void |
sendEventToOutputs(Event[] new_events)
Called by run to send the input events to the outputs. |
| Methods inherited from class edu.berkeley.guir.ptk.PTK |
getMAX, getMED, getMIN, getNO, printDebug, printDebug, printError |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.Vector outputs
public EventPriorityQueue inQ
public EventPriorityQueue outQ
| Constructor Detail |
public OutputPolicy()
public OutputPolicy(java.util.Vector outputs)
outputs - Vector of outputs to be
installed in this policy. The order of
this Vector dictates the order in which
the setters will process a new event.
The setter in the first (0th) position of
Vector will process the event first.| Method Detail |
protected void sendEventToOutputs(Event[] new_events)
public void run()
run in interface java.lang.RunnableRunnable.run()public Metadata[][] getAllMetadata()
public Metadata[] getFirstMetadata()
public void addOutput(Output out)
out - The Output object to add.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||