algoanim.primitives
Class Graph

java.lang.Object
  extended by algoanim.primitives.Primitive
      extended by algoanim.primitives.Graph

public class Graph
extends Primitive

Represents a graph

Version:
0.7 2007-04-04
Author:
Dr. Guido Roessling (roessling@acm.org>

Field Summary
protected  int[][] adjacencyMatrix
           
protected  java.lang.String[] nodeLabels
           
protected  Node[] nodes
           
 
Fields inherited from class algoanim.primitives.Primitive
gen
 
Constructor Summary
Graph(GraphGenerator graphGen, java.lang.String name, int[][] graphAdjacencyMatrix, Node[] graphNodes, java.lang.String[] labels, DisplayOptions display, GraphProperties props)
          Instantiates the Graph and calls the create() method of the associated GraphGenerator.
 
Method Summary
 int[][] getAdjacencyMatrix()
          Returns the adjacency matrix of this Graph element.
 int[] getEdgesForNode(int node)
          Returns the adjacency matrix of this Graph element.
 int getEdgeWeight(int fromNode, int toNode)
           
 Node getNode(int nodeNr)
           
 java.lang.String getNodeLabel(int nodeNr)
           
 GraphProperties getProperties()
          Returns the properties of this Graph element.
 int getSize()
           
 Node getStartKnoten()
           
 Node getZielKnoten()
           
 void hideEdge(int startNode, int endNode, Timing offset, Timing duration)
          show a selected (previously visible?) graph edge by turning it invisible
 void hideEdgeWeight(int startNode, int endNode, Timing offset, Timing duration)
          hides a selected (previously visible?) graph edge weight by turning it invisible
 void hideNode(int index, Timing offset, Timing duration)
          hide a selected graph node by turning it invisible
 void hideNodes(int[] indices, Timing offset, Timing duration)
          hide a selected set of graph nodes by turning them invisible
 void highlightEdge(int startNode, int endNode, Timing offset, Timing duration)
          Highlights the graph edge at a given position after a distinct offset.
 void highlightNode(int node, Timing offset, Timing duration)
          Highlights the chosen graph node after a distinct offset.
 void setEdgeWeight(int fromNode, int toNode, int weight, Timing offset, Timing duration)
           
 void setEdgeWeight(int fromNode, int toNode, java.lang.String weight, Timing offset, Timing duration)
           
 void setName(java.lang.String newName)
          Sets the name of this Primitive.
 void setStartKnoten(Node node)
           
 void setZielKnoten(Node node)
           
 void showEdge(int startNode, int endNode, Timing offset, Timing duration)
          show a selected (previously hidden) graph edge by turning it visible
 void showEdgeWeight(int startNode, int endNode, Timing offset, Timing duration)
          show a selected (previously invisible?) graph edge weight by turning it visible
 void showNode(int index, Timing offset, Timing duration)
          show a selected (previously hidden) graph node by turning it visible
 void showNodes(int[] indices, Timing offset, Timing duration)
          show a selected (previously hidden) graph node by turning it visible
 void translateNode(int nodeIndex, Node location, Timing offset, Timing duration)
           
 void translateNodes(int[] nodeIndices, Node location, Timing offset, Timing duration)
           
 void translateWithFixedNodes(int[] nodeIndices, Node location, Timing offset, Timing duration)
           
 void unhighlightEdge(int startNode, int endNode, Timing offset, Timing duration)
          Unhighlights the graph edge at a given position after a distinct offset.
 void unhighlightNode(int node, Timing offset, Timing duration)
          Unhighlights the chosen graph node after a distinct offset.
 
Methods inherited from class algoanim.primitives.Primitive
changeColor, exchange, getDisplayOptions, getName, hide, hide, moveBy, moveTo, moveVia, rotate, rotate, show, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeLabels

protected java.lang.String[] nodeLabels

nodes

protected Node[] nodes

adjacencyMatrix

protected int[][] adjacencyMatrix
Constructor Detail

Graph

public Graph(GraphGenerator graphGen,
             java.lang.String name,
             int[][] graphAdjacencyMatrix,
             Node[] graphNodes,
             java.lang.String[] labels,
             DisplayOptions display,
             GraphProperties props)
Instantiates the Graph and calls the create() method of the associated GraphGenerator.

Parameters:
graphGen - the appropriate code Generator.
name - the name for the graph
graphAdjacencyMatrix - the adjacency matrix for the graph
graphNodes - the graph's nodes
labels - the labels for the graph nodes
display - [optional] the DisplayOptions of this Text element.
props - [optional] the properties of this Text element.
Method Detail

getProperties

public GraphProperties getProperties()
Returns the properties of this Graph element.

Returns:
the properties of this Graph element.

getAdjacencyMatrix

public int[][] getAdjacencyMatrix()
Returns the adjacency matrix of this Graph element.

Returns:
the adjaceny matrix of this Graph element.

getSize

public int getSize()

getNode

public Node getNode(int nodeNr)

getNodeLabel

public java.lang.String getNodeLabel(int nodeNr)

getEdgesForNode

public int[] getEdgesForNode(int node)
Returns the adjacency matrix of this Graph element.

Returns:
the adjaceny matrix of this Graph element.

getEdgeWeight

public int getEdgeWeight(int fromNode,
                         int toNode)

setEdgeWeight

public void setEdgeWeight(int fromNode,
                          int toNode,
                          int weight,
                          Timing offset,
                          Timing duration)

setEdgeWeight

public void setEdgeWeight(int fromNode,
                          int toNode,
                          java.lang.String weight,
                          Timing offset,
                          Timing duration)

hideNode

public void hideNode(int index,
                     Timing offset,
                     Timing duration)
hide a selected graph node by turning it invisible

Parameters:
index - the index of the node to be hidden
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

hideNodes

public void hideNodes(int[] indices,
                      Timing offset,
                      Timing duration)
hide a selected set of graph nodes by turning them invisible

Parameters:
indices - the set of node indices to be hidden
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

hideEdge

public void hideEdge(int startNode,
                     int endNode,
                     Timing offset,
                     Timing duration)
show a selected (previously visible?) graph edge by turning it invisible

Parameters:
startNode - the start node of the edge to be hidden
endNode - the end node of the edge to be hidden
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

hideEdgeWeight

public void hideEdgeWeight(int startNode,
                           int endNode,
                           Timing offset,
                           Timing duration)
hides a selected (previously visible?) graph edge weight by turning it invisible

Parameters:
startNode - the start node of the edge weight to be hidden
endNode - the end node of the edge weightto be hidden
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

showEdge

public void showEdge(int startNode,
                     int endNode,
                     Timing offset,
                     Timing duration)
show a selected (previously hidden) graph edge by turning it visible

Parameters:
startNode - the start node of the edge to be shown
endNode - the end node of the edge to be hidden
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

showEdgeWeight

public void showEdgeWeight(int startNode,
                           int endNode,
                           Timing offset,
                           Timing duration)
show a selected (previously invisible?) graph edge weight by turning it visible

Parameters:
startNode - the start node of the edge weight to be shown
endNode - the end node of the edge weightto be shown
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

showNode

public void showNode(int index,
                     Timing offset,
                     Timing duration)
show a selected (previously hidden) graph node by turning it visible

Parameters:
index - the index of the node to be shown
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

showNodes

public void showNodes(int[] indices,
                      Timing offset,
                      Timing duration)
show a selected (previously hidden) graph node by turning it visible

Parameters:
indices - the index of the node to be shown
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

highlightEdge

public void highlightEdge(int startNode,
                          int endNode,
                          Timing offset,
                          Timing duration)
Highlights the graph edge at a given position after a distinct offset.

Parameters:
startNode - the start node of the edge to highlight.
endNode - the end node of the edge to highlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

unhighlightEdge

public void unhighlightEdge(int startNode,
                            int endNode,
                            Timing offset,
                            Timing duration)
Unhighlights the graph edge at a given position after a distinct offset.

Parameters:
startNode - the start node of the edge to unhighlight.
endNode - the end node of the edge to unhighlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

highlightNode

public void highlightNode(int node,
                          Timing offset,
                          Timing duration)
Highlights the chosen graph node after a distinct offset.

Parameters:
node - the node to highlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

unhighlightNode

public void unhighlightNode(int node,
                            Timing offset,
                            Timing duration)
Unhighlights the chosen graph node after a distinct offset.

Parameters:
node - the node to unhighlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

translateNode

public void translateNode(int nodeIndex,
                          Node location,
                          Timing offset,
                          Timing duration)

translateWithFixedNodes

public void translateWithFixedNodes(int[] nodeIndices,
                                    Node location,
                                    Timing offset,
                                    Timing duration)

translateNodes

public void translateNodes(int[] nodeIndices,
                           Node location,
                           Timing offset,
                           Timing duration)

setName

public void setName(java.lang.String newName)
Description copied from class: Primitive
Sets the name of this Primitive.

Overrides:
setName in class Primitive
Parameters:
newName - the new name for this Primitive.
See Also:
Primitive.setName(java.lang.String)

setStartKnoten

public void setStartKnoten(Node node)

setZielKnoten

public void setZielKnoten(Node node)

getStartKnoten

public Node getStartKnoten()

getZielKnoten

public Node getZielKnoten()