org.jrdf.set
Interface SortedSetFactory

All Known Implementing Classes:
BdbSortedSetFactory, MemSortedSetFactory

public interface SortedSetFactory

An abstract from specifically knowing how to create Sorted Sets. This allows different implementations to be swapped more easily (for example from memory bound to disk based).


Method Summary
 void close()
          Close any resources used by the factory - possibly database connections, file handles and the like.
<T> SortedSet<T>
createSet(Class<T> clazz)
          Creates a sorted set for known type.
<T> SortedSet<T>
createSet(Class<T> clazz, Comparator<?> comparator)
          Creates a sorted set for a known type with a given comparator.
 

Method Detail

createSet

<T> SortedSet<T> createSet(Class<T> clazz)
Creates a sorted set for known type. The supported types depend on the implementation - current implementations support types such as Triple and PredicateNode. Otherwise, it will produce a sorted set without a comparator - which will need to be added later.

Parameters:
clazz - The type of set to create.
Returns:
A sorted set.

createSet

<T> SortedSet<T> createSet(Class<T> clazz,
                           Comparator<?> comparator)
Creates a sorted set for a known type with a given comparator. This allows non-supported types to be added. This is optional and may not be supported by all implementations.

Parameters:
clazz - The type of set to create.
comparator - The comparator to use to determine the sort order.
Returns:
A sorted set.

close

void close()
Close any resources used by the factory - possibly database connections, file handles and the like. It is expected that a factory used that is not close may cause resource leaks.