The Meta-Environment API

nl.cwi.sen1.visbase.rstorecontainer
Class RStoreTracker

java.lang.Object
  extended by nl.cwi.sen1.visbase.rstorecontainer.RStoreTracker

public class RStoreTracker
extends java.lang.Object

Keeps track of the Rtuples associated to a RStore. Manages the identifiers.


Field Summary
private  java.util.Map<java.lang.String,java.lang.Integer> m_identifiedRTuplesMap
           
private  java.util.Map<java.lang.Integer,nl.cwi.sen1.relationstores.types.RTuple> m_loadedRTuplesMap
           
private static org.apache.commons.logging.Log m_log
           
private  nl.cwi.sen1.relationstores.types.RStore m_RStore
           
 
Constructor Summary
RStoreTracker(nl.cwi.sen1.relationstores.types.RStore rStore)
          Default Constructor.
 
Method Summary
static java.lang.String createIdentifierForRTuple(nl.cwi.sen1.relationstores.types.RTuple rTuple)
          Used to create a textual identifier for a RTuple
static boolean diffRtuples(nl.cwi.sen1.relationstores.types.RTuple existingRTuple, nl.cwi.sen1.relationstores.types.RTuple newRTuple)
          Checks if RTuples differ from eachother
 FactInfoList getFactInfoFromRStore()
          Creates a list of FactInfo objects containing the descriptive data from the found facts (using the RTuples in the RStore).
 nl.cwi.sen1.relationstores.types.RStore getRStore()
          Simple getter
 nl.cwi.sen1.relationstores.types.RTuple getRTuple(int id)
          Simple getter
protected  void registerNewRTuple(nl.cwi.sen1.relationstores.types.RTuple rTuple)
          Registers
 java.util.List<java.lang.Integer> update(nl.cwi.sen1.relationstores.types.RStore updatedRStore)
          Updates this tracker with new, deleted or updated facts
private  void updateRStore(nl.cwi.sen1.relationstores.types.RStore rStore)
          Updates this tracker with the given RStore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_log

private static final org.apache.commons.logging.Log m_log

m_RStore

private nl.cwi.sen1.relationstores.types.RStore m_RStore

m_loadedRTuplesMap

private java.util.Map<java.lang.Integer,nl.cwi.sen1.relationstores.types.RTuple> m_loadedRTuplesMap

m_identifiedRTuplesMap

private java.util.Map<java.lang.String,java.lang.Integer> m_identifiedRTuplesMap
Constructor Detail

RStoreTracker

public RStoreTracker(nl.cwi.sen1.relationstores.types.RStore rStore)
Default Constructor. Reads all RTuple (facts) from the given RStore

Parameters:
rStore -
Throws:
java.lang.RuntimeException - if rStore input is null
Method Detail

updateRStore

private void updateRStore(nl.cwi.sen1.relationstores.types.RStore rStore)
Updates this tracker with the given RStore

Parameters:
rStore -

update

public java.util.List<java.lang.Integer> update(nl.cwi.sen1.relationstores.types.RStore updatedRStore)
Updates this tracker with new, deleted or updated facts

Parameters:
updatedRStore -
Returns:
list of ID's of facts that where updated

getRStore

public nl.cwi.sen1.relationstores.types.RStore getRStore()
Simple getter

Returns:
the RStore object belonging to this Fact Tracker

getRTuple

public nl.cwi.sen1.relationstores.types.RTuple getRTuple(int id)
Simple getter

Parameters:
id -
Returns:
the RTuple belonging to the id (null if it doesn't exist)

getFactInfoFromRStore

public FactInfoList getFactInfoFromRStore()
Creates a list of FactInfo objects containing the descriptive data from the found facts (using the RTuples in the RStore).

Returns:
A FactInfoList object containing information about all the facts in the RStore.

diffRtuples

public static boolean diffRtuples(nl.cwi.sen1.relationstores.types.RTuple existingRTuple,
                                  nl.cwi.sen1.relationstores.types.RTuple newRTuple)
Checks if RTuples differ from eachother

Parameters:
existingRTuple -
newRTuple -
Returns:
true if RTuples are NOT equal
Throws:
java.lang.RuntimeException - if input is null

registerNewRTuple

protected void registerNewRTuple(nl.cwi.sen1.relationstores.types.RTuple rTuple)
Registers

Parameters:
rTuple -
Throws:
java.lang.RuntimeException - if rtuple is null

createIdentifierForRTuple

public static java.lang.String createIdentifierForRTuple(nl.cwi.sen1.relationstores.types.RTuple rTuple)
Used to create a textual identifier for a RTuple

Parameters:
rTuple -
Returns:
the identifier (name + "-" + rType)
Throws:
java.lang.RuntimeException - if rtuple is null

The Meta-Environment API