votorola.a.register
Class Neighbourhood.CachedTable

java.lang.Object
  extended by Neighbourhood.Table
      extended by Neighbourhood.CachedTable
All Implemented Interfaces:
CacheControlledTable
Enclosing class:
Neighbourhood

@ThreadRestricted
static final class Neighbourhood.CachedTable
extends Neighbourhood.Table
implements CacheControlledTable

A cached neighbourhood table, with cache controls.


Field Summary
 
Fields inherited from class Neighbourhood.Table
isCachingAndCommitting
 
Constructor Summary
Neighbourhood.CachedTable(ReadyDirectory rD, Database d)
           
 
Method Summary
(package private)  void addVoter(ListNode node)
          Adds a voter to the table, updating the counts for the voter's neighbourhood, and its ancestors in the tree.
 void commitAll()
          Writes all rows that have uncommitted changes.
(package private)  Neighbourhood get(String path, boolean isLeaf)
          Retrieves a neighbourhood from this table.
(package private)  Neighbourhood getOrCreate(String path, boolean isLeaf)
          Retrieves a neighbourhood from this table; or, if none is stored, a default neighbourhood.
 void skimFlush()
          Commits and removes rows from the cache, reducing it to its skimmed (normal) size.
 
Methods inherited from class Neighbourhood.Table
create, database, drop, exists, getAncestorOfSingleChild, getChildren, put, readyDirectory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Neighbourhood.CachedTable

Neighbourhood.CachedTable(ReadyDirectory rD,
                          Database d)
                    throws IOException
Throws:
IOException
Method Detail

addVoter

void addVoter(ListNode node)
        throws SQLException
Adds a voter to the table, updating the counts for the voter's neighbourhood, and its ancestors in the tree.

Throws:
SQLException

get

Neighbourhood get(String path,
                  boolean isLeaf)
            throws SQLException
Description copied from class: Neighbourhood.Table
Retrieves a neighbourhood from this table.

Overrides:
get in class Neighbourhood.Table
Returns:
neighbourhood as stored in the table; or null, if none is stored
Throws:
SQLException

getOrCreate

Neighbourhood getOrCreate(String path,
                          boolean isLeaf)
                    throws SQLException
Description copied from class: Neighbourhood.Table
Retrieves a neighbourhood from this table; or, if none is stored, a default neighbourhood.

Overrides:
getOrCreate in class Neighbourhood.Table
Returns:
Neighbourhood as stored in the table; or, if none is stored, a NeighbourhoodIC with default values
Throws:
SQLException

commitAll

public void commitAll()
               throws SQLException
Description copied from interface: CacheControlledTable
Writes all rows that have uncommitted changes. Does not remove any row from the cache.

Specified by:
commitAll in interface CacheControlledTable
Throws:
SQLException

skimFlush

public void skimFlush()
               throws SQLException
Description copied from interface: CacheControlledTable
Commits and removes rows from the cache, reducing it to its skimmed (normal) size. If you are holding any row references of your own, you should ideally drop them; their data is apt to become stale if subsequently changed.

Specified by:
skimFlush in interface CacheControlledTable
Throws:
SQLException