jsim.animator
Class Graph

java.lang.Object
  extended by jsim.animator.Graph

public class Graph
extends java.lang.Object

This class defines a Graph to be used with the Simulation package of JSIM. The Graph represents a skeleton of sources, sinks, and facilities along with interconnections between them.


Field Summary
 java.util.LinkedList<Edge> edges
           
 java.util.LinkedList<AnimationEntity> nodes
           
 double step
           
 
Constructor Summary
Graph(java.util.LinkedList<AnimationEntity> nodes, java.util.LinkedList<Edge> edges)
          Constructor
 
Method Summary
 void addEdge(Edge e)
          Adds a new edge to the Graph
 void addNode(AnimationEntity ae)
          Adds a new node to the Graph
 Edge getEdge(int id)
          Returns the edge with the given id
 AnimationEntity getNode(int id)
          Returns the node with the given id
static void main(java.lang.String[] args)
          Main function for testing
 void removeEdge(int id)
          Removes an edge from the Graph
 void removeNode(int id)
          Removes a node from the Graph
 void setEdgeLabel(int id)
          Sets the label position for an edge
 void setEdges()
          Sets the Edges of the Graph to connect the center of their respective endpoints Also calls all other initialization methods for the Graph
 void setIncrements(int id)
          Sets the increments for an edge
 void setNodeLabel(int id)
          Sets the label position for a node
 void setTokenLoc(int id)
          Sets the token locations for a node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodes

public java.util.LinkedList<AnimationEntity> nodes

edges

public java.util.LinkedList<Edge> edges

step

public double step
Constructor Detail

Graph

public Graph(java.util.LinkedList<AnimationEntity> nodes,
             java.util.LinkedList<Edge> edges)
Constructor

Parameters:
nodes - LinkedList of nodes for the Graph
edges - LinkedList of edges for the Graph
Method Detail

setEdges

public void setEdges()
Sets the Edges of the Graph to connect the center of their respective endpoints Also calls all other initialization methods for the Graph


setNodeLabel

public void setNodeLabel(int id)
Sets the label position for a node

Parameters:
id - id of node

setEdgeLabel

public void setEdgeLabel(int id)
Sets the label position for an edge

Parameters:
id - id of edge

setTokenLoc

public void setTokenLoc(int id)
Sets the token locations for a node


setIncrements

public void setIncrements(int id)
Sets the increments for an edge

Parameters:
id - id of the edge

getNode

public AnimationEntity getNode(int id)
Returns the node with the given id

Parameters:
id - id of the node to remove

getEdge

public Edge getEdge(int id)
Returns the edge with the given id

Parameters:
id - id of the node to remove

addNode

public void addNode(AnimationEntity ae)
Adds a new node to the Graph

Parameters:
ae - AnimationEntity to add as a node

addEdge

public void addEdge(Edge e)
Adds a new edge to the Graph

Parameters:
e - Edge to add to the Graph

removeNode

public void removeNode(int id)
Removes a node from the Graph

Parameters:
id - id of node to remove

removeEdge

public void removeEdge(int id)
Removes an edge from the Graph

Parameters:
id - id of edge to remove

main

public static void main(java.lang.String[] args)
Main function for testing