All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jcsp.awt.event.EventIDFilter

java.lang.Object
   |
   +----jcsp.awt.event.EventIDFilter

public class EventIDFilter
extends Object
implements CSProcess

Process Diagram

              _______________
     eventIn |               | idOut
    ---->----| EventIDfilter |--->---
             |_______________|
 

Description

The EventIDFilter is a process which has an infinite loop which waits for Objects of type AWTEvent on the eventIn Channel. The process then extracts the event ID from the AWTEvent Object and sends this down the idOut Channel wrapped in an Integer Object.

Channel Protocols

Input Channels
eventIn java.awt.AWTEvent The event that the ID is required from
Any other Class If any other Object is sent down the eventIn Channel a ClassCastException will be thrown by the Runtime system.
Output Channels
idOut java.lang.Integer The event ID of the AWTEvent Object sent down the eventIn Channel

Example

 import jcsp.awt.*;
 import jcsp.awt.event.*;
 import jcsp.lang.*;
        :
        :
   {
     final Channel event = new One2OneChannel();
     final Channel id = new One2OneChannel();
     ActiveButton c = new ActiveButton("Active");
     add(c);
     c.addFocusEventChannel(event);
     new Parallel(new CSProcess[] {
       c,
       new EventIDFilter(event, id),
       new CSProcess() {
         public void run() {
           while (true) {
             Object o = id.read();
             System.out.println("FocusEvent ID='" + o);
           }
         }
       }
     }).run();
   }
 }
 

Author:
P.D.Austin

Constructor Index

 o EventIDFilter(ChannelInput, ChannelOutput)
Construct a new EventIDFilter with the specified Channels.

Method Index

 o run()
The main body of the process.

Constructors

 o EventIDFilter
 public EventIDFilter(ChannelInput eventIn,
                      ChannelOutput idOut)
Construct a new EventIDFilter with the specified Channels.

Parameters:
eventIn - The Channel AWTEvents are received from
idOut - The Channel the Events ID is sent down

Methods

 o run
 public void run()
The main body of the process. Executes the functionality described above.


All Packages  Class Hierarchy  This Package  Previous  Next  Index