org.space4j.implementation
Class SimpleSpace

java.lang.Object
  extended by org.space4j.implementation.SimpleSpace
All Implemented Interfaces:
java.io.Serializable, Space

public class SimpleSpace
extends java.lang.Object
implements Space

A trivial implementation of Space, in other words, our space just use a Map.

See Also:
Serialized Form

Constructor Summary
SimpleSpace()
          Initializes the SimpleSpace.
SimpleSpace(java.util.Map<java.lang.Object,java.lang.Object> map)
          Initializes the SimpleSpace with a Map.
 
Method Summary
 boolean check(java.lang.Object key)
          Checks whehter an object exists with the following key.
 java.lang.Object get(java.lang.Object key)
          Gets the Object stored in this Space with this key.
 IndexManager getIndexManager()
          Returns the IndexManager in this space.
 java.util.Iterator<java.lang.Object> getIterator(java.lang.Object key)
          Returns an iterator of the underlying collection or map object.
 java.util.Iterator<java.lang.Object> getKeyIterator(java.lang.Object key)
          Returns an iterator of the keys of the underlying map object.
 void put(java.lang.Object key, java.lang.Object obj)
          Puts an Object in this Space with this key.
 boolean remove(java.lang.Object key)
          Removes an Object from this Space with this key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSpace

public SimpleSpace()
Initializes the SimpleSpace.


SimpleSpace

public SimpleSpace(java.util.Map<java.lang.Object,java.lang.Object> map)
Initializes the SimpleSpace with a Map.

Method Detail

get

public java.lang.Object get(java.lang.Object key)
Description copied from interface: Space
Gets the Object stored in this Space with this key.

Specified by:
get in interface Space
Parameters:
key - The key to retrieve the Object from the Space.
Returns:
The object stored in the Space with this key or null with there is no such object.

put

public void put(java.lang.Object key,
                java.lang.Object obj)
Description copied from interface: Space
Puts an Object in this Space with this key. If and Object already exists with this key, the object is replaced by the new one.

Specified by:
put in interface Space
Parameters:
key - The key to store the Object
obj - The object to store

remove

public boolean remove(java.lang.Object key)
Description copied from interface: Space
Removes an Object from this Space with this key.

Specified by:
remove in interface Space
Returns:
true if object existed and was removed

getIterator

public java.util.Iterator<java.lang.Object> getIterator(java.lang.Object key)
Description copied from interface: Space
Returns an iterator of the underlying collection or map object.

Specified by:
getIterator in interface Space
Parameters:
key - The key to retrieve the Object from the Space.
Returns:
A safe iterator of the data structure.

getKeyIterator

public java.util.Iterator<java.lang.Object> getKeyIterator(java.lang.Object key)
Description copied from interface: Space
Returns an iterator of the keys of the underlying map object.

Specified by:
getKeyIterator in interface Space
Parameters:
key - The key to retrieve the Object from the Space.
Returns:
A safe iterator of the keys of the Map.

check

public boolean check(java.lang.Object key)
Description copied from interface: Space
Checks whehter an object exists with the following key.

Specified by:
check in interface Space
Parameters:
key - The key to check
Returns:
true if there is an object

getIndexManager

public IndexManager getIndexManager()
Description copied from interface: Space
Returns the IndexManager in this space.

Specified by:
getIndexManager in interface Space
Returns:
The IndexManager in this space.


Copyright © 2005 Space4J Team. All Rights Reserved.