|
CSP for Java (JCSP) 1.1-rc4 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jcsp.plugNplay.ints.ProcessReadInt
public class ProcessReadInt
Reads one int from its input channel.
ProcessReadInt declaration, construction and use should normally be localised within a single method -- so we feel no embarassment about its public field. Its only (envisaged) purpose is as described in the example below.
Input Channels | ||
---|---|---|
in | int | All channels in this package carry integers. |
Parallel
object in which to run them:
ChannelInputInt in0, in1; . . . ProcessReadInt read0 = new ProcessReadInt (in0); ProcessReadInt read1 = new ProcessReadInt (in1); CSProcess parRead01 = new Parallel (new CSProcess[] {in0, in1});The above is best done once, before any looping over the parallel read commences. A parallel read can now be performed at any time (and any number of times) by executing:
parRead01.run ();This terminates when, and only when, both reads have completed -- the events may occur in any order. The values read may then be found in read0.value and read1.value, where they may be safely accessed up until the time that parRead01 is run again.
Parallel
,
ProcessRead
,
ProcessWrite
,
ProcessWriteInt
Field Summary | |
---|---|
int |
value
The int read from the channel |
Constructor Summary | |
---|---|
ProcessReadInt(ChannelInputInt in)
Construct a new ProcessReadInt. |
Method Summary | |
---|---|
void |
run()
The main body of this process. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int value
Constructor Detail |
---|
public ProcessReadInt(ChannelInputInt in)
in
- the channel from which to readMethod Detail |
---|
public void run()
run
in interface CSProcess
|
CSP for Java (JCSP) 1.1-rc4 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |