Exercise I

Exercise I
• Implement in Java asynchronous
communication between threads via unbounded
FIFO buffers.
Provide also a means to initialize these buffers.
Exercise II
• Let a Java component be a package with two
special static classes IChn and OChn which
declare by means of static attributes a collection of
input and output channels, respectively.
Discuss possible forms of encapsulation and the
corresponding techniques to enforce them.
Exercise III
• Define a Java component Merger with a class
IChn declaring two asynchronous input channels
in1, in2, and a class OChn declaring a single
asynchronous output channel out.
The component reads non-deterministically from
the input channels in1 and in2 and outputs these
values along its output channel out in the original
order.
Exercise IV
• Define a Java component Replicator with a class
IChn declaring an asynchronous input channel in,
and a class OChn declaring two asynchronous
output channels out1 and out2.
The component sends the value received from its
input channel in to both its output channels out1
and out2.
Exercise V
• Assume given a Java component Adder that
outputs the sum of the values read from its input
channels in1 and in2 along its output channel out.
Using the above components (except the Merger),
construct a component MAIN that builds a
network generating the Fibonacci sequence along
its output channel fib.
Washing Machine Interface
Behavior of Buttons
•
Successively pressing the Program button (3) cycles through the following
choices:
– Cotton; Color; Synthetic; Delicate; Wool; Quick; Rinse & Spin; Spin
•
Successively pressing the Options button (4) cycles through the following
choices:
– Eco+; Rinse+; Pre-wash; [no-choice]
•
Successively pressing the Spin button (5) cycles through the following
choices:
– No Spin; Rinse & Hold; [no-choice]
•
•
•
Successively pressing the Temp button (6) cycles through 5 different choices
for the temperature setting.
Successively pressing the Delay Start button (7) cycles through 25 different
choices (1-24 plus 0) for the delay setting.
Pressing the Start (8) button takes the current values of all choices and starts
the (Pre-wash, Wash, Rinse, Spin) cycle they specify.
Exercise VI
• Design the Reo connector network for the
interface of the washing machine as
described in the previous slides and the
lecture. Explicitly describe every
component you use in your design. The
simpler and more generic your components
are, the better the design (and your grade).