public class SimpleEventManager extends Object implements GraphEventManager
This class also holds the utility method notifyingRemove, which wraps iterators so that their .remove() operation notifies the specified graph of the removal.
| Constructor and Description |
|---|
SimpleEventManager() |
SimpleEventManager(Graph graph)
Deprecated.
Use the no argument constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
listening()
Answer true iff there is at least one attached listener.
|
void |
notifyAddArray(Graph g,
Triple[] ts)
Method called when an array of triples has been added to the graph.
|
void |
notifyAddGraph(Graph g,
Graph added)
Method called when another graph
g has been used to
specify the triples added to our attached graph. |
void |
notifyAddIterator(Graph g,
Iterator<Triple> it)
Method called when an iterator [of triples] has been added to the graph
|
void |
notifyAddIterator(Graph g,
List<Triple> it)
Notify all attached listeners that an iterator [of triples] has been added to
the graph; its content has been captured in the list
triples. |
void |
notifyAddList(Graph g,
List<Triple> L)
Method called when a list [of triples] has been added to the graph.
|
void |
notifyAddTriple(Graph g,
Triple t)
Method called when a single triple has been added to the graph.
|
void |
notifyDeleteArray(Graph g,
Triple[] ts)
Method called when an array of triples has been deleted from the graph.
|
void |
notifyDeleteGraph(Graph g,
Graph removed)
Method to call when another graph has been used to specify the triples
deleted from our attached graph.
|
void |
notifyDeleteIterator(Graph g,
Iterator<Triple> it)
Method called when an iterator [of triples] has been deleted from the graph.
|
void |
notifyDeleteIterator(Graph g,
List<Triple> L)
Notify all attached listeners that an iterator [of triples] has been removed from
the graph; its content has been captured in the list
triples. |
void |
notifyDeleteList(Graph g,
List<Triple> L)
Method called when a list [of triples] has been deleted from the graph.
|
void |
notifyDeleteTriple(Graph g,
Triple t)
Method called when a single triple has been deleted from the graph.
|
void |
notifyEvent(Graph source,
Object event)
method to call for a general event.
|
static ExtendedIterator<Triple> |
notifyingRemove(Graph g,
Iterator<Triple> i)
Answer an iterator which wraps
i to ensure that if a
.remove() is executed on it, the graph g will be notified. |
GraphEventManager |
register(GraphListener listener)
Attached
listener to this manager; notification events
sent to the manager are sent to all registered listeners. |
GraphEventManager |
unregister(GraphListener listener)
If
listener is attached to this manager, detach it, otherwise
do nothing. |
@Deprecated public SimpleEventManager(Graph graph)
public SimpleEventManager()
public GraphEventManager register(GraphListener listener)
GraphEventManagerlistener to this manager; notification events
sent to the manager are sent to all registered listeners. A listener may
be registered multiple times, in which case it's called multiple times per
event.
A listener will be notified of an event if it is registered
before the Graph method call that initiated the event, and
was not unregistered before that method call returned.
In addition, a listener may (or may not) be notified
of an event if it is registered
before such a method returns or is unregistered after such
a method is called. For example, it may unregister itself
in response to the event.
If the registration and/or unregistration occur on different
threads the usual thread uncertainties in such statements apply.register in interface GraphEventManagerlistener - a listener to be fed eventspublic GraphEventManager unregister(GraphListener listener)
GraphEventManagerlistener is attached to this manager, detach it, otherwise
do nothing. Only a single registration is removed.unregister in interface GraphEventManagerlistener - the listener to be detached from the graphpublic boolean listening()
GraphEventManagerlistening in interface GraphEventManagerpublic void notifyAddTriple(Graph g, Triple t)
GraphListenernotifyAddTriple in interface GraphListenerpublic void notifyAddArray(Graph g, Triple[] ts)
GraphListenernotifyAddArray in interface GraphListenerpublic void notifyAddList(Graph g, List<Triple> L)
GraphListenernotifyAddList in interface GraphListenerpublic void notifyAddIterator(Graph g, List<Triple> it)
GraphEventManagertriples.notifyAddIterator in interface GraphEventManagerpublic void notifyAddIterator(Graph g, Iterator<Triple> it)
GraphListenernotifyAddIterator in interface GraphListenerpublic void notifyAddGraph(Graph g, Graph added)
GraphListenerg has been used to
specify the triples added to our attached graph.notifyAddGraph in interface GraphListenerg - the graph of triples addedpublic void notifyDeleteTriple(Graph g, Triple t)
GraphListenernotifyDeleteTriple in interface GraphListenerpublic void notifyDeleteArray(Graph g, Triple[] ts)
GraphListenernotifyDeleteArray in interface GraphListenerpublic void notifyDeleteList(Graph g, List<Triple> L)
GraphListenernotifyDeleteList in interface GraphListenerpublic void notifyDeleteIterator(Graph g, List<Triple> L)
GraphEventManagertriples.notifyDeleteIterator in interface GraphEventManagerpublic void notifyDeleteIterator(Graph g, Iterator<Triple> it)
GraphListenernotifyDeleteIterator in interface GraphListenerpublic void notifyDeleteGraph(Graph g, Graph removed)
GraphListenernotifyDeleteGraph in interface GraphListenerg - the graph of triples addedpublic void notifyEvent(Graph source, Object event)
GraphListenervalue is usually a GraphEvents.
Special attention is drawn to GraphEvents.removeAll
and events whose GraphEvents.getTitle() is "remove"
(see GraphEvents.remove(Node, Node, Node).
Unlike other notifications, the listener cannot tell which triples
have been modified, since they have already been deleted by the time
this event is sent, and the event does not include a record of them.notifyEvent in interface GraphListenerpublic static ExtendedIterator<Triple> notifyingRemove(Graph g, Iterator<Triple> i)
i to ensure that if a
.remove() is executed on it, the graph g will be notified.Licenced under the Apache License, Version 2.0