The Data Factory
A Brief Users' Guide
Purpose of the Software
The Data Factory is an experimental programming environment
based on a form of computation called the "factory model".
This software supports investigations into the use of
the factory model in explaining computing concepts and
in exploring the possibilities for programs and program
styles in the factory model.
Requirements
To run the software, you need a Java runtime system with
a JDK 1.3 compatibility. For the web-based applet, you
should have a browser with a Java JDK 1.3 compatible plug-in.
Older plug-ins, such as the JDK 1.1.5 compatible plug-in
that shipped with Netscape 4.7 may be able to run the
main part of the program, but
might not allow you to load and save files.
Program Layout
The program appears in its own window. This window has two
panes. The top one is the factory area where a factory layout
can be created and run. The bottom panel is the tool bar.
Tool Panel
The tool panel is used to draw the factory and control execution.
There are two kinds of tool icons: control icons and drawing
icons. The icons are arranged in three rows. Each row contains
ten icons. The first 8 icons of the top row are control icons.
All the rest are drawing icons. Here is a list of the functionality
of the icons.
Top row:
-
1. Stop execution (control icon). Click on this to stop the factory
when it is running.
-
2. Perform one step of factory processing.
-
3. Run at slow speed.
-
4. Run at high speed.
-
5. Selection tool.
This is used in conjunction with the Edit menu.
Copying and clearing operations use selections.
The selection tool is also used in Past operations to indicate
where the upper-left corner of the rectangle to be pasted
should go.
-
6. Factory broom. Can be used to erase things. It behaves just
like the conveyor drawing tool but draws blanks instead of conveyors.
-
7. Data broom. Used to erase data objects. You must draw as
if drawing a conveyor. Therefore this can be used to easily clean
data off of a conveyor.
-
8. Flashlight. When this is selected, you can click on something
and possibly get more information about it or, in some cases, edit it.
The values for constants and for the range of random numbers
can be edited by clicking on the device instance with this tool.
-
9. Stop sign. When a data object reaches a stop sign, it stops the
factory processing as if the user clicked on the red traffic light
icon.
-
10. Gate. An input arriving at input port 1 waits until any data
object arrives at input port 2. Then the gate is momentarily opened
and the first data value passes to output port 1.
Middle row:
-
11. Conveyor. You can draw a conveyor belt or a pair of conveyor
belts with this tool. Conveyors always go either north, east, west,
or south. They are automatically color-coded to show which way
they transport data. If you try to draw a diagonal conveyor belt,
this tool will automatically create two separate conveyors in an ell
shape to connect the same points. However, the tool uses its own
layout method which sometimes, but doesn't always, do what you
might want. A conveyor is not considered to be a processing device
in the Data Factory. Note that data will normally fall off the
end of a conveyor. Unless that data is consumed by a device or
is carried away by another conveyor, that data will stop there
and other data may back up behind it, forming a traffic jam.
-
12. Crossover. Used to create a special processing device that
simulates two conveyors crossing each other. Inputs and outputs
should be aligned such that each incoming input has a corresponding
output 180 degrees (opposite it) around the center of the crossover.
Inputs must arrive inside the device, and the outputs are placed
just outside the device. Unlike other devices with more
than one input port, data arriving at
a crossover don't have to wait for other data to arrive.
Also, crossovers are unique in being able to accept inputs on
any side, as long as the data falls onto one of the eight cells
(i.e., not the center cell) inside the crossover device.
-
13. Add. Used to create an adding device. Note that the
two input ports are on the left. Thin reddish lines
on the borders of the devices show where the ports are.
The input conveyors should drop the data just inside the lines
on the left. Output data is placed just outside the device,
next to the thin reddish line(s) on the right.
-
14. Multiply.
-
15. Subtract.
-
16. Divide.
-
17. Mod
-
18. Less than. If input 1 is less than input 2, then a 1 is put
onto output 1. If not, a 0 is put out.
-
19. Equal to.
-
20. Greater than.
Bottom row:
-
21. Constant source. Feeds a constant to its output port 1
whenever there is a vacancy there.
-
22. Button-activated constant source. Feeds a constant to its
output port 1 whenever both the output port is vacant and the
button has been pressed. The button immediately resets itself
and can be pressed again.
-
23. Button operated gate. When pressed, it lets its input value
move to its output. It immediately resets itself and can be
pressed again.
-
24. Random-number generator. Feeds a random number to its output
port 1, whenever it is vacant. The number is an integer in
the range 0 to n-1. Initially n is fixed at 10, so the numbers
are in the range 0 to 9. Using the flashlight tool it is possible
to edit the value of n for any instance of a random-number generator.
-
25. Kloner. Takes one input and propagates it to both outputs.
Be sure to run conveyors out of both outputs so that data doesn't get stuck
at one of the ports.
-
26. Switched router. The value of input 2 controls which way
input 1 goes. 0 sends it to output 1, and 1 sends it to output 2.
-
27. Sorter. Implements a compare-and-exchange module. When two
inputs are available, they are propagated to the outputs, but
the smaller one is always sent to output 1 and the greater one
to output 2.
-
28. Delay. An input arriving at input port 1 is held inside
the device until another input arrives on the same port.
Input port 2 is ignored. When the second input arrives, the
data object being held is released on output 1, and the new
input is then held, etc.
-
29. Delta. Takes a single input stream. Keeps track of the
last input value received. It only propagates the input to
the output if the value is different from the last one.
Also, the first input value that arrives does get passed through,
unlike with the DELAY device.
-
30. Display and destroy. Holds the last value received, and any
new value overwrites the last one. A display serves as a data sink,
allowing data to die and not clog up the conveyors.
Editing
Copy and Paste work with the selection tool and the Edit menu.
Moving is not directly implemented, but you can move
a rectangular portion of the factory by first selecting it,
then copying it, then clearing the selected portion of the factory,
then using the selection tool to indicate where the upper-left
corner of the pasted section should go, and finally, selecting
Paste from the Edit menu.
Most drawing operations can be retracted using the Undo option
on the Edit menu.
Loading and Saving Files
The current version only loads and saves files from or
to the client hard disk. To load a file that is on the web,
first download the file to your hard disk, and then load it as
a local file. Note that when you run the Data Factory
as an applet on the web, you must be using a Java Plug that supports
local loading and saving by signed applets. The version of the
Data Factory installed in the CSE 341 web site is a signed applet.
Sample Programs
To run one of these, first download it to your hard disk. Then
load it into the Data Factory using the File:Load menu item and
the file dialog box that comes up.
Each of these files is an ASCII text files that represents the state
of a factory, including device and conveyor layouts and data.
-
Even-odd sorter
Sorts a stream of random numbers into two separate streams according
to whether the numbers are even or odd.
After you have loaded this factory setup, you can
run it by first pressing the "go slow" button (yellow traffic
light without the "1"). Then press the "button" in the lower-left
part of the factory layout -- the one with the black "n" and the
white "1" in it. This releases a data value 1, which then can
propagate down a conveyor to be cloned, added to its clone, and
cloned again so that a value 2 will recirculate in a loop feeding
the divisor input of the MOD device.
After the sorting finishes (because the output back up and form
a traffic jam), you can clear all the data from the Edit menu and
run the program again.
-
Factorial sequence generator
Creates a sequence of factorials.
-
Fibonacci number generator
Creates the Fibonacci sequence.
-
Sorter
Sorts vectors of 4 numbers at a time, using a parallel
sorting network.
(C) S. Tanimoto, 2003.