Utils
Class IndexedStringTable

java.lang.Object
  |
  +--Utils.IndexedStringTable

public class IndexedStringTable
extends java.lang.Object

Class that defines a container of Strings indexed by their creation rank. You can get a string by its number or the number by its String.

Author:
Olivier Sigaud

Field Summary
protected  java.util.Vector instances
          List of instances of the IndexedStringTable
protected  java.util.Hashtable myInstanceCounter
          List of instances of the IndexedStringTable
protected  java.util.Hashtable myListOfInstance
          List of instances of the IndexedStringTable
protected  int nbInstances
          Nb maximum of different Strings
 
Constructor Summary
IndexedStringTable()
           
 
Method Summary
private  void addInstance(java.lang.String str)
          Add a new String in the IndexedStringTable
 void addString(java.lang.String str, boolean val)
          Add a new String in the IndexedStringTable if its not already present.
private  boolean contains(java.lang.String str)
          Checks whether the String is already present within the instances
private  java.util.Hashtable getListOfInstances()
          Get the list of instances of the IndexedStringTable
 int getNbInstances()
          Get the nb of different Strings
 int getNbInstances(java.lang.String str)
          Get the nb of instances of one particular String
 int getNumberFromString(java.lang.String str)
          Get the number of one String
 java.lang.String getStringFromNumber(int index)
          Get one String from its number
static void main(java.lang.String[] args)
          A test routine
private  void setListOfInstances(java.util.Hashtable myLOI)
          Set the list of instances of the IndexedStringTable
 java.lang.String toString()
          Return a String describing the RelevantPointType instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

instances

protected java.util.Vector instances
List of instances of the IndexedStringTable


myListOfInstance

protected java.util.Hashtable myListOfInstance
List of instances of the IndexedStringTable


myInstanceCounter

protected java.util.Hashtable myInstanceCounter
List of instances of the IndexedStringTable


nbInstances

protected int nbInstances
Nb maximum of different Strings

Constructor Detail

IndexedStringTable

public IndexedStringTable()
Method Detail

setListOfInstances

private final void setListOfInstances(java.util.Hashtable myLOI)
Set the list of instances of the IndexedStringTable


getListOfInstances

private final java.util.Hashtable getListOfInstances()
Get the list of instances of the IndexedStringTable


contains

private boolean contains(java.lang.String str)
Checks whether the String is already present within the instances


addInstance

private final void addInstance(java.lang.String str)
Add a new String in the IndexedStringTable


getNbInstances

public final int getNbInstances()
Get the nb of different Strings


getNbInstances

public final int getNbInstances(java.lang.String str)
Get the nb of instances of one particular String


getStringFromNumber

public final java.lang.String getStringFromNumber(int index)
Get one String from its number

Returns:
the String if the number is correct, null otherwise

getNumberFromString

public final int getNumberFromString(java.lang.String str)
Get the number of one String

Returns:
the number of the String if it exists, -1 otherwise

addString

public void addString(java.lang.String str,
                      boolean val)
Add a new String in the IndexedStringTable if its not already present.

Parameters:
str - is the String to add
val - is true if the String should be counted as a new instance

toString

public java.lang.String toString()
Return a String describing the RelevantPointType instance

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
A test routine