Rakesh API

org.rakeshv.utils
Interface DataStructure<T>

All Known Implementing Classes:
SimpleFIFO, SimpleLRU

public interface DataStructure<T>

An interface for all the datastructures implemented in this package.

Copyright 2004-2006 Rakesh Vidyadharan

Version:
$Id: DataStructure.java,v 1.6 2006/03/11 16:30:38 rakesh Exp $
Author:
Rakesh Vidyadharan 2004 September 1

Field Summary
static int DYNAMIC
          A constant to designate the DynamicCache implementation.
static int FIFO
          A constant to designate the FIFO implementation.
static int FIFO_IMPLEMENTATION
          Deprecated. Use FIFO
static int LRU
          A constant to designate the LRU implementation.
static int LRU_IMPLEMENTATION
          Deprecated. Use LRU
 
Method Summary
 void add(T object)
          Add the specified object to datastructure.
 void clear()
          Removes all the objects from the datastructure.
 T get()
          Return the current Object in the datastructure.
 T remove()
          Removes the current Object designated for removal from the datastructure.
 boolean remove(T object)
          Removes the specified object from the datastructure.
 int size()
          Returns the size of the datastructure.
 

Field Detail

FIFO

static final int FIFO
A constant to designate the FIFO implementation.

See Also:
Constant Field Values

FIFO_IMPLEMENTATION

@Deprecated
static final int FIFO_IMPLEMENTATION
Deprecated. Use FIFO
A constant to designate the FIFO implementation.

See Also:
Constant Field Values

LRU

static final int LRU
A constant to designate the LRU implementation.

See Also:
Constant Field Values

LRU_IMPLEMENTATION

@Deprecated
static final int LRU_IMPLEMENTATION
Deprecated. Use LRU
A constant to designate the LRU implementation.

See Also:
Constant Field Values

DYNAMIC

static final int DYNAMIC
A constant to designate the DynamicCache implementation.

See Also:
Constant Field Values
Method Detail

get

T get()
Return the current Object in the datastructure.

Returns:
The Object that is at the current location within the datastructure.

add

void add(T object)
Add the specified object to datastructure.

Note: This method does not perform any synchronisation, and hence is not thread-safe. Client's must perform their own synchronisation if they so desire.

Parameters:
object - The object to be added to the datastructure.
Throws:
java.lang.IllegalArgumentException - If a null value was specified for the object.

remove

T remove()
Removes the current Object designated for removal from the datastructure.

Returns:
The Object that was removed.

remove

boolean remove(T object)
Removes the specified object from the datastructure.

Note: This method does not perform any synchronisation, and hence is not thread-safe. Client's must perform their own synchronisation if they so desire.

Parameters:
object - The object that is to be removed from the datastructure.
Returns:
Returns true if the specified object was found and removed from the datastructure.

clear

void clear()
Removes all the objects from the datastructure.

Note: This method does not perform any synchronisation, and hence is not thread-safe. Client's must perform their own synchronisation if they so desire.


size

int size()
Returns the size of the datastructure. This may be total capacity of the datastructure, or the total number of valid objects stored in the datastructure.

Returns:
The size of the datastructure.

Rakesh API

Copyright © 2002-2005 - Rakesh Vidyadharan