org.openrdf.sail.memory.model
Class MemValueFactory

java.lang.Object
  extended by org.openrdf.model.impl.LiteralFactoryImpl
      extended by org.openrdf.model.impl.ValueFactoryImpl
          extended by org.openrdf.sail.memory.model.MemValueFactory
All Implemented Interfaces:
BNodeFactory, LiteralFactory, URIFactory, ValueFactory

public class MemValueFactory
extends ValueFactoryImpl

A factory for MemValue objects that keeps track of created objects to prevent the creation of duplicate objects, minimizing memory usage as a result.

Author:
Arjohn Kampman, David Huynh, James Leigh

Constructor Summary
MemValueFactory(MemBNodeFactory bf, MemURIFactory uf, MemLiteralFactory lf)
           
 
Method Summary
 MemBNode createMemBNode(BNode bnode)
          See createMemValue() for description.
 MemLiteral createMemLiteral(Literal literal)
          See createMemValue() for description.
 MemResource createMemResource(Resource resource)
          See createMemValue() for description.
 MemURI createMemURI(URI uri)
          See createMemValue() for description.
 MemValue createMemValue(Value value)
          Creates a MemValue for the supplied Value.
 MemBNodeFactory getBNodeFactory()
           
 MemLiteralFactory getLiteralFactory()
           
 MemBNode getMemBNode(BNode bnode)
          See getMemValue() for description.
 Set<MemBNode> getMemBNodes()
          Gets all bnodes that are managed by this value factory.
 MemLiteral getMemLiteral(Literal literal)
          See getMemValue() for description.
 Set<MemLiteral> getMemLiterals()
          Gets all literals that are managed by this value factory.
 MemResource getMemResource(Resource resource)
          See getMemValue() for description.
 MemURI getMemURI(URI uri)
          See getMemValue() for description.
 Set<MemURI> getMemURIs()
          Gets all URIs that are managed by this value factory.
 MemValue getMemValue(Value value)
          Returns a previously created MemValue that is equal to the supplied value, or null if the supplied value is a new value or is equal to null.
 MemURIFactory getURIFactory()
           
 
Methods inherited from class org.openrdf.model.impl.ValueFactoryImpl
createBNode, createBNode, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createStatement, createStatement, createURI, createURI, getInstance
 
Methods inherited from class org.openrdf.model.impl.LiteralFactoryImpl
createFPLiteral, createIntegerLiteral, createLiteral, createLiteral, createLiteral, createNumericLiteral
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openrdf.model.LiteralFactory
createLiteral, createLiteral, createLiteral
 

Constructor Detail

MemValueFactory

public MemValueFactory(MemBNodeFactory bf,
                       MemURIFactory uf,
                       MemLiteralFactory lf)
Method Detail

getBNodeFactory

public MemBNodeFactory getBNodeFactory()
Overrides:
getBNodeFactory in class ValueFactoryImpl

getLiteralFactory

public MemLiteralFactory getLiteralFactory()
Overrides:
getLiteralFactory in class ValueFactoryImpl

getURIFactory

public MemURIFactory getURIFactory()
Overrides:
getURIFactory in class ValueFactoryImpl

getMemValue

public MemValue getMemValue(Value value)
Returns a previously created MemValue that is equal to the supplied value, or null if the supplied value is a new value or is equal to null.

Parameters:
value - The MemValue equivalent of the supplied value, or null.
Returns:
A previously created MemValue that is equal to value, or null if no such value exists or if value is equal to null.

getMemResource

public MemResource getMemResource(Resource resource)
See getMemValue() for description.


getMemURI

public MemURI getMemURI(URI uri)
See getMemValue() for description.


getMemBNode

public MemBNode getMemBNode(BNode bnode)
See getMemValue() for description.


getMemLiteral

public MemLiteral getMemLiteral(Literal literal)
See getMemValue() for description.


getMemURIs

public Set<MemURI> getMemURIs()
Gets all URIs that are managed by this value factory.

Warning: This method is not synchronized. To iterate over the returned set in a thread-safe way, this method should only be called while synchronizing on this object.

Returns:
An unmodifiable Set of MemURI objects.

getMemBNodes

public Set<MemBNode> getMemBNodes()
Gets all bnodes that are managed by this value factory.

Warning: This method is not synchronized. To iterate over the returned set in a thread-safe way, this method should only be called while synchronizing on this object.

Returns:
An unmodifiable Set of MemBNode objects.

getMemLiterals

public Set<MemLiteral> getMemLiterals()
Gets all literals that are managed by this value factory.

Warning: This method is not synchronized. To iterate over the returned set in a thread-safe way, this method should only be called while synchronizing on this object.

Returns:
An unmodifiable Set of MemURI objects.

createMemValue

public MemValue createMemValue(Value value)
Creates a MemValue for the supplied Value. The supplied value should not already have an associated MemValue. The created MemValue is returned.

Parameters:
value - A Resource or Literal.
Returns:
The created MemValue.

createMemResource

public MemResource createMemResource(Resource resource)
See createMemValue() for description.


createMemURI

public MemURI createMemURI(URI uri)
See createMemValue() for description.


createMemBNode

public MemBNode createMemBNode(BNode bnode)
See createMemValue() for description.


createMemLiteral

public MemLiteral createMemLiteral(Literal literal)
See createMemValue() for description.



Copyright © 2001-2009 Aduna. All Rights Reserved.