public class Channel
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
Channel.Link
A link between a channel and an actor what is usually called a port.
|
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
auto |
private java.lang.String |
channelName
Name of the channel.
|
(package private) Graph |
graph |
private int |
initialTokens
Number of initial tokens on the channel
|
private Channel.Link[] |
links |
private int |
tokenSize
Size of each token
|
Constructor and Description |
---|
Channel() |
Modifier and Type | Method and Description |
---|---|
private void |
bind(PortRef ref,
Port.DIR dir)
Bind a port of an actor.
|
void |
bind(PortRef src,
PortRef snk)
Let the channel bind the two specified ports.
|
boolean |
getAutoFlag()
get the status of auto flag, indicating purely analytical channels
|
Graph |
getGraph() |
int |
getInitialTokens()
Get Initial tokens
|
Channel.Link |
getLink(Port.DIR dir)
Get one of the two links of the channel.
|
java.lang.String |
getName()
Get the name of the channel
|
Actor |
getOpposite(Actor actor)
Get the link at the opposite side of the channel
|
int |
getTokenSize()
Get size of the tokens
|
boolean |
isBound()
Check binding
|
void |
setAutoFlag()
set auto flag for purely analytical channels
|
(package private) void |
setGraph(Graph g)
Called by the graph when the link is getting assigned to the graph
|
void |
setInitialTokens(int tokens)
Set Initial tokens
|
void |
setName(java.lang.String name)
Set the name of the channel
|
void |
setTokenSize(int size)
Set the size of tokens
|
java.lang.String |
toString() |
void |
unbind()
Unlink the channel before removal
|
private void |
unbind(Channel.Link link)
Unbind a link on the port of actor.
|
private int initialTokens
private int tokenSize
private java.lang.String channelName
private Channel.Link[] links
Graph graph
boolean auto
public void setInitialTokens(int tokens)
tokens
- number of initial tokenspublic int getInitialTokens()
public void setTokenSize(int size)
size
- of tokenspublic int getTokenSize()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- name of the channelvoid setGraph(Graph g)
g
- graph where the channel belongs topublic Graph getGraph()
public Channel.Link getLink(Port.DIR dir)
dir
- IN or OUTpublic void bind(PortRef src, PortRef snk)
src
- source port reference for the channelsnk
- sink port reference for the channelpublic void unbind()
public boolean isBound()
public Actor getOpposite(Actor actor)
actor
- actor on one end of the channel.public void setAutoFlag()
public boolean getAutoFlag()
private void bind(PortRef ref, Port.DIR dir)
ref
- Port reference for the portdir
- direction in which to bindprivate void unbind(Channel.Link link)
link
- link to unbindpublic java.lang.String toString()
toString
in class java.lang.Object