Package org.jcsp.plugNplay
Class Regulate
- java.lang.Object
-
- org.jcsp.plugNplay.Regulate
-
- All Implemented Interfaces:
CSProcess
public class Regulate extends java.lang.Object implements CSProcess
This process controls the rate of flow of traffic from its input to output channels.Process Diagram
in ____________________________ --->---| | out reset | Regulate (initialInterval) |-->-- --->---|____________________________|
Description
Regulate 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 will be a null 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 java.lang.Object This accepts data of any Class. reset java.lang.Long This resets the time interval between outputs (milliseconds). Output Channels out java.lang.Object This carries samples from the input data, sampled at the defined rate. Implementation
See here.- See Also:
FixedDelay
,Regular
-
-
Field Summary
Fields Modifier and Type Field Description private AltingChannelInput
in
private long
initialInterval
private ChannelOutput
out
private AltingChannelInput
reset
-
Constructor Summary
Constructors Constructor Description Regulate(AltingChannelInput in, AltingChannelInput reset, ChannelOutput out, long initialInterval)
Construct the process.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
run()
The main body of this process.
-
-
-
Field Detail
-
in
private final AltingChannelInput in
-
reset
private final AltingChannelInput reset
-
out
private final ChannelOutput out
-
initialInterval
private final long initialInterval
-
-
Constructor Detail
-
Regulate
public Regulate(AltingChannelInput in, AltingChannelInput reset, ChannelOutput out, long initialInterval)
Construct the process.- Parameters:
in
- the input channelout
- the output channelinitialInterval
- the initial interval between outputs (in milliseconds)reset
- send a Long down this to change the interval between outputs (in milliseconds)
-
-