org.jrdf.parser.mem
Class ParserBlankNodeFactoryImpl

java.lang.Object
  extended by org.jrdf.parser.mem.ParserBlankNodeFactoryImpl
All Implemented Interfaces:
ParserBlankNodeFactory

public class ParserBlankNodeFactoryImpl
extends Object
implements ParserBlankNodeFactory

A factory for BlankNodes that uses a Map to keep track of the BlankNodes that have been allocated by createBlankNode(String) so that the same BlankNode object can be returned for a given nodeID.

Version:
$Revision: 1045 $
Author:
David Makepeace

Constructor Summary
ParserBlankNodeFactoryImpl(GraphElementFactory newValueFactory)
          Create a new blank node factory with the given value factory.
 
Method Summary
 void clear()
          Clears the internal Map.
 BlankNode createBlankNode()
          Always creates a new BlankNode object from the GraphElementFactory.
 BlankNode createBlankNode(String nodeID)
          Returns the BlankNode for a nodeID that has not been seen before or calls the GraphElementFactory to create a new BlankNode otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParserBlankNodeFactoryImpl

public ParserBlankNodeFactoryImpl(GraphElementFactory newValueFactory)
Create a new blank node factory with the given value factory.

Parameters:
newValueFactory - factory to create nodes with.
Method Detail

createBlankNode

public BlankNode createBlankNode()
                          throws GraphElementFactoryException
Always creates a new BlankNode object from the GraphElementFactory.

Specified by:
createBlankNode in interface ParserBlankNodeFactory
Returns:
the new BlankNode object.
Throws:
GraphElementFactoryException - if it fails to create a new blank node.

createBlankNode

public BlankNode createBlankNode(String nodeID)
                          throws GraphElementFactoryException
Returns the BlankNode for a nodeID that has not been seen before or calls the GraphElementFactory to create a new BlankNode otherwise.

Specified by:
createBlankNode in interface ParserBlankNodeFactory
Parameters:
nodeID - the node that labels the bNode in the file being parsed.
Returns:
the BlankNode object.
Throws:
GraphElementFactoryException - if it fails to create a new blank node.

clear

public void clear()
Clears the internal Map.

Specified by:
clear in interface ParserBlankNodeFactory