protected static class OptimalScheduleFinder._Channel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) int |
_numberOfConsumers
The number of actors consuming from this channel.
|
(package private) int |
_stateIndex
Index of this channel into the global state vector.
|
(package private) int |
initialTokens
The number of initial tokens on the channel.
|
Constructor and Description |
---|
_Channel()
Construct a instance of Channel and initialize nrConsumers to 0.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addTokens(OptimalScheduleFinder._State state,
int rate)
Add new tokens into the channel.
|
(package private) int |
assignPortIndex()
Called for any input port to be connected to the channel.
|
(package private) int |
assignStateIndex(int index)
Assign stateIndex and returns the next available index to be assigned
to the next channel, depending on the number of consumers of this channel.
|
(package private) int |
channelSize(OptimalScheduleFinder._State state)
return the amount of memory taken by the channel content.
|
(package private) int |
exclusiveTokens(int portIndex,
OptimalScheduleFinder._State state)
Get the number of exclusively available tokens to the consuming port with
index 'portIndex' in state 'state'.
|
(package private) void |
removeTokens(OptimalScheduleFinder._State state,
int portIndex,
int rate)
Remove tokens from the channel for given port.
|
(package private) void |
setInitialState(OptimalScheduleFinder._State state)
Initialize the state 'state' to this channel's initial state
by putting the appropriate number of initial tokens in it.
|
(package private) int |
tokens(int portIndex,
OptimalScheduleFinder._State state)
Get the number of available tokens to the consuming port with index 'portIndex'
in state 'state'.
|
int initialTokens
int _numberOfConsumers
int _stateIndex
_Channel()
int assignStateIndex(int index)
index
- state index for the channelint assignPortIndex()
int tokens(int portIndex, OptimalScheduleFinder._State state)
portIndex
- port indexstate
- stateint exclusiveTokens(int portIndex, OptimalScheduleFinder._State state)
portIndex
- port indexstate
- statevoid addTokens(OptimalScheduleFinder._State state, int rate)
state
- state to be updatedrate
- number of tokens to addvoid removeTokens(OptimalScheduleFinder._State state, int portIndex, int rate)
state
- state to be updatedportIndex
- port indexrate
- number of tokens to removevoid setInitialState(OptimalScheduleFinder._State state)
state
- state to be initializedint channelSize(OptimalScheduleFinder._State state)
state
- state