public class Graph
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<java.lang.String,java.util.HashSet<Actor>> |
actorInstances |
private java.util.HashMap<java.lang.String,Actor> |
actors
Actors of the graph mapped by names
|
(package private) java.lang.String |
applicationName |
private java.util.HashSet<Channel> |
channels
Channels of the graph
|
private java.util.HashMap<java.lang.String,Modifier> |
modifiers
Modifiers in the graph, required for SPDF graph
|
private java.util.HashMap<Id,Port> |
ports
Ports of the graph mapped by their ID
|
Constructor and Description |
---|
Graph() |
Graph(Graph referenceGraph)
Build a graph as exactly a copy of another graph.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Actor actor)
Add an actor to the graph
|
void |
add(Channel channel)
Add a new channel to the graph.
|
void |
add(Modifier modifier)
Add a modifier to this graph
|
void |
add(Port port)
Add a new port to the graph.
|
void |
clone(Graph anotherGraph) |
int |
countActors()
Get number of actors in the graph
|
int |
countChannels()
Get number of channels in the graph
|
void |
dump()
Print information about the graph
|
Actor |
getActor(java.lang.String actorName)
get actor with given name.
|
java.util.List<Actor> |
getActorList()
Get a list of all the actors in the graph.
|
java.util.Iterator<Actor> |
getActors()
Get an iterator to all the actors in the graph
|
java.util.Iterator<Actor> |
getActors(java.lang.String func)
Get actors corresponding to a specific function
|
java.util.HashSet<Channel> |
getChannel(Actor srcActor,
Actor dstActor)
Get all the channels connecting two actors
|
Channel |
getChannel(java.lang.String channelName)
Get a channel with a given name.
|
java.util.List<Channel> |
getChannelList()
Get list of all the channels in the graph.
|
java.util.Iterator<Channel> |
getChannels()
Get an iterator to all the channels in the graph.
|
java.lang.String |
getGraphAppName() |
Modifier |
getModifier(java.lang.String parameter)
Get a modifier by parameter name
|
java.util.Iterator<Modifier> |
getModifiers()
Get an iterator to all the modifiers in the graph.
|
Port |
getPort(Id portId)
get port with given name and function
Port must exist!
|
java.util.Iterator<Port> |
getPorts()
Get an iterator to all the ports in the graph.
|
boolean |
hasActor(java.lang.String name)
Check if the graph has an actor with specified name
|
boolean |
hasChannel(java.lang.String name)
Check if the graph has a channel with specified name
|
boolean |
hasPort(Id portId)
check whether port with given name and function
is contained in the graph
|
Channel[] |
insertNewActorBetweenTwoActors(Actor srcActor,
Actor dstActor,
Channel chnnlToRemove,
Actor newActor,
java.lang.String newActorInputPortName,
java.lang.String newActorOutputPortName)
Insert a new actor between two actors
|
Channel[] |
insertNewActorBetweenTwoActors(Actor srcActor,
Actor dstActor,
Port portAtSrc,
Port portAtDst,
Actor newActor,
java.lang.String newActorInputPortName,
java.lang.String newActorOutputPortName)
Insert a new actor between a source and destination actor.
|
void |
insertNewChannelBetweenActors(Actor srcActor,
Actor dstActor,
int tokenSize,
int initialTokens,
int srcRate,
int dstRate)
Insert a new channel between two actors.
|
void |
remove(Actor actor)
Removes actor and all channels that are bound to it.
|
void |
remove(Channel channel)
Removes a channel from the graph.
|
void |
setGraphAppName(java.lang.String name) |
private java.util.HashMap<java.lang.String,Actor> actors
private java.util.HashSet<Channel> channels
private java.util.HashMap<java.lang.String,Modifier> modifiers
private java.util.HashMap<java.lang.String,java.util.HashSet<Actor>> actorInstances
java.lang.String applicationName
public Graph()
public Graph(Graph referenceGraph)
referenceGraph
- another graphpublic java.lang.String getGraphAppName()
public void setGraphAppName(java.lang.String name)
public Channel[] insertNewActorBetweenTwoActors(Actor srcActor, Actor dstActor, Port portAtSrc, Port portAtDst, Actor newActor, java.lang.String newActorInputPortName, java.lang.String newActorOutputPortName)
srcActor
- source actordstActor
- destination actorportAtSrc
- port of the source actorportAtDst
- port of the destination actornewActor
- new actor to insertnewActorInputPortName
- name of input port for new actornewActorOutputPortName
- name of output port for new actorpublic void insertNewChannelBetweenActors(Actor srcActor, Actor dstActor, int tokenSize, int initialTokens, int srcRate, int dstRate)
srcActor
- source actordstActor
- destination actortokenSize
- size of the tokeninitialTokens
- number of initial tokenssrcRate
- production rate on the channeldstRate
- consumption rate on the channelpublic Channel[] insertNewActorBetweenTwoActors(Actor srcActor, Actor dstActor, Channel chnnlToRemove, Actor newActor, java.lang.String newActorInputPortName, java.lang.String newActorOutputPortName)
srcActor
- source actordstActor
- sink actorchnnlToRemove
- channel to be removednewActor
- new actor to be addednewActorInputPortName
- new actor input port namenewActorOutputPortName
- new actor output port namepublic void clone(Graph anotherGraph)
public void add(Actor actor)
actor
- new actor to add in the graphpublic java.util.HashSet<Channel> getChannel(Actor srcActor, Actor dstActor)
srcActor
- source actordstActor
- sink actorpublic Channel getChannel(java.lang.String channelName)
channelName
- name of the channelpublic boolean hasChannel(java.lang.String name)
name
- name of the channel to be found in the graphpublic boolean hasActor(java.lang.String name)
name
- name of the actor to be found in the graphpublic Actor getActor(java.lang.String actorName)
actorName
- name of the actor in the graph.public java.util.List<Actor> getActorList()
public java.util.Iterator<Actor> getActors()
public java.util.Iterator<Actor> getActors(java.lang.String func)
func
- functionpublic int countActors()
public int countChannels()
public void add(Port port)
port
- new port to be addedpublic boolean hasPort(Id portId)
portId
- - Id object with port name and functionpublic Port getPort(Id portId)
portId
- - Id object with port name and functionpublic java.util.Iterator<Port> getPorts()
public void remove(Actor actor)
actor
- actor to be removed from the graphpublic void remove(Channel channel)
channel
- channel to be removed from the graphpublic void add(Channel channel)
channel
- channel to be addedpublic void add(Modifier modifier)
modifier
- new modifier to add to the graphpublic Modifier getModifier(java.lang.String parameter)
parameter
- parameter namepublic java.util.Iterator<Modifier> getModifiers()
public void dump()
public java.util.Iterator<Channel> getChannels()
public java.util.List<Channel> getChannelList()