2
//////////////////////////////////////////////////////////////////////
4
// JCSP ("CSP for Java") Libraries //
5
// Copyright (C) 1996-2008 Peter Welch and Paul Austin. //
6
// 2001-2004 Quickstone Technologies Limited. //
8
// This library is free software; you can redistribute it and/or //
9
// modify it under the terms of the GNU Lesser General Public //
10
// License as published by the Free Software Foundation; either //
11
// version 2.1 of the License, or (at your option) any later //
14
// This library is distributed in the hope that it will be //
15
// useful, but WITHOUT ANY WARRANTY; without even the implied //
16
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
17
// PURPOSE. See the GNU Lesser General Public License for more //
20
// You should have received a copy of the GNU Lesser General //
21
// Public License along with this library; if not, write to the //
22
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, //
23
// Boston, MA 02111-1307, USA. //
25
// Author contact: P.H.Welch@kent.ac.uk //
27
//////////////////////////////////////////////////////////////////////
30
import org.jcsp.lang.*;
31
import org.jcsp.awt.*;
33
public class FlasherNetworkSSD implements CSProcess {
35
final private long period;
36
final private ActiveApplet activeApplet;
38
public FlasherNetworkSSD (final long period,
39
final ActiveApplet activeApplet) {
41
this.activeApplet = activeApplet;
46
final One2OneChannel mouseEvent = Channel.one2one ();
47
final One2OneChannel appletConfigure = Channel.one2one ();
48
final One2OneChannelInt stopStart = Channel.one2oneInt ();
49
final One2OneChannelInt destroy = Channel.one2oneInt ();
50
final One2OneChannelInt destroyAck = Channel.one2oneInt ();
52
activeApplet.addMouseEventChannel (mouseEvent.out());
53
activeApplet.setConfigureChannel (appletConfigure.in());
54
activeApplet.setStopStartChannel (stopStart.out());
55
activeApplet.setDestroyChannels (destroy.out(), destroyAck.in());
56
// activeApplet.setDestroyChannels (destroy.out(), destroyAck.in(), -1);
61
new FlasherControl (period, mouseEvent.in(), appletConfigure.out()),
65
switch (stopStart.in().read ()) {
66
case ActiveApplet.STOP:
67
System.out.println ("FlasherNetworkSSD: ActiveApplet.STOP received");
69
case ActiveApplet.START:
70
System.out.println ("FlasherNetworkSSD: ActiveApplet.START received");
73
System.out.println ("FlasherNetworkSSD: ActiveApplet.<not STOP/START> received");
82
switch (destroy.in().read ()) {
83
case ActiveApplet.DESTROY:
84
System.out.println ("FlasherNetworkSSD: ActiveApplet.DESTROY received");
85
destroyAck.out().write (0);
88
System.out.println ("FlasherNetworkSSD: ActiveApplet.<not DESTROY> received");