public class GraphScene<V extends Vertex,E extends Edge>
extends java.lang.Object
GraphView
.
begin()
and end()
/end(boolean)
. All actions
like adding new vertices/edges, removing existing vertices/edges or modify vertices/edges that were made at the graph in this interval
can be reversed. That means you can restore the state of the graph view before the scene.Constructor and Description |
---|
GraphScene(GraphView<V,E> graphView)
Creates a new graph scene.
|
Modifier and Type | Method and Description |
---|---|
GraphScene<V,E> |
begin()
Starts the scene meaning that from now on all actions at the graph view like adding new objects, removing
existing objects or modify objects are recorded and can be reversed after ending the scene.
|
GraphScene<V,E> |
end()
Ends the scene meaning that the recording of actions is stopped.
|
GraphScene<V,E> |
end(boolean releaseUnmodifiedObjects)
Ends the scene meaning that the recording of actions is stopped.
|
GraphView<V,E> |
getGraphView()
Gets the corresponding graph view.
|
boolean |
isRecorded()
Indicates whether the scene is recorded meaning that
end(boolean) was invoked. |
void |
reverse()
Reverses the scene meaning that all actions at the graph view (in this scene) like adding new objects, removing
existing objects or modify objects are reversed so that the state of the graph view is the one before
this scene.
|
public final GraphView<V,E> getGraphView()
public final GraphScene<V,E> begin() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- end(boolean)
,
reverse()
public final GraphScene<V,E> end() throws java.lang.IllegalStateException
scene3.reverse()
, scene2.reverse()
, scene1.reverse()
.
end()
and a stack data structure to store the scene history if you record multiple scenes
step by step and use end(false)
(no release of unmodified objects) if you want to record
only one scene that can restore a specific state of the graph view.
java.lang.IllegalStateException
- public final GraphScene<V,E> end(boolean releaseUnmodifiedObjects) throws java.lang.IllegalStateException
end()
and a stack data structure to store the scene history if you record multiple scenes
step by step and use end(false)
(no release of unmodified objects) if you want to record
only one scene that can restore a specific state of the graph view.
releaseUnmodifiedObjects
- true
if objects that were not modified should be released otherwise false
java.lang.IllegalStateException
- end()
public final void reverse() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- public final boolean isRecorded()
end(boolean)
was invoked.true
if the scene recording is finished otherwise false