messif.buckets.storage
Class IntAddress<T>

java.lang.Object
  extended by messif.buckets.storage.IntAddress<T>
Type Parameters:
T - the class of objects that this address points to
All Implemented Interfaces:
java.io.Serializable, Address<T>

public final class IntAddress<T>
extends java.lang.Object
implements Address<T>

Implementation of Address for a storage that uses int addresses.

See Also:
Storage, Serialized Form

Constructor Summary
IntAddress(IntStorage<T> storage, int address)
          Creates a new instance of IntAddress on the specified int storage.
 
Method Summary
 int getAddress()
          Returns the associated int address into the storage.
 T read()
          Reads the object stored at this address from the associated storage.
 void remove()
          Removes the object stored at this address from the associated storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntAddress

public IntAddress(IntStorage<T> storage,
                  int address)
Creates a new instance of IntAddress on the specified int storage.

Parameters:
storage - the storage on which this address is valid
address - the int address in the storage this IntAddress points to
Method Detail

getAddress

public int getAddress()
Returns the associated int address into the storage.

Returns:
the associated int address into the storage

read

public T read()
       throws BucketStorageException
Description copied from interface: Address
Reads the object stored at this address from the associated storage.

Specified by:
read in interface Address<T>
Returns:
the object retrieved
Throws:
BucketStorageException - if there was an error reading the data

remove

public void remove()
            throws BucketStorageException,
                   java.lang.UnsupportedOperationException
Description copied from interface: Address
Removes the object stored at this address from the associated storage. This operation is optional and need not be implemented.

Specified by:
remove in interface Address<T>
Throws:
BucketStorageException - if there was an error deleting an object
java.lang.UnsupportedOperationException - if this storage does not support removal of objects