Class GraphDispatcher

Class GraphDispatcher

java.lang.Object
   |
   +----GraphPack.Graph
           |
           +----GraphDispatcher

public class GraphDispatcher
extends Graph
The GraphDispatcher will add an extra layer of indirection between the user interface and our Graph data structure. We can use it to add in actions that should be performed every time a certain Graph method is called without cluttering Graph itself with these details. For example, Coordinates want to know whenever vertices are added or deleted. Perhaps Undo will hook in here as well.

GraphDispatcher(Coordinates)

addv(Vertex)
insert vertex v into graph precond: v is not already in graph
clearAll()
clear (delete) all vertices and edges
delHV()
delete all highlighted vertices
delv(Vertex)
delete vertex v from graph
moveAllHV(double, double)
translate all highlighted vertices by (xtrans, ytrans)
toString()

GraphDispatcher
  public GraphDispatcher(Coordinates _coord)

clearAll
  public void clearAll()
clear (delete) all vertices and edges
Overrides:
clearAll in class Graph

addv

  public void addv(Vertex v)
insert vertex v into graph precond: v is not already in graph
Overrides:
addv in class Graph

delv

  public void delv(Vertex v)
delete vertex v from graph
Overrides:
delv in class Graph

delHV

  public void delHV()
delete all highlighted vertices
Overrides:
delHV in class Graph

toString

  public String toString()
moveAllHV
  public void moveAllHV(double xtrans,
                        double ytrans)
translate all highlighted vertices by (xtrans, ytrans)
Overrides:
moveAllHV in class Graph