CSP for Java
(JCSP) 1.1-rc4

Class RegulateInt

  extended by org.jcsp.plugNplay.ints.RegulateInt
All Implemented Interfaces:

public class RegulateInt
extends Object
implements CSProcess

This process controls the rate of flow of traffic from its input to output channels.

Process Diagram

     in    _______________________________
   --->---|                               | out
    reset | RegulateInt (initialInterval) |-->--


RegulateInt produces a constant rate of output flow, regardless of the rate of its input. At the end of each time period, it outputs the last object input during that period. If nothing comes in, the previous output will be repeated (note: this is defined to be zero if nothing has ever arrived). If the input flow is greater than the required output flow, data will be discarded.

The interval (in msecs) defining the output flow rate is given by a constructor argument. This can be changed at any time by sending a new interval (as a Long) down its reset channel.

Channel Protocols

Input Channels
in int The input stream.
reset java.lang.Long This resets the time interval between outputs (milliseconds).
Output Channels
out int This carries samples from the input data, sampled at the defined rate.


See here (for the implementation of Regulate – which is the same apart from regulating Object, rather than int, traffic).

P.H. Welch
See Also:
FixedDelayInt, RegularInt

Constructor Summary
RegulateInt(AltingChannelInputInt in, AltingChannelInput reset, ChannelOutputInt out, long initialInterval)
          Construct the process.
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

Constructor Detail


public RegulateInt(AltingChannelInputInt in,
                   AltingChannelInput reset,
                   ChannelOutputInt out,
                   long initialInterval)
Construct the process.

in - the input channel
out - the output channel
initialInterval - the initial interval between outputs (in milliseconds)
reset - send a Long down this to change the interval between outputs (in milliseconds)
Method Detail


public void run()
The main body of this process.

Specified by:
run in interface CSProcess

CSP for Java
(JCSP) 1.1-rc4

Submit a bug or feature to jcsp-team@kent.ac.uk
Version 1.1-rc4 of the JCSP API Specification (Copyright 1997-2008 P.D.Austin and P.H.Welch - All Rights Reserved)
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.