org.topbraid.core.instancecount
Class InstanceCountProvider

java.lang.Object
  extended by org.topbraid.core.instancecount.InstanceCountProvider
All Implemented Interfaces:
IInstanceCountProvider

public class InstanceCountProvider
extends java.lang.Object
implements IInstanceCountProvider

The default implementation of IInstanceCountProvider.

Author:
Holger Knublauch

Constructor Summary
InstanceCountProvider()
           
 
Method Summary
 void addListener(IInstanceCountListener listener)
           
 void clear()
          Resets any cached values.
 void dispose()
          Should be called to enable this to remove itself as listener.
 java.lang.Integer getInstanceCount(com.hp.hpl.jena.graph.Graph graph, com.hp.hpl.jena.graph.Node classNode)
          Gets the number of known instances of a given class in a given Graph.
 void refresh(TripleChangeRecord[] records, boolean undone)
          Called by the IChangeEngine so that this can update the counts from the change records.
 void removeGraph(com.hp.hpl.jena.graph.Graph graph)
           
 void removeListener(IInstanceCountListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceCountProvider

public InstanceCountProvider()
Method Detail

addListener

public void addListener(IInstanceCountListener listener)
Specified by:
addListener in interface IInstanceCountProvider

clear

public void clear()
Description copied from interface: IInstanceCountProvider
Resets any cached values.

Specified by:
clear in interface IInstanceCountProvider

dispose

public void dispose()
Description copied from interface: IInstanceCountProvider
Should be called to enable this to remove itself as listener.

Specified by:
dispose in interface IInstanceCountProvider

getInstanceCount

public java.lang.Integer getInstanceCount(com.hp.hpl.jena.graph.Graph graph,
                                          com.hp.hpl.jena.graph.Node classNode)
Description copied from interface: IInstanceCountProvider
Gets the number of known instances of a given class in a given Graph.

Specified by:
getInstanceCount in interface IInstanceCountProvider
Parameters:
graph - the Graph to get the number of instances
classNode - the Node of the class
Returns:
the number of instances, null (unknown) or a negative number (e.g. -1 means "at least 1")

refresh

public void refresh(TripleChangeRecord[] records,
                    boolean undone)
Description copied from interface: IInstanceCountProvider
Called by the IChangeEngine so that this can update the counts from the change records.

Specified by:
refresh in interface IInstanceCountProvider
Parameters:
records - the records
undone - true if the records have been undone

removeGraph

public void removeGraph(com.hp.hpl.jena.graph.Graph graph)
Specified by:
removeGraph in interface IInstanceCountProvider

removeListener

public void removeListener(IInstanceCountListener listener)
Specified by:
removeListener in interface IInstanceCountProvider