Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.hp.hpl.jena.graph
Class NodeCache

    java.lang.Object
      com.hp.hpl.jena.graph.NodeCache

    public class NodeCache

extends java.lang.Object

A NodeCache caches nodes according to their labels, to reduce store turnover at the expense of some additional computation. The cache is represented as an array indexed by the reduced hashcode of the labels of the nodes it contains. Only the most recent node with any given reduced hash is kept. This tactic means that we don't need to have any explicit cache-clearing code in normal oepration.

Author:
  kers

Constructor Summary
`NodeCache()`

Method Summary
`void` | `clear()` Wipe the cache of all entries.
`Node` | `get(java.lang.Object label)` Answer the node with the given `label` in the cache, or `null` if there isn't one.
`void` | `put(java.lang.Object label, Node cached)` Record in the cache the designated Node, using the given label (which must be .equals() to the Node's label).
`int` | `size()`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NodeCache

    public NodeCache()

Method Detail

### clear

    public void clear()

  Wipe the cache of all entries.

### size

    public int size()

### get

    public Node get(java.lang.Object label)

  Answer the node with the given `label` in the cache, or `null` if there isn't one. Selects the slot in the cache by the reduced hash of the label, and confirms that the Node is the right one using .equals() on this label and that node's label.

### put

    public void put(java.lang.Object label,
                    Node cached)

  Record in the cache the designated Node, using the given label (which must be .equals() to the Node's label).

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP