com.joanju.proparse
Class IntegerIndex<T>

java.lang.Object
  extended by com.joanju.proparse.IntegerIndex<T>

public class IntegerIndex<T>
extends java.lang.Object

Generic class for working with integer indexed data of type T. ie: You want to be able to lookup the value at integer index n, and you also want to be able to find the integer index of some data of type T. Integer indexes start from zero, as in Java array indexes.


Constructor Summary
IntegerIndex()
           
 
Method Summary
 int add(T val)
          Add the value if it's not already there.
 void clear()
           
 int getIndex(T val)
          Returns -1 if not found.
 T getValue(int index)
          Returns null if not found.
 java.util.ArrayList<T> getValues()
          Returns an array list in order from zero to number of indexes of all the values.
 boolean hasIndex(int index)
           
 boolean hasValue(T value)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerIndex

public IntegerIndex()
Method Detail

add

public int add(T val)
Add the value if it's not already there. Returns the new or existing index.


clear

public void clear()

getIndex

public int getIndex(T val)
Returns -1 if not found.


getValue

public T getValue(int index)
Returns null if not found.


getValues

public java.util.ArrayList<T> getValues()
Returns an array list in order from zero to number of indexes of all the values.


hasIndex

public boolean hasIndex(int index)

hasValue

public boolean hasValue(T value)

size

public int size()


Copyright © 2008 Joanju Software. All Rights Reserved.