com.facetmap.simple
Class SimpleResourceSpace

java.lang.Object
  extended by com.facetmap.simple.SimpleResourceSpace
All Implemented Interfaces:
ResourceSpace
Direct Known Subclasses:
ImplicitFacetResourceSpace

public class SimpleResourceSpace
extends java.lang.Object
implements ResourceSpace

A mutable and entirely RAM-based ResourceSpace.

To add Resources to this ResourceSpace, construct SimpleResource objects yourself, and then add them with SimpleResourceSpace.create() .


Field Summary
protected  FacetSpace facetSpace
           
protected  java.util.Map resources
          Maps Integer IDs to resources.
protected  int uidSequence
           
 
Constructor Summary
SimpleResourceSpace(FacetSpace facetSpace)
           
 
Method Summary
 void clear()
           
 SimpleResource create(SimpleResource r)
          This method is not fully spec'd yet.
 java.util.Iterator getAll()
          Returns all resources, unsorted.
 Resource getById(int id)
          Will return null if the passed id has no resource.
 FacetSpace getFacetSpace()
          Return the classification scheme by which these Resources are classified.
 int getResourceCount()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resources

protected java.util.Map resources
Maps Integer IDs to resources. This used to be a List, but that didn't intelligently accommodate the deletion of resources. Resource deletion is now a requirement for SqlFacetmap, so we're upgrading ResourceSpace implementations across the board.


uidSequence

protected int uidSequence

facetSpace

protected FacetSpace facetSpace
Constructor Detail

SimpleResourceSpace

public SimpleResourceSpace(FacetSpace facetSpace)
Method Detail

getFacetSpace

public FacetSpace getFacetSpace()
Description copied from interface: ResourceSpace
Return the classification scheme by which these Resources are classified.

Specified by:
getFacetSpace in interface ResourceSpace

clear

public void clear()

create

public SimpleResource create(SimpleResource r)
This method is not fully spec'd yet. It may index the SimpleResource object itself, or just copy the object's data and index that. In either case it will return the actual SimpleResource object it has indexed, from which you can read the ID.


getResourceCount

public int getResourceCount()
Specified by:
getResourceCount in interface ResourceSpace

getById

public Resource getById(int id)
Will return null if the passed id has no resource.

Specified by:
getById in interface ResourceSpace

getAll

public java.util.Iterator getAll()
Returns all resources, unsorted.

Specified by:
getAll in interface ResourceSpace