public interface GraphObserver
The graph observer is a mechanism used to monitor periodically changes made to the graph. This scenario is common in multi-threaded application where a thread is modifying the graph and one or multiple threads need to take action when updates are made.
Graph observer users should periodically call the
hasGraphChanged()
method to check the status. Each call resets
the observer so if the method returns true and the graph doesn't change after
that it will return false next time.
In addition of a boolean flag whether the graph has changed, an observer can
collect data about the differences such as nodes added or removed. Users
should call the getDiff()
method after calling
hasGraphChanged()
to obtain the diff.
Observers should be destroyed when not needed anymore. A new observer can be
obtained from the GraphModel
.
Note that observer instances are not thread-safe and should not be called from multiple threads simultaneously.
GraphModel
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys this graph observer.
|
GraphDiff |
getDiff()
Gets the graph difference.
|
Graph |
getGraph()
Gets the graph this observer is observing.
|
boolean |
hasGraphChanged()
Returns true if the graph has changed.
|
boolean |
isDestroyed()
Returns true if this observer has been destroyed.
|
boolean |
isNew()
Returns true if this observer has never got its
hasGraphChanged()
method called.
|
boolean hasGraphChanged()
GraphDiff getDiff()
Graph getGraph()
void destroy()
boolean isDestroyed()
boolean isNew()
Copyright © 2007–2015 Gephi Consortium. All rights reserved.