public class UnionMGraph extends AbstractMGraph implements LockableMGraph
Constructor and Description |
---|
UnionMGraph(TripleCollection... baseTripleCollections)
Constructs a UnionMGraph over the specified baseTripleCollections.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Triple e) |
void |
addGraphListener(GraphListener listener,
FilterTriple filter)
Adds the specified
GraphListener to the graph. |
void |
addGraphListener(GraphListener listener,
FilterTriple filter,
long delay)
Adds the specified
GraphListener to the graph. |
boolean |
equals(Object obj)
Returns true if
other represents the same mutable graph as
this instance, false otherwise. |
java.util.concurrent.locks.ReadWriteLock |
getLock()
The lock provided by this methods allows to create read- and write-locks
that span individual method calls.
|
int |
hashCode() |
Iterator<Triple> |
performFilter(NonLiteral subject,
UriRef predicate,
Resource object)
A subclass of
AbstractTripleCollection should override
this method instead of filter for graph event support to be
added. |
boolean |
remove(Object e) |
void |
removeGraphListener(GraphListener listener)
Removes the specified
GraphListener from the graph. |
int |
size() |
getGraph
contains, dispatchEvent, filter, iterator, performAdd, performRemove, removeAll
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
filter
public UnionMGraph(TripleCollection... baseTripleCollections)
baseTripleCollections
- the baseTripleCollectionspublic int size()
size
in interface Collection<Triple>
size
in class AbstractCollection<Triple>
public Iterator<Triple> performFilter(NonLiteral subject, UriRef predicate, Resource object)
AbstractTripleCollection
AbstractTripleCollection
should override
this method instead of filter
for graph event support to be
added. The Iterator returned by filter
will dispatch a
GraphEvent after invoking the remove method of the iterator returned by
this method.performFilter
in class AbstractTripleCollection
public boolean add(Triple e)
add
in interface Collection<Triple>
add
in class AbstractTripleCollection
public boolean remove(Object e)
remove
in interface Collection<Triple>
remove
in class AbstractTripleCollection
public boolean equals(Object obj)
MGraph
other
represents the same mutable graph as
this instance, false otherwise. It returns true if this == other or if it
is otherwise guaranteed that changes to one of the instances are
immediately reflected in the other.public int hashCode()
hashCode
in interface Collection<Triple>
hashCode
in class Object
public void addGraphListener(GraphListener listener, FilterTriple filter)
TripleCollection
GraphListener
to the graph. This listener
will be notified, when the graph is modified and the Triple
that was part of the modifiaction matched the specified
FilterTriple
. The notification will be passed without delay.
Same as addGraphListener(listener, filter, 0).
addGraphListener
in interface TripleCollection
addGraphListener
in class AbstractTripleCollection
listener
- The listener that will be notifiedfilter
- The triple filter with which triples are tested,
that were part of the modification.public void addGraphListener(GraphListener listener, FilterTriple filter, long delay)
TripleCollection
GraphListener
to the graph. This listener
will be notified, when the graph is modified and the Triple
that was part of the modifiaction matched the specified
FilterTriple
. The notification will be passed to the
listener after the specified delay time (in milli-seconds) has passed.
If more matching events occur during the delay period, then they are
passed all together at the end of the delay period. If the the listener
unregisters or the platform is stopped within the period then the already
occurred events may not be delivered.
All implementations support this method, immutable implementations will
typically provide an empty implementation, they shall not throw an
exception.
Implementation of which the triples change over time without add- and
remove-methods being called (e.g. implementation dynamically generating
their triples on invocation of the filer-method) may choose not to, or
only partially propagate their changes to the listener. They should
describe the behavior in the documentation of the class.
Implementations should keep weak references the listeners, so that the
listener can be garbage collected if its no longer referenced by another
object.
If delay is 0 notification will happen synchroneously.addGraphListener
in interface TripleCollection
addGraphListener
in class AbstractTripleCollection
listener
- The listener that will be notifiedfilter
- The triple filter with which triples are tested,
that were part of the modification.delay
- The time period afer which the listener will be notified in milliseconds.public void removeGraphListener(GraphListener listener)
TripleCollection
GraphListener
from the graph. This
listener will no longer be notified, when the graph is modified.removeGraphListener
in interface TripleCollection
removeGraphListener
in class AbstractTripleCollection
listener
- The listener to be removed.public java.util.concurrent.locks.ReadWriteLock getLock()
LockableMGraph
getLock
in interface LockableMGraph
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.