org.grinvin.gred.undoable

Interface UndoableGraph

All Superinterfaces:
Graph, GraphView
Known Implementing Classes:
DefaultGraph, DefaultGraphModel

public interface UndoableGraph
extends Graph

An undoable version of Graph. Provides methods to restore vertices and edges in the graph.

Method Summary

void
restore(Edge e)
Restore a edge which was previously removed from the graph.
void
restore(Vertex v)
Restore a vertex which was previously removed from the graph.

Methods inherited from interface org.grinvin.graphs.Graph

addNewEdge, addNewVertex, clear, copy, remove, remove

Methods inherited from interface org.grinvin.graphs.GraphView

areAdjacent, contains, contains, edgeIterator, edges, getEdge, getNumberOfEdges, getNumberOfVertices, getVertex, vertexIterator, vertices

Method Details

restore

public void restore(Edge e)
Restore a edge which was previously removed from the graph.

This method is intended for use by the undo/redo framework and should be called with care. It is supposed to undo a prior removal of that same edge. Clients are urged to instead use UndoableGraph whenever possible.

Parameters:
e - Edge that should be restored. This must be a edge that was previously removed from the same graph.

restore

public void restore(Vertex v)
Restore a vertex which was previously removed from the graph. The vertex should end up at the same index position as it had before.

This method is intended for use by the undo/redo framework and should be called with care. It is supposed to undo a prior removal of that same vertex. Clients are urged to instead use UndoableGraph whenever possible.

Parameters:
v - Vertex that should be restored. This must be a vertex that was previously removed from the same graph.