Communicating Threads for Java

A CSP library for Java

© Copyrights 2000 Gerald H. Hilderink

csp.lang
Class Guard

java.lang.Object
  |
  +--csp.lang.Guard
Direct Known Subclasses:
Alternative, Channel, Skip, Stop, Timeout

public class Guard
extends java.lang.Object

Guard objects are part of the Alternative composition construct. Each Guard object guards a process by a channel. The process may be selected by the Alternative construct when the channel is ready. A Guard that is guarding a process by channel input is called an input-guard and a Guard that is guarding a process by channel output is called an output-guard. A Guard that is always ready is called a skip-guard (CSP features). Also timeout-guards are included (Times CSP features). The input-guard and output-guard objects also support multiway channel guards.

Copyright © 1996-2000 Gerald H. Hilderink. All Rights Reserved.

Version:
January 2000, version 0.9, revision 17.
Author:
Gerald H. Hilderink

Constructor Summary
Guard()
          Create a skip-guard that is always true and performs a skip.
Guard(Boolean enabled)
          Create a conditonal skip-guard that and performs a skip if enabled.
Guard(Boolean enabled, ChannelInput channel)
          Create an input-guard with specified channel.
Guard(Boolean enabled, ChannelInput channel, Process process)
          Create an input-guard with specified channel and process.
Guard(Boolean enabled, ChannelOutput channel)
          Create an output-guard with specified channel.
Guard(Boolean enabled, ChannelOutput channel, Process process)
          Create an output-guard with specified channel and process.
Guard(Boolean enabled, long time)
          Create a timeout-skip-guard with specified timeout.
Guard(Boolean enabled, long time, Process process)
          Create a conditional timeout-guard with specified process and timeout.
Guard(Boolean enabled, Process process)
          Create a skip-guard with specified process.
Guard(ChannelInput channel)
          Create an input-guard with specified channel.
Guard(ChannelInput channel, Process process)
          Create an input-guard with specified channel and process.
Guard(ChannelOutput channel)
          Create an output-guard with specified channel.
Guard(ChannelOutput channel, Process process)
          Create an output-guard with specified channel and process.
Guard(long time)
          Create a timeout-skip-guard with specified timeout.
Guard(long time, Process process)
          Create a timeout-guard with specified process and timeout.
Guard(Process process)
          Create a skip-guard with specified process.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Guard

public Guard()
Create a skip-guard that is always true and performs a skip. The guard is enabled by default.
This skip-guards is used with alt.select().

Guard

public Guard(Boolean enabled)
Create a conditonal skip-guard that and performs a skip if enabled.
This skip-guards is used with alt.select().

Guard

public Guard(ChannelInput channel,
             Process process)
Create an input-guard with specified channel and process. The guard is enabled by default.

Parameters:
channel - the input channel
process - the guarded process

Guard

public Guard(ChannelInput channel)
Create an input-guard with specified channel. No process will be executed and therefor this guard is simular to a skip-guard. The guard is enabled by default. This skip-guard is used with alt.select().

Parameters:
channel - the input channel

Guard

public Guard(Boolean enabled,
             ChannelInput channel)
Create an input-guard with specified channel. No process will be executed and therefor this guard is simular to a skip-guard. This skip-guard is used with alt.select().

Parameters:
enabled - true for enabled; false for disabled
channel - the input channel

Guard

public Guard(ChannelOutput channel,
             Process process)
Create an output-guard with specified channel and process. The guard is enabled by default.

Parameters:
channel - the output channel
process - the guarded process

Guard

public Guard(ChannelOutput channel)
Create an output-guard with specified channel. No process will be executed and therefor this guard is simular to a skip-guard. The guard is enabled by default. This skip-guards is used with alt.select().

Parameters:
channel - the output channel

Guard

public Guard(Boolean enabled,
             ChannelOutput channel)
Create an output-guard with specified channel. No process will be executed and this guard is simular to a skip-guard. This skip-guard is used with alt.select().

Parameters:
enabled - true for enabled; false for disabled
channel - the output channel

Guard

public Guard(Boolean enabled,
             ChannelInput channel,
             Process process)
Create an input-guard with specified channel and process. The guard may be enabled or disabled at the instantiation of the guard as specified by enabled.

Parameters:
enabled - true for enabled; false for disabled
channel - the input channel
process - the guarded process

Guard

public Guard(Boolean enabled,
             ChannelOutput channel,
             Process process)
Create an output-guard with specified channel and process. The guard may be enabled ordisabled at the instantiation of the guard as specified by enabled.

Parameters:
enabled - true for enabled; false for disabled
channel - the output channel
process - the guarded process

Guard

public Guard(Process process)
Create a skip-guard with specified process. The guard is always ready. The guard is enabled by default.

Parameters:
process - the guarded process

Guard

public Guard(Boolean enabled,
             Process process)
Create a skip-guard with specified process. The guard may be enabled or disabled at the instantiation of the guard as specified by enabled.

Parameters:
enabled - true for enabled; false for disabled
process - the guarded process

Guard

public Guard(long time)
Create a timeout-skip-guard with specified timeout. The guard is enabled by default.

When multiple timeout guards in the guard list of the Alternative construct then the guard with the smallest timeout will be active. When there are multiple timeout guards with the smallest and equal timeout then one will be selected. One timeout-guard per Alternative is recommended.

Parameters:
time - the timeout time in milliseconds

Guard

public Guard(Boolean enabled,
             long time)
Create a timeout-skip-guard with specified timeout.

When multiple timeout guards in the guard list of the Alternative construct then the guard with the smallest timeout will be active. When there are multiple timeout guards with the smallest and equal timeout then one will be selected. One timeout-guard per Alternative is recommended.

Parameters:
enabled - true for enabled; false for disabled
time - the timeout time in milliseconds

Guard

public Guard(long time,
             Process process)
Create a timeout-guard with specified process and timeout. The guard is enabled by default.

When multiple timeout guards in the guard list of the Alternative construct then the guard with the smallest timeout will be active. When there are multiple timeout guards with the smallest and equal timeout then one will be selected. One timeout-guard per Alternative is recommended.

Parameters:
time - the timeout time in mseconds
process - the guarded process

Guard

public Guard(Boolean enabled,
             long time,
             Process process)
Create a conditional timeout-guard with specified process and timeout.

When multiple timeout guards in the guard list of the Alternative construct then the guard with the smallest timeout will be active. When there are multiple timeout guards with the smallest and equal timeout then one will be selected. One timeout-guard per Alternative is recommended.

Parameters:
enabled - true for enabled; false for disabled
time - the timeout time in mseconds
process - the guarded process

Communicating Threads for Java

A CSP library for Java

© Copyrights 2000 Gerald H. Hilderink