edu.stanford.nlp.util
Interface IndexInterface<E>

Type Parameters:
E -
All Superinterfaces:
Serializable
All Known Implementing Classes:
Index

public interface IndexInterface<E>
extends Serializable

Minimalist interface for implementations of Index. This interface should allow Index and OAIndex to be used interchangeably in certain contexts. Originally extracted from util.Index on 3/13/2007

Author:
Daniel Cer

Field Summary
static int INVALID_ENTRY
           
 
Method Summary
 boolean contains(Object o)
           
 E get(int i)
          Gets the object whose index is the integer argument.
 int indexOf(E o)
          Returns the integer index of the Object in the Index or -1 if the Object is not already in the Index.
 int indexOf(E o, boolean add)
          Takes an Object and returns the integer index of the Object, perhaps adding it to the index first.
 int size()
          Returns the number of indexed objects.
 

Field Detail

INVALID_ENTRY

static final int INVALID_ENTRY
See Also:
Constant Field Values
Method Detail

size

int size()
Returns the number of indexed objects.

Returns:
the number of indexed objects.

get

E get(int i)
Gets the object whose index is the integer argument.

Parameters:
i - the integer index to be queried for the corresponding argument
Returns:
the object whose index is the integer argument.

indexOf

int indexOf(E o)
Returns the integer index of the Object in the Index or -1 if the Object is not already in the Index.

Parameters:
o - the Object whose index is desired.
Returns:
the index of the Object argument. Returns -1 if the object is not in the index.

indexOf

int indexOf(E o,
            boolean add)
Takes an Object and returns the integer index of the Object, perhaps adding it to the index first. Returns -1 if the Object is not in the Index. (Note: indexOf(x, true) is the direct replacement for the number(x) method in the old Numberer class.)

Parameters:
o - the Object whose index is desired.
add - Whether it is okay to add new items to the index
Returns:
the index of the Object argument. Returns -1 if the object is not in the index.

contains

boolean contains(Object o)


Stanford NLP Group