org.apache.jackrabbit.core.state
Class ItemStateMap

java.lang.Object
  extended byorg.apache.jackrabbit.core.state.ItemStateMap
All Implemented Interfaces:
Dumpable, ItemStateStore
Direct Known Subclasses:
ItemStateReferenceMap

public class ItemStateMap
extends Object
implements ItemStateStore, Dumpable

A Map based ItemStateStore implementation.


Field Summary
protected  Map map
          the map backing this ItemStateStore implementation
 
Constructor Summary
  ItemStateMap()
          Creates a new HashMap-backed ItemStateStore implementation.
protected ItemStateMap(Map map)
          Protected constructor for specialized subclasses
 
Method Summary
 void clear()
          Removes all entries from this store.
 boolean contains(ItemId id)
          Returns true if this store contains an ItemState object with the specified id.
 void dump(PrintStream ps)
          Dumps the state of this instance in a human readable format for diagnostic purposes.
 ItemState get(ItemId id)
          Returns the ItemState object with the specified id if it is present or null if no entry exists with that id.
 boolean isEmpty()
          Returns true if this store contains no entries.
 Set keySet()
          Returns an unmodifiable set view of the keys (i.e. ItemId objects) contained in this store.
 void put(ItemState state)
          Stores the specified ItemState object in the store using its ItemId as the key.
 void remove(ItemId id)
          Removes the ItemState object with the specified id from this store if it is present.
 int size()
          Returns the number of entries in this store.
 Collection values()
          Returns an unmodifiable collection view of the values (i.e. ItemState objects) contained in this store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected final Map map
the map backing this ItemStateStore implementation

Constructor Detail

ItemStateMap

public ItemStateMap()
Creates a new HashMap-backed ItemStateStore implementation.


ItemStateMap

protected ItemStateMap(Map map)
Protected constructor for specialized subclasses

Parameters:
map - Map implementation to be used as backing store.
Method Detail

contains

public boolean contains(ItemId id)
Returns true if this store contains an ItemState object with the specified id.

Specified by:
contains in interface ItemStateStore
Parameters:
id - id of ItemState object whose presence should be tested.
Returns:
true if this store contains a corresponding entry, otherwise false.

get

public ItemState get(ItemId id)
Returns the ItemState object with the specified id if it is present or null if no entry exists with that id.

Specified by:
get in interface ItemStateStore
Parameters:
id - the id of the ItemState object to be returned.
Returns:
the ItemState object with the specified id or or null if no entry exists with that id

put

public void put(ItemState state)
Stores the specified ItemState object in the store using its ItemId as the key.

Specified by:
put in interface ItemStateStore
Parameters:
state - the ItemState object to store

remove

public void remove(ItemId id)
Removes the ItemState object with the specified id from this store if it is present.

Specified by:
remove in interface ItemStateStore
Parameters:
id - the id of the ItemState object which should be removed from this store.

clear

public void clear()
Removes all entries from this store.

Specified by:
clear in interface ItemStateStore

isEmpty

public boolean isEmpty()
Returns true if this store contains no entries.

Specified by:
isEmpty in interface ItemStateStore
Returns:
true if this store contains no entries.

size

public int size()
Returns the number of entries in this store.

Specified by:
size in interface ItemStateStore
Returns:
number of entries in this store.

keySet

public Set keySet()
Returns an unmodifiable set view of the keys (i.e. ItemId objects) contained in this store.

Specified by:
keySet in interface ItemStateStore
Returns:
a set view of the keys contained in this store.

values

public Collection values()
Returns an unmodifiable collection view of the values (i.e. ItemState objects) contained in this store.

Specified by:
values in interface ItemStateStore
Returns:
a collection view of the values contained in this store.

dump

public void dump(PrintStream ps)
Dumps the state of this instance in a human readable format for diagnostic purposes.

Specified by:
dump in interface Dumpable
Parameters:
ps - stream to dump state to


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.