org.apache.catalina.connector.warp
Class WarpTable

java.lang.Object
  |
  +--org.apache.catalina.connector.warp.WarpTable

public class WarpTable
extends java.lang.Object

Version:
CVS $Id: WarpTable.java,v 1.4 2001/01/24 23:10:52 pier Exp $
Author:
Pier Fumagalli, Copyright © 1999, 2000 The Apache Software Foundation.

Field Summary
protected  int[] ids
          The array of ids.
protected  java.lang.Object[] objects
          The array of objects.
protected  int size
          The number of elements present in our arrays.
 
Constructor Summary
WarpTable()
          Construct a new WarpTable instance with the default capacity.
WarpTable(int capacity)
          Construct a new WarpTable instance with a specified capacity.
 
Method Summary
 boolean add(java.lang.Object object, int id)
          Associate a Object with a specified ID.
 int count()
          Return the number of objects present in this table.
 java.lang.Object get(int id)
          Get the Object associated with a specific ID.
 java.lang.Object remove(int id)
          Remove the Object associated with a specified ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

protected int size
The number of elements present in our arrays.

objects

protected java.lang.Object[] objects
The array of objects.

ids

protected int[] ids
The array of ids.
Constructor Detail

WarpTable

public WarpTable()
Construct a new WarpTable instance with the default capacity.

WarpTable

public WarpTable(int capacity)
Construct a new WarpTable instance with a specified capacity.
Parameters:
capacity - The initial capacity of the table.
Method Detail

get

public java.lang.Object get(int id)
Get the Object associated with a specific ID.
Parameters:
id - The ID number.
Returns:
The Object or null if the ID was not associated with the specified ID.

add

public boolean add(java.lang.Object object,
                   int id)
            throws java.lang.NullPointerException
Associate a Object with a specified ID.
Parameters:
object - The Object to put in the table.
id - The ID number associated with the Object.
Returns:
If another Object is associated with this ID return false, otherwise return true.

remove

public java.lang.Object remove(int id)
Remove the Object associated with a specified ID.
Parameters:
id - The ID number of the Object to remove.
Returns:
The old Object associated with the specified ID or null.

count

public int count()
Return the number of objects present in this table.
Returns:
The number of objects present in this table.


Copyright ? 2000 Apache Software Foundation. All Rights Reserved.