com.isti.util
Class FifoHashtable

java.lang.Object
  extended bycom.isti.util.FifoHashtable
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map

public class FifoHashtable
extends java.lang.Object
implements java.lang.Cloneable, java.util.Map

Class FifoHashtable is a version of the HashTable class which can return its elements in the same order as they were entered. All methods are synchronized.


Nested Class Summary
static class FifoHashtable.MapEntry
           
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
  FifoHashtable()
          Constructs a new, empty hashtable with a default capacity and load factor, which is 0.75.
protected FifoHashtable(java.util.HashMap hashMapObj)
          Constructs with the specified hashtable.
  FifoHashtable(int initialCapacity)
          Constructs a new, empty hashtable with the specified initial capacity and the default load factor, which is 0.75.
  FifoHashtable(int initialCapacity, float loadFactor)
          Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.
 
Method Summary
 void clear()
          Clears this hashtable so that it contains no keys.
 java.lang.Object clone()
          Creates a shallow copy of this hashtable.
 boolean contains(java.lang.Object value)
          Tests if some key maps into the specified value in this hashtable.
 boolean containsKey(java.lang.Object key)
          Tests if the specified object is a key in this hashtable.
 boolean containsValue(java.lang.Object value)
          Returns true if this Hashtable maps one or more keys to this value.
 java.lang.Object elementAt(int idx)
          Returns the object at the specified index in the FifoHashtable.
 java.util.Enumeration elements()
          Returns an enumeration of the values in the hashtable.
 java.util.Set entrySet()
          Returns a read-only set view of the mappings contained in this map.
 boolean equals(java.lang.Object o)
          Compares the specified Object with this Map for equality, as per the definition in the Map interface.
 java.lang.Object get(java.lang.Object key)
          Returns the value to which this hashtable maps the specified key.
 java.util.HashMap getHashMap()
          Returns a new HashMap object containing the keys and values in the hashtable.
 java.util.Vector getKeysVector()
          Returns a new Vector containing the keys in the hashtable.
 java.util.Vector getKeysVector(int fromIndex, int toIndex)
          Returns a new Vector containing a sub-list of the keys in the hashtable.
 java.util.Vector getValuesVector()
          Returns a new Vector containing the values in the hashtable.
 java.util.Vector getValuesVector(int fromIndex, int toIndex)
          Returns a new Vector containing a sub-list of the values in the hashtable.
 int hashCode()
          Gets the hash code value for this Map as per the definition in the Map interface.
 int indexOf(java.lang.Object obj)
          Searches for the first occurrence of the given argument, testing for equality using the equals method.
 int indexOf(java.lang.Object obj, int idx)
          Searches for the first occurrence of the given argument, beginning the search at 'idx', testing for equality using the equals method.
 int indexOfKey(java.lang.Object obj)
          Searches for the first occurrence of the given key, testing for equality using the equals method.
 int indexOfKey(java.lang.Object obj, int idx)
          Searches for the first occurrence of the given key, beginning the search at 'idx', testing for equality using the equals method.
 boolean isEmpty()
          Determines true if this hashtable contains no key-value mappings.
 java.lang.Object keyAt(int idx)
          Returns the key at the specified index in the FifoHashtable.
 java.util.Enumeration keys()
          Returns an enumeration of the keys in the table.
 java.util.Set keySet()
          Returns a read-only set view of the keys contained in this map.
 int lastIndexOf(java.lang.Object obj)
          Searches for the last occurrence of the given argument, testing for equality using the equals method.
 int lastIndexOf(java.lang.Object obj, int idx)
          Searches for the last occurrence of the given argument, beginning the search at 'idx', testing for equality using the equals method.
 int lastIndexOfKey(java.lang.Object obj)
          Searches for the last occurrence of the given key, testing for equality using the equals method.
 int lastIndexOfKey(java.lang.Object obj, int idx)
          Searches for the last occurrence of the given key, beginning the search at 'idx', testing for equality using the equals method.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Associates the specified value with the specified key in this hashtable.
 void putAll(java.util.Map mapObj)
          Copies all of the mappings from the specified map to this one.
 java.lang.Object putSort(java.lang.Object key, java.lang.Object value, boolean sortDirFlag)
          Adds a key/value pair to the hashtable, placing it in sorted order according to the key.
 java.lang.Object putSort(java.lang.Object key, java.lang.Object value, boolean sortDirFlag, java.util.Comparator compObj)
          Adds a key/value pair to the hashtable, placing it in sorted order according to the key.
 java.lang.Object putSort(java.lang.Object key, java.lang.Object value, boolean sortDirFlag, int sortType)
          Adds a key/value pair to the hashtable, placing it in sorted order according to the key.
 void putSortAll(java.util.Map mapObj, boolean sortDirFlag)
          Copies all of the mappings from the specified map to this one, placing them in sorted order according to the keys.
 void putSortAll(java.util.Map mapObj, boolean sortDirFlag, java.util.Comparator compObj)
          Copies all of the mappings from the specified map to this one, placing them in sorted order according to the keys.
 void putSortAll(java.util.Map mapObj, boolean sortDirFlag, int sortType)
          Copies all of the mappings from the specified map to this one, placing them in sorted order according to the keys.
 java.lang.Object putSortByValue(java.lang.Object key, java.lang.Object value, boolean sortDirFlag)
          Adds a key/value pair to the hashtable, placing it in sorted order according to the value.
 java.lang.Object putSortByValue(java.lang.Object key, java.lang.Object value, boolean sortDirFlag, java.util.Comparator compObj)
          Adds a key/value pair to the hashtable, placing it in sorted order according to the value.
 java.lang.Object putSortByValue(java.lang.Object key, java.lang.Object value, boolean sortDirFlag, int sortType)
          Adds a key/value pair to the hashtable, placing it in sorted order according to the value.
 void putSortByValueAll(java.util.Map mapObj, boolean sortDirFlag)
          Copies all of the mappings from the specified map to this one, placing them in sorted order according to the values.
 void putSortByValueAll(java.util.Map mapObj, boolean sortDirFlag, java.util.Comparator compObj)
          Copies all of the mappings from the specified map to this one, placing them in sorted order according to the values.
 void putSortByValueAll(java.util.Map mapObj, boolean sortDirFlag, int sortType)
          Copies all of the mappings from the specified map to this one, placing them in sorted order according to the values.
static FifoHashtable quotedStringsToTable(FifoHashtable inTable, java.lang.String str)
          Returns a table of substring pairs parsed from the given string.
static FifoHashtable quotedStringsToTable(FifoHashtable inTable, java.lang.String str, char sepChar)
          Returns a table of substring pairs parsed from the given string.
static FifoHashtable quotedStringsToTable(FifoHashtable inTable, java.lang.String str, char sepChar, boolean strictFlag)
          Returns a table of substring pairs parsed from the given string.
static FifoHashtable quotedStringsToTable(java.lang.String str)
          Returns a table of substring pairs parsed from the given string.
static FifoHashtable quotedStringsToTable(java.lang.String str, char sepChar)
          Returns a table of substring pairs parsed from the given string.
static FifoHashtable quotedStringsToTable(java.lang.String str, char sepChar, boolean strictFlag)
          Returns a table of substring pairs parsed from the given string.
 java.lang.Object remove(java.lang.Object key)
          Removes the mapping for this key from this hashtable if present.
 boolean removeAllKeys(java.util.Collection collObj)
          Removes from this table all of the elements that have keys matching items that are contained in the given Collection.
 boolean removeAllValues(java.util.Collection collObj)
          Removes from this table all of the elements that have values matching items that are contained in the given Collection.
 java.lang.Object removeElementAt(int idx)
          Removes the entry at the specified index of this FifoHashtable.
 java.lang.Object removeValue(java.lang.Object obj)
          Removes the value and its key from this hashtable if present.
 void setElementAt(java.lang.Object obj, int idx)
          Sets the value object at the specified index of this FifoHashtable to be the specified object.
 int size()
          Gets the number of key-value mappings in this hashtable.
 boolean swapEntries(java.lang.Object key1Obj, java.lang.Object key2Obj)
          Swaps the table entries for the given key objects.
 java.lang.String toQuotedStrings()
          Returns a String of substrings gathered from this hash table.
 java.lang.String toQuotedStrings(char sepChar, boolean quoteCharsFlag)
          Returns a String of substrings gathered from this hash table.
 java.lang.String toQuotedStrings(char sepChar, boolean quoteCharsFlag, boolean dontQuoteKeysFlag)
          Returns a String of substrings gathered from this hash table.
 java.lang.String toQuotedStrings(char sepChar, boolean quoteCharsFlag, boolean dontQuoteKeysFlag, boolean dontQuoteValuesFlag)
          Returns a String of substrings gathered from this hash table.
 java.lang.String toQuotedStrings(java.lang.String sepStr, boolean quoteCharsFlag)
          Returns a String of substrings gathered from this hash table.
 java.lang.String toQuotedStrings(java.lang.String sepStr, boolean quoteCharsFlag, boolean dontQuoteKeysFlag)
          Returns a String of substrings gathered from this hash table.
 java.lang.String toQuotedStrings(java.lang.String sepStr, boolean quoteCharsFlag, boolean dontQuoteKeysFlag, boolean dontQuoteValuesFlag)
          Returns a String of substrings gathered from this hash table.
 java.lang.String toString()
          Returns a string representation of the hashtable in the form of a set of entries, enclosed in braces and separated by the ASCII characters "" (comma and space).
 java.util.Collection values()
          Returns a read-only collection view of the values contained in this map.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FifoHashtable

public FifoHashtable(int initialCapacity,
                     float loadFactor)
Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.

Parameters:
initialCapacity - the initial capacity of the hashtable.
loadFactor - the load factor of the hashtable.
Throws:
java.lang.IllegalArgumentException - if the initial capacity is less than zero, or if the load factor is nonpositive.

FifoHashtable

public FifoHashtable(int initialCapacity)
Constructs a new, empty hashtable with the specified initial capacity and the default load factor, which is 0.75.

Parameters:
initialCapacity - the initial capacity of the hashtable.
Throws:
java.lang.IllegalArgumentException - if the initial capacity is less than zero.

FifoHashtable

public FifoHashtable()
Constructs a new, empty hashtable with a default capacity and load factor, which is 0.75.


FifoHashtable

protected FifoHashtable(java.util.HashMap hashMapObj)
Constructs with the specified hashtable.

Parameters:
hashMapObj - hash map object
Method Detail

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Associates the specified value with the specified key in this hashtable. If the hashtable previously contained a mapping for this key, the old value is replaced.

Specified by:
put in interface java.util.Map
Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the HashMap previously associated null with the specified key.

putAll

public void putAll(java.util.Map mapObj)
Copies all of the mappings from the specified map to this one. These mappings replace any mappings that this map had for any of the keys currently in the specified Map.

Specified by:
putAll in interface java.util.Map
Parameters:
mapObj - mappings to be stored in this map.

putSort

public java.lang.Object putSort(java.lang.Object key,
                                java.lang.Object value,
                                boolean sortDirFlag)
Adds a key/value pair to the hashtable, placing it in sorted order according to the key. The key should implement the Comparable interface. Associates the specified value with the specified key in this hashtable. If the table previously contained a mapping for this key, the old value is replaced.

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
sortDirFlag - true for ascending sort order, false for descending.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the HashMap previously associated null with the specified key.

putSort

public java.lang.Object putSort(java.lang.Object key,
                                java.lang.Object value,
                                boolean sortDirFlag,
                                int sortType)
Adds a key/value pair to the hashtable, placing it in sorted order according to the key. The key should implement the Comparable interface. Associates the specified value with the specified key in this hashtable. If the table previously contained a mapping for this key, the old value is replaced.

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
sortDirFlag - true for ascending sort order, false for descending.
sortType - the sort type.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the HashMap previously associated null with the specified key.

putSort

public java.lang.Object putSort(java.lang.Object key,
                                java.lang.Object value,
                                boolean sortDirFlag,
                                java.util.Comparator compObj)
Adds a key/value pair to the hashtable, placing it in sorted order according to the key. The key should implement the Comparable interface. Associates the specified value with the specified key in this hashtable. If the table previously contained a mapping for this key, the old value is replaced.

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
sortDirFlag - true for ascending sort order, false for descending.
compObj - the comparator to use for sorting the 'key' objects, or null to use the "natural" sort order.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the HashMap previously associated null with the specified key.

putSortAll

public void putSortAll(java.util.Map mapObj,
                       boolean sortDirFlag)
Copies all of the mappings from the specified map to this one, placing them in sorted order according to the keys. The keys should implement the Comparable interface. These mappings replace any mappings that this map had for any of the keys currently in the specified Map.

Parameters:
mapObj - mappings to be stored in this map.
sortDirFlag - true for ascending sort order, false for descending.

putSortAll

public void putSortAll(java.util.Map mapObj,
                       boolean sortDirFlag,
                       int sortType)
Copies all of the mappings from the specified map to this one, placing them in sorted order according to the keys. The keys should implement the Comparable interface. These mappings replace any mappings that this map had for any of the keys currently in the specified Map.

Parameters:
mapObj - mappings to be stored in this map.
sortDirFlag - true for ascending sort order, false for descending.
sortType - the sort type.

putSortAll

public void putSortAll(java.util.Map mapObj,
                       boolean sortDirFlag,
                       java.util.Comparator compObj)
Copies all of the mappings from the specified map to this one, placing them in sorted order according to the keys. The keys should implement the Comparable interface. These mappings replace any mappings that this map had for any of the keys currently in the specified Map.

Parameters:
mapObj - mappings to be stored in this map.
sortDirFlag - true for ascending sort order, false for descending.
compObj - the comparator to use for sorting the 'key' objects, or null to use the "natural" sort order.

putSortByValue

public java.lang.Object putSortByValue(java.lang.Object key,
                                       java.lang.Object value,
                                       boolean sortDirFlag)
Adds a key/value pair to the hashtable, placing it in sorted order according to the value. The value should implement the Comparable interface. Associates the specified value with the specified key in this hashtable. If the table previously contained a mapping for this key, the old value is deleted and the new value is placed in proper sort order.

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
sortDirFlag - true for ascending sort order, false for descending.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the HashMap previously associated null with the specified key.

putSortByValue

public java.lang.Object putSortByValue(java.lang.Object key,
                                       java.lang.Object value,
                                       boolean sortDirFlag,
                                       int sortType)
Adds a key/value pair to the hashtable, placing it in sorted order according to the value. The value should implement the Comparable interface. Associates the specified value with the specified key in this hashtable. If the table previously contained a mapping for this key, the old value is deleted and the new value is placed in proper sort order.

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
sortDirFlag - true for ascending sort order, false for descending.
sortType - the sort type.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the HashMap previously associated null with the specified key.

putSortByValue

public java.lang.Object putSortByValue(java.lang.Object key,
                                       java.lang.Object value,
                                       boolean sortDirFlag,
                                       java.util.Comparator compObj)
Adds a key/value pair to the hashtable, placing it in sorted order according to the value. The value should implement the Comparable interface. Associates the specified value with the specified key in this hashtable. If the table previously contained a mapping for this key, the old value is deleted and the new value is placed in proper sort order.

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
sortDirFlag - true for ascending sort order, false for descending.
compObj - the comparator to use for sorting the 'value' objects, or null to use the "natural" sort order.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the HashMap previously associated null with the specified key.

putSortByValueAll

public void putSortByValueAll(java.util.Map mapObj,
                              boolean sortDirFlag)
Copies all of the mappings from the specified map to this one, placing them in sorted order according to the values. The values should implement the Comparable interface. These mappings replace any mappings that this map had for any of the keys currently in the specified Map.

Parameters:
mapObj - mappings to be stored in this map.
sortDirFlag - true for ascending sort order, false for descending.

putSortByValueAll

public void putSortByValueAll(java.util.Map mapObj,
                              boolean sortDirFlag,
                              int sortType)
Copies all of the mappings from the specified map to this one, placing them in sorted order according to the values. The values should implement the Comparable interface. These mappings replace any mappings that this map had for any of the keys currently in the specified Map.

Parameters:
mapObj - mappings to be stored in this map.
sortDirFlag - true for ascending sort order, false for descending.
sortType - the sort type.

putSortByValueAll

public void putSortByValueAll(java.util.Map mapObj,
                              boolean sortDirFlag,
                              java.util.Comparator compObj)
Copies all of the mappings from the specified map to this one, placing them in sorted order according to the values. The values should implement the Comparable interface. These mappings replace any mappings that this map had for any of the keys currently in the specified Map.

Parameters:
mapObj - mappings to be stored in this map.
sortDirFlag - true for ascending sort order, false for descending.
compObj - the comparator to use for sorting the 'value' objects, or null to use the "natural" sort order.

get

public java.lang.Object get(java.lang.Object key)
Returns the value to which this hashtable maps the specified key. Returns null if the hashtable contains no mapping for this key. A return value of null does not necessarily indicate that the hashtable contains no mapping for the key; it's also possible that the hashtable explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

Specified by:
get in interface java.util.Map
Parameters:
key - key whose associated value is to be returned.
Returns:
the value to which this hashtable maps the specified key.

remove

public java.lang.Object remove(java.lang.Object key)
Removes the mapping for this key from this hashtable if present.

Specified by:
remove in interface java.util.Map
Parameters:
key - key whose mapping is to be removed from the hashtable.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the hashtable previously associated null with the specified key.

removeValue

public java.lang.Object removeValue(java.lang.Object obj)
Removes the value and its key from this hashtable if present.

Parameters:
obj - value to be removed from the hashtable.
Returns:
previous key associated with specified value, or null if the value was not found. A null return can also indicate that the hashtable previously associated null with the specified value.

removeAllKeys

public boolean removeAllKeys(java.util.Collection collObj)
Removes from this table all of the elements that have keys matching items that are contained in the given Collection.

Parameters:
collObj - the Collection of key-items to be removed.
Returns:
true if this table changed as a result of the call.

removeAllValues

public boolean removeAllValues(java.util.Collection collObj)
Removes from this table all of the elements that have values matching items that are contained in the given Collection.

Parameters:
collObj - the Collection of value-items to be removed.
Returns:
true if this table changed as a result of the call.

containsKey

public boolean containsKey(java.lang.Object key)
Tests if the specified object is a key in this hashtable.

Specified by:
containsKey in interface java.util.Map
Parameters:
key - possible key.
Returns:
true if and only if the specified object is a key in this hashtable, as determined by the equals method; false otherwise.

containsValue

public boolean containsValue(java.lang.Object value)
Returns true if this Hashtable maps one or more keys to this value. This operation is more expensive than the 'containsKey()' method. Note that this method is identical in functionality to 'contains()' (which predates the Map interface).

Specified by:
containsValue in interface java.util.Map
Parameters:
value - value whose presence in this map is to be tested.
Returns:
true if this Hashtable maps one or more keys to this value.

contains

public boolean contains(java.lang.Object value)
Tests if some key maps into the specified value in this hashtable. This operation is more expensive than the 'containsKey()' method. Note that this method is identical in functionality to 'containsValue()' (which is part of the Map interface in the collections framework).

Parameters:
value - value whose presence in this map is to be tested.
Returns:
true if and only if some key maps to the value argument in this hashtable as determined by the equals method; false otherwise.

isEmpty

public boolean isEmpty()
Determines true if this hashtable contains no key-value mappings.

Specified by:
isEmpty in interface java.util.Map
Returns:
true if this hashtable contains no key-value mappings.

size

public int size()
Gets the number of key-value mappings in this hashtable.

Specified by:
size in interface java.util.Map
Returns:
the number of key-value mappings in this hashtable.

clear

public void clear()
Clears this hashtable so that it contains no keys.

Specified by:
clear in interface java.util.Map

equals

public boolean equals(java.lang.Object o)
Compares the specified Object with this Map for equality, as per the definition in the Map interface.

Specified by:
equals in interface java.util.Map
Parameters:
o - object
Returns:
true if the specified Object is equal to this Map.

hashCode

public int hashCode()
Gets the hash code value for this Map as per the definition in the Map interface.

Specified by:
hashCode in interface java.util.Map
Returns:
the hash code value for this Map as per the definition in the Map interface.

getKeysVector

public java.util.Vector getKeysVector()
Returns a new Vector containing the keys in the hashtable. The keys will enumerated in same order as they were added to the table. The data in the the returned Vector will not be affected by later modifications to the hashtable, and the hashtable will not be affected by modifications to the returned Vector.

Returns:
A new Vector containing the keys in the hashtable.

getKeysVector

public java.util.Vector getKeysVector(int fromIndex,
                                      int toIndex)
Returns a new Vector containing a sub-list of the keys in the hashtable. The keys will enumerated in same order as they were added to the table. The data in the the returned Vector will not be affected by later modifications to the hashtable, and the hashtable will not be affected by modifications to the returned Vector.

Parameters:
fromIndex - low endpoint (inclusive) of the sub-list.
toIndex - high endpoint (exclusive) of the sub-list.
Returns:
A new Vector containing a sub-list of the keys in the hashtable.
Throws:
java.lang.IndexOutOfBoundsException - if the endpoint index value is out of range (fromIndex < 0 || toIndex > size).
java.lang.IllegalArgumentException - if the endpoint indices are out of order (fromIndex > toIndex).

getValuesVector

public java.util.Vector getValuesVector()
Returns a new Vector containing the values in the hashtable. The values will enumerated in same order as they were added to the table. The data in the the returned Vector will not be affected by later modifications to the hashtable, and the hashtable will not be affected by modifications to the returned Vector.

Returns:
A new Vector containing the values in the hashtable.

getValuesVector

public java.util.Vector getValuesVector(int fromIndex,
                                        int toIndex)
Returns a new Vector containing a sub-list of the values in the hashtable. The values will enumerated in same order as they were added to the table. The data in the the returned Vector will not be affected by later modifications to the hashtable, and the hashtable will not be affected by modifications to the returned Vector.

Parameters:
fromIndex - low endpoint (inclusive) of the sub-list.
toIndex - high endpoint (exclusive) of the sub-list.
Returns:
A new Vector containing a sub-list of the values in the hashtable.
Throws:
java.lang.IndexOutOfBoundsException - if the endpoint index value is out of range (fromIndex < 0 || toIndex > size).
java.lang.IllegalArgumentException - if the endpoint indices are out of order (fromIndex > toIndex).

getHashMap

public java.util.HashMap getHashMap()
Returns a new HashMap object containing the keys and values in the hashtable. The data in the the returned HashMap will not be affected by later modifications to the hashtable, and the hashtable will not be affected by modifications to the returned HashMap.

Returns:
a new HashMap object containing the keys and values

keys

public java.util.Enumeration keys()
Returns an enumeration of the keys in the table. The keys will be enumerated in same order as they were added to the table. The data referenced by the the returned enumeration will not be affected by later modifications to the hashtable.

Returns:
an enumeration of the keys in the table

elements

public java.util.Enumeration elements()
Returns an enumeration of the values in the hashtable. The values will be enumerated in same order as they were added to the table. The data referenced by the the returned enumeration will not be affected by later modifications to the hashtable.

Returns:
an enumeration of the values in the hashtable

indexOf

public int indexOf(java.lang.Object obj)
Searches for the first occurrence of the given argument, testing for equality using the equals method.

Parameters:
obj - the object to find.
Returns:
The index of the first occurrence of the argument in this FifoHashtable; returns -1 if the object is not found.

indexOf

public int indexOf(java.lang.Object obj,
                   int idx)
Searches for the first occurrence of the given argument, beginning the search at 'idx', testing for equality using the equals method.

Parameters:
obj - the object to find.
idx - the starting search position.
Returns:
The index of the first occurrence of the argument at position 'idx' or later in this FifoHashtable; returns -1 if the object is not found.

lastIndexOf

public int lastIndexOf(java.lang.Object obj)
Searches for the last occurrence of the given argument, testing for equality using the equals method.

Parameters:
obj - the object to find.
Returns:
The index of the last occurrence of the argument in this FifoHashtable; returns -1 if the object is not found.

lastIndexOf

public int lastIndexOf(java.lang.Object obj,
                       int idx)
Searches for the last occurrence of the given argument, beginning the search at 'idx', testing for equality using the equals method.

Parameters:
obj - the object to find.
idx - the starting search position.
Returns:
The index of the last occurrence of the argument at position 'idx' or earlier in this FifoHashtable; returns -1 if the object is not found.

indexOfKey

public int indexOfKey(java.lang.Object obj)
Searches for the first occurrence of the given key, testing for equality using the equals method.

Parameters:
obj - the key to find.
Returns:
The index of the first occurrence of the key in this FifoHashtable; returns -1 if the object is not found.

indexOfKey

public int indexOfKey(java.lang.Object obj,
                      int idx)
Searches for the first occurrence of the given key, beginning the search at 'idx', testing for equality using the equals method.

Parameters:
obj - the key to find.
idx - the starting search position.
Returns:
The index of the first occurrence of the key at position 'idx' or later in this FifoHashtable; returns -1 if the object is not found.

lastIndexOfKey

public int lastIndexOfKey(java.lang.Object obj)
Searches for the last occurrence of the given key, testing for equality using the equals method.

Parameters:
obj - the key to find.
Returns:
The index of the last occurrence of the key in this FifoHashtable; returns -1 if the object is not found.

lastIndexOfKey

public int lastIndexOfKey(java.lang.Object obj,
                          int idx)
Searches for the last occurrence of the given key, beginning the search at 'idx', testing for equality using the equals method.

Parameters:
obj - the key to find.
idx - the starting search position.
Returns:
The index of the last occurrence of the key at position 'idx' or earlier in this FifoHashtable; returns -1 if the object is not found.

elementAt

public java.lang.Object elementAt(int idx)
Returns the object at the specified index in the FifoHashtable.

Parameters:
idx - the index value to use.
Returns:
the object at the specified index in the FifoHashtable.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is negative or not less than the current size of the FifoHashtable.

keyAt

public java.lang.Object keyAt(int idx)
Returns the key at the specified index in the FifoHashtable.

Parameters:
idx - the index value to use.
Returns:
the key at the specified index in the FifoHashtable.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is negative or not less than the current size of the FifoHashtable.

setElementAt

public void setElementAt(java.lang.Object obj,
                         int idx)
Sets the value object at the specified index of this FifoHashtable to be the specified object. The key object remains unchanged and the previous value object is discarded.

Parameters:
obj - the new value object to be set.
idx - the specified index; must be greater than or equal to zero and less than the size of this FifoHashtable.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is negative or not less than the current size of the FifoHashtable.

removeElementAt

public java.lang.Object removeElementAt(int idx)
Removes the entry at the specified index of this FifoHashtable. Each entry in this FifoHashtable with an index greater than the specified index is shifted downward to have an index one smaller than it had previously. The size of this FifoHashtable is decreased by 1.

Parameters:
idx - the specified index; must be greater than or equal to zero and less than the size of this FifoHashtable.
Returns:
The entry object that was removed.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is negative or not less than the current size of the FifoHashtable.

swapEntries

public boolean swapEntries(java.lang.Object key1Obj,
                           java.lang.Object key2Obj)
Swaps the table entries for the given key objects. The 'key,value' associations are not changed, but rather the position of the first 'key,value' entry is swapped with the second.

Parameters:
key1Obj - first key value
key2Obj - second key value
Returns:
true if successful, false if either of the key objects could not be found in the table.

toQuotedStrings

public java.lang.String toQuotedStrings(java.lang.String sepStr,
                                        boolean quoteCharsFlag,
                                        boolean dontQuoteKeysFlag,
                                        boolean dontQuoteValuesFlag)
Returns a String of substrings gathered from this hash table. Each table entry is converted to a pair of strings with the format "key"="value" and will appear in the same order as entered into the table.

Parameters:
sepStr - the string that separates the pairs of substrings.
quoteCharsFlag - if true then special characters, such as double-quote and control characters, will be "quoted" (or "escaped") in the substrings using the backslash character (\r \n \t \\ \").
dontQuoteKeysFlag - if true then the keys will not be surrounded by double-quotes ("); if false then the keys will be surrounded by double-quotes (").
dontQuoteValuesFlag - if true then the values will not be surrounded by double-quotes ("); if false then the values will be surrounded by double-quotes (").
Returns:
A string of substrings, or an empty string if no substrings could be generated (will not return null).

toQuotedStrings

public java.lang.String toQuotedStrings(char sepChar,
                                        boolean quoteCharsFlag,
                                        boolean dontQuoteKeysFlag,
                                        boolean dontQuoteValuesFlag)
Returns a String of substrings gathered from this hash table. Each table entry is converted to a pair of strings with the format "key"="value" and will appear in the same order as entered into the table.

Parameters:
sepChar - the character that separates the pairs of substrings.
quoteCharsFlag - if true then special characters, such as double-quote and control characters, will be "quoted" (or "escaped") in the substrings using the backslash character (\r \n \t \\ \").
dontQuoteKeysFlag - if true then the keys will not be surrounded by double-quotes ("); if false then the keys will be surrounded by double-quotes (").
dontQuoteValuesFlag - if true then the values will not be surrounded by double-quotes ("); if false then the values will be surrounded by double-quotes (").
Returns:
A string of substrings, or an empty string if no substrings could be generated (will not return null).

toQuotedStrings

public java.lang.String toQuotedStrings(java.lang.String sepStr,
                                        boolean quoteCharsFlag,
                                        boolean dontQuoteKeysFlag)
Returns a String of substrings gathered from this hash table. Each table entry is converted to a pair of strings with the format "key"="value" and will appear in the same order as entered into the table.

Parameters:
sepStr - the string that separates the pairs of substrings.
quoteCharsFlag - if true then special characters, such as double-quote and control characters, will be "quoted" (or "escaped") in the substrings using the backslash character (\r \n \t \\ \").
dontQuoteKeysFlag - if true then the keys will not be surrounded by double-quotes ("); if false then the keys will be surrounded by double-quotes (").
Returns:
A string of substrings, or an empty string if no substrings could be generated (will not return null).

toQuotedStrings

public java.lang.String toQuotedStrings(char sepChar,
                                        boolean quoteCharsFlag,
                                        boolean dontQuoteKeysFlag)
Returns a String of substrings gathered from this hash table. Each table entry is converted to a pair of strings with the format "key"="value" and will appear in the same order as entered into the table.

Parameters:
sepChar - the character that separates the pairs of substrings.
quoteCharsFlag - if true then special characters, such as double-quote and control characters, will be "quoted" (or "escaped") in the substrings using the backslash character (\r \n \t \\ \").
dontQuoteKeysFlag - if true then the keys will not be surrounded by double-quotes ("); if false then the keys will be surrounded by double-quotes (").
Returns:
A string of substrings, or an empty string if no substrings could be generated (will not return null).

toQuotedStrings

public java.lang.String toQuotedStrings(char sepChar,
                                        boolean quoteCharsFlag)
Returns a String of substrings gathered from this hash table. Each table entry is converted to a pair of strings with the format "key"="value" and will appear in the same order as entered into the table.

Parameters:
sepChar - the character that separates the pairs of substrings.
quoteCharsFlag - if true then special characters, such as double-quote and control characters, will be "quoted" (or "escaped") in the substrings using the backslash character (\r \n \t \\ \").
Returns:
A string of substrings, or an empty string if no substrings could be generated (will not return null).

toQuotedStrings

public java.lang.String toQuotedStrings(java.lang.String sepStr,
                                        boolean quoteCharsFlag)
Returns a String of substrings gathered from this hash table. Each table entry is converted to a pair of strings with the format "key"="value" and will appear in the same order as entered into the table.

Parameters:
sepStr - the string that separates the pairs of substrings.
quoteCharsFlag - if true then special characters, such as double-quote and control characters, will be "quoted" (or "escaped") in the substrings using the backslash character (\r \n \t \\ \").
Returns:
A string of substrings, or an empty string if no substrings could be generated (will not return null).

toQuotedStrings

public java.lang.String toQuotedStrings()
Returns a String of substrings gathered from this hash table. Each table entry is converted to a pair of strings with the format "key"="value", separated by commas, and appearing in the same order as entered into the table. Special characters, such as double-quote and control characters, will be "quoted" ("escaped") in the substrings using the backslash character (\r \n \t \\ \").

Returns:
A string of substrings, or an empty string if no substrings could be generated (will not return null).

quotedStringsToTable

public static FifoHashtable quotedStringsToTable(FifoHashtable inTable,
                                                 java.lang.String str,
                                                 char sepChar,
                                                 boolean strictFlag)
Returns a table of substring pairs parsed from the given string. Each substring pair should be in the format "key="value", and each pair separated by the given separator character. Special characters, such as double-quote and control characters, may be "quoted" ("escaped") in the substrings using the backslash character (i.e. \").

Parameters:
inTable - a FifoHashtable object to be loaded with items, or null to have a new FifoHashtable object created and loaded.
str - the source string.
sepChar - the character that separates the substrings.
strictFlag - if true then the string format is strictly interpreted--no extraneous spaces are allowed and every substring item must be surrounded by double-quotes.
Returns:
A FifoHashtable of string pairs, or null if the proper string format was not found.

quotedStringsToTable

public static FifoHashtable quotedStringsToTable(FifoHashtable inTable,
                                                 java.lang.String str,
                                                 char sepChar)
Returns a table of substring pairs parsed from the given string. Each substring pair should be in the format "key="value", and each pair separated by the given separator character. Special characters, such as double-quote and control characters, may be "quoted" ("escaped") in the substrings using the backslash character (i.e. \"). The string format is strictly interpreted in that no extraneous spaces are allowed and every substring item must be surrounded by double-quotes.

Parameters:
inTable - a FifoHashtable object to be loaded with items, or null to have a new FifoHashtable object created and loaded.
str - the source string.
sepChar - the character that separates the substrings.
Returns:
A FifoHashtable of string pairs, or null if the proper string format was not found.

quotedStringsToTable

public static FifoHashtable quotedStringsToTable(FifoHashtable inTable,
                                                 java.lang.String str)
Returns a table of substring pairs parsed from the given string. Each substring pair should be in the format "key="value", and each pair separated by a comma. Special characters, such as double-quote and control characters, may be "quoted" ("escaped") in the substrings using the backslash character (i.e. \"). The string format is strictly interpreted in that no extraneous spaces are allowed and every substring item must be surrounded by double-quotes.

Parameters:
inTable - a FifoHashtable object to be loaded with items, or null to have a new FifoHashtable object created and loaded.
str - the source string.
Returns:
A FifoHashtable of string pairs, or null if the proper string format was not found.

quotedStringsToTable

public static FifoHashtable quotedStringsToTable(java.lang.String str,
                                                 char sepChar,
                                                 boolean strictFlag)
Returns a table of substring pairs parsed from the given string. Each substring pair should be in the format "key="value", and each pair separated by the given separator character. Special characters, such as double-quote and control characters, may be "quoted" ("escaped") in the substrings using the backslash character (i.e. \").

Parameters:
str - the source string.
sepChar - the character that separates the substrings.
strictFlag - if true then the string format is strictly interpreted--no extraneous spaces are allowed and every substring item must be surrounded by double-quotes.
Returns:
A FifoHashtable of string pairs, or null if the proper string format was not found.

quotedStringsToTable

public static FifoHashtable quotedStringsToTable(java.lang.String str,
                                                 char sepChar)
Returns a table of substring pairs parsed from the given string. Each substring pair should be in the format "key="value", and each pair separated by the given separator character. Special characters, such as double-quote and control characters, may be "quoted" ("escaped") in the substrings using the backslash character (i.e. \"). The string format is strictly interpreted in that no extraneous spaces are allowed and every substring item must be surrounded by double-quotes.

Parameters:
str - the source string.
sepChar - the character that separates the substrings.
Returns:
A new FifoHashtable of string pairs, or null if the proper string format was not found.

quotedStringsToTable

public static FifoHashtable quotedStringsToTable(java.lang.String str)
Returns a table of substring pairs parsed from the given string. Each substring pair should be in the format "key="value", and each pair separated by a comma. Special characters, such as double-quote and control characters, may be "quoted" ("escaped") in the substrings using the backslash character (i.e. \"). The string format is strictly interpreted in that no extraneous spaces are allowed and every substring item must be surrounded by double-quotes.

Parameters:
str - the source string.
Returns:
A new FifoHashtable of string pairs, or null if the proper string format was not found.

clone

public java.lang.Object clone()
Creates a shallow copy of this hashtable. All the structure of the hashtable itself is copied, but the keys and values are not cloned. This is a relatively expensive operation.

Returns:
a clone of the hashtable.

toString

public java.lang.String toString()
Returns a string representation of the hashtable in the form of a set of entries, enclosed in braces and separated by the ASCII characters "" (comma and space). Each entry is rendered as the key, an equals sign =, and the associated element, where the toString method is used to convert the key and element to strings. The entries are presented in same order as they were entered.

Returns:
a string representation of this hashtable.

keySet

public java.util.Set keySet()
Returns a read-only set view of the keys contained in this map. The set does not support any add or remove operations. The 'keySet().iterator()' method may be used to iterate over the keys in this table (as long as the table is not modified between iterations).

Specified by:
keySet in interface java.util.Map
Returns:
A set view of the keys contained in this map.

values

public java.util.Collection values()
Returns a read-only collection view of the values contained in this map. The collection does not support any add or remove operations. The 'values().iterator()' method may be used to iterate over the values in this table (as long as the table is not modified between iterations).

Specified by:
values in interface java.util.Map
Returns:
A collection view of the values contained in this map.

entrySet

public java.util.Set entrySet()
Returns a read-only set view of the mappings contained in this map. The set does not support any add or remove operations. The 'entrySet().iterator()' method may be used to iterate over the entries in this table (as long as the table is not modified between iterations).

Specified by:
entrySet in interface java.util.Map
Returns:
A set view of the mappings contained in this map.
See Also:
Map.Entry