|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.FifoHashtable
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 |
public FifoHashtable(int initialCapacity, float loadFactor)
initialCapacity
- the initial capacity of the hashtable.loadFactor
- the load factor of the hashtable.
java.lang.IllegalArgumentException
- if the initial capacity is
less than zero, or if the load factor is nonpositive.public FifoHashtable(int initialCapacity)
initialCapacity
- the initial capacity of the hashtable.
java.lang.IllegalArgumentException
- if the initial capacity is
less than zero.public FifoHashtable()
protected FifoHashtable(java.util.HashMap hashMapObj)
hashMapObj
- hash map objectMethod Detail |
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.
public void putAll(java.util.Map mapObj)
putAll
in interface java.util.Map
mapObj
- mappings to be stored in this map.public java.lang.Object putSort(java.lang.Object key, java.lang.Object value, boolean sortDirFlag)
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.
public java.lang.Object putSort(java.lang.Object key, java.lang.Object value, boolean sortDirFlag, int sortType)
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.
public java.lang.Object putSort(java.lang.Object key, java.lang.Object value, boolean sortDirFlag, java.util.Comparator compObj)
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.
public void putSortAll(java.util.Map mapObj, boolean sortDirFlag)
mapObj
- mappings to be stored in this map.sortDirFlag
- true for ascending sort order, false for
descending.public void putSortAll(java.util.Map mapObj, boolean sortDirFlag, int sortType)
mapObj
- mappings to be stored in this map.sortDirFlag
- true for ascending sort order, false for
descending.sortType
- the sort type.public void putSortAll(java.util.Map mapObj, boolean sortDirFlag, java.util.Comparator compObj)
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.public java.lang.Object putSortByValue(java.lang.Object key, java.lang.Object value, boolean sortDirFlag)
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.
public java.lang.Object putSortByValue(java.lang.Object key, java.lang.Object value, boolean sortDirFlag, int sortType)
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.
public java.lang.Object putSortByValue(java.lang.Object key, java.lang.Object value, boolean sortDirFlag, java.util.Comparator compObj)
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.
public void putSortByValueAll(java.util.Map mapObj, boolean sortDirFlag)
mapObj
- mappings to be stored in this map.sortDirFlag
- true for ascending sort order, false for
descending.public void putSortByValueAll(java.util.Map mapObj, boolean sortDirFlag, int sortType)
mapObj
- mappings to be stored in this map.sortDirFlag
- true for ascending sort order, false for
descending.sortType
- the sort type.public void putSortByValueAll(java.util.Map mapObj, boolean sortDirFlag, java.util.Comparator compObj)
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.public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
key
- key whose associated value is to be returned.
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
key
- key whose mapping is to be removed from the hashtable.
public java.lang.Object removeValue(java.lang.Object obj)
obj
- value to be removed from the hashtable.
public boolean removeAllKeys(java.util.Collection collObj)
collObj
- the Collection of key-items to be removed.
public boolean removeAllValues(java.util.Collection collObj)
collObj
- the Collection of value-items to be removed.
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
key
- possible key.
true
if and only if the specified object
is a key in this hashtable, as determined by the
equals method; false
otherwise.public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
value
- value whose presence in this map is to be tested.
public boolean contains(java.lang.Object value)
value
- value whose presence in this map is to be tested.
true
if and only if some key maps to the
value
argument in this hashtable as
determined by the equals method;
false
otherwise.public boolean isEmpty()
isEmpty
in interface java.util.Map
public int size()
size
in interface java.util.Map
public void clear()
clear
in interface java.util.Map
public boolean equals(java.lang.Object o)
equals
in interface java.util.Map
o
- object
public int hashCode()
hashCode
in interface java.util.Map
public java.util.Vector getKeysVector()
public java.util.Vector getKeysVector(int fromIndex, int toIndex)
fromIndex
- low endpoint (inclusive) of the sub-list.toIndex
- high endpoint (exclusive) of the sub-list.
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).public java.util.Vector getValuesVector()
public java.util.Vector getValuesVector(int fromIndex, int toIndex)
fromIndex
- low endpoint (inclusive) of the sub-list.toIndex
- high endpoint (exclusive) of the sub-list.
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).public java.util.HashMap getHashMap()
public java.util.Enumeration keys()
public java.util.Enumeration elements()
public int indexOf(java.lang.Object obj)
obj
- the object to find.
public int indexOf(java.lang.Object obj, int idx)
obj
- the object to find.idx
- the starting search position.
public int lastIndexOf(java.lang.Object obj)
obj
- the object to find.
public int lastIndexOf(java.lang.Object obj, int idx)
obj
- the object to find.idx
- the starting search position.
public int indexOfKey(java.lang.Object obj)
obj
- the key to find.
public int indexOfKey(java.lang.Object obj, int idx)
obj
- the key to find.idx
- the starting search position.
public int lastIndexOfKey(java.lang.Object obj)
obj
- the key to find.
public int lastIndexOfKey(java.lang.Object obj, int idx)
obj
- the key to find.idx
- the starting search position.
public java.lang.Object elementAt(int idx)
idx
- the index value to use.
java.lang.ArrayIndexOutOfBoundsException
- if the index is negative
or not less than the current size of the FifoHashtable.public java.lang.Object keyAt(int idx)
idx
- the index value to use.
java.lang.ArrayIndexOutOfBoundsException
- if the index is negative
or not less than the current size of the FifoHashtable.public void setElementAt(java.lang.Object obj, int idx)
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.
java.lang.ArrayIndexOutOfBoundsException
- if the index is negative
or not less than the current size of the FifoHashtable.public java.lang.Object removeElementAt(int idx)
idx
- the specified index; must be greater than or equal to
zero and less than the size of this FifoHashtable.
java.lang.ArrayIndexOutOfBoundsException
- if the index is negative
or not less than the current size of the FifoHashtable.public boolean swapEntries(java.lang.Object key1Obj, java.lang.Object key2Obj)
key1Obj
- first key valuekey2Obj
- second key value
public java.lang.String toQuotedStrings(java.lang.String sepStr, boolean quoteCharsFlag, boolean dontQuoteKeysFlag, boolean dontQuoteValuesFlag)
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 (").
public java.lang.String toQuotedStrings(char sepChar, boolean quoteCharsFlag, boolean dontQuoteKeysFlag, boolean dontQuoteValuesFlag)
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 (").
public java.lang.String toQuotedStrings(java.lang.String sepStr, boolean quoteCharsFlag, boolean dontQuoteKeysFlag)
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 (").
public java.lang.String toQuotedStrings(char sepChar, boolean quoteCharsFlag, boolean dontQuoteKeysFlag)
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 (").
public java.lang.String toQuotedStrings(char sepChar, boolean quoteCharsFlag)
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 \\ \").
public java.lang.String toQuotedStrings(java.lang.String sepStr, boolean quoteCharsFlag)
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 \\ \").
public java.lang.String toQuotedStrings()
public static FifoHashtable quotedStringsToTable(FifoHashtable inTable, java.lang.String str, char sepChar, boolean strictFlag)
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.
public static FifoHashtable quotedStringsToTable(FifoHashtable inTable, java.lang.String str, char sepChar)
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.
public static FifoHashtable quotedStringsToTable(FifoHashtable inTable, java.lang.String str)
inTable
- a FifoHashtable object to be loaded with items, or
null to have a new FifoHashtable object created and loaded.str
- the source string.
public static FifoHashtable quotedStringsToTable(java.lang.String str, char sepChar, boolean strictFlag)
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.
public static FifoHashtable quotedStringsToTable(java.lang.String str, char sepChar)
str
- the source string.sepChar
- the character that separates the substrings.
public static FifoHashtable quotedStringsToTable(java.lang.String str)
str
- the source string.
public java.lang.Object clone()
public java.lang.String toString()
public java.util.Set keySet()
keySet
in interface java.util.Map
public java.util.Collection values()
values
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
Map.Entry
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |