org.jrdf.graph.local.index.nodepool
Class NodePoolImpl

java.lang.Object
  extended by org.jrdf.graph.local.index.nodepool.NodePoolImpl
All Implemented Interfaces:
NodePool

public final class NodePoolImpl
extends Object
implements NodePool


Constructor Summary
NodePoolImpl(NodeTypePool newNodeTypePool, MapFactory newMapFactory)
           
 
Method Summary
 void clear()
          Removes all entries from the nodepool.
 ClosableIterator<BlankNode> getBlankNodeIterator()
           
 Long getNewNodeId()
          Returns a new node id.
 Node getNodeById(Long id)
          Package method to find a node in the node pool by its id.
 Long getNodeIdByString(String str)
          Package method to find a node id based on its string representation.
 List<Map<Long,String>> getNodePoolValues()
          Returns all the nodes in the node pool.
 ClosableIterator<URIReference> getURIReferenceIterator()
           
 void registerLiteral(Literal node)
           
 void registerLocalBlankNode(BlankNode node)
           
 void registerNodePoolValues(List<Map<Long,String>> values)
          Registers a large number of nodes in ones go.
 void registerURIReference(URIReference node)
           
 String removeNode(Long value)
          Remove a node from the node pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodePoolImpl

public NodePoolImpl(NodeTypePool newNodeTypePool,
                    MapFactory newMapFactory)
Method Detail

getNodeById

public Node getNodeById(Long id)
Description copied from interface: NodePool
Package method to find a node in the node pool by its id.

Specified by:
getNodeById in interface NodePool
Parameters:
id - The id of the node to search for.
Returns:
The node referred to by the id, null if not found.

getNodeIdByString

public Long getNodeIdByString(String str)
Description copied from interface: NodePool
Package method to find a node id based on its string representation.

Specified by:
getNodeIdByString in interface NodePool
Parameters:
str - The string representation of a node.
Returns:
The id of the node with the given string.

getNewNodeId

public Long getNewNodeId()
Description copied from interface: NodePool
Returns a new node id.

Specified by:
getNewNodeId in interface NodePool
Returns:
a new node id

getBlankNodeIterator

public ClosableIterator<BlankNode> getBlankNodeIterator()
Specified by:
getBlankNodeIterator in interface NodePool

getURIReferenceIterator

public ClosableIterator<URIReference> getURIReferenceIterator()
Specified by:
getURIReferenceIterator in interface NodePool

registerLocalBlankNode

public void registerLocalBlankNode(BlankNode node)
Specified by:
registerLocalBlankNode in interface NodePool

registerURIReference

public void registerURIReference(URIReference node)
Specified by:
registerURIReference in interface NodePool

registerLiteral

public void registerLiteral(Literal node)
Specified by:
registerLiteral in interface NodePool

registerNodePoolValues

public void registerNodePoolValues(List<Map<Long,String>> values)
Description copied from interface: NodePool
Registers a large number of nodes in ones go.

Specified by:
registerNodePoolValues in interface NodePool
Parameters:
values - the map contains a list of longs to serialized nodes (as strings).

removeNode

public String removeNode(Long value)
Description copied from interface: NodePool
Remove a node from the node pool.

Specified by:
removeNode in interface NodePool
Parameters:
value - the value to remove.
Returns:
null if not delete or the value.

getNodePoolValues

public List<Map<Long,String>> getNodePoolValues()
Description copied from interface: NodePool
Returns all the nodes in the node pool.

Specified by:
getNodePoolValues in interface NodePool
Returns:
The node pool.

clear

public void clear()
Description copied from interface: NodePool
Removes all entries from the nodepool.

Specified by:
clear in interface NodePool