|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xbn.XBNObject | +--xbn.array.AOSLookup
Holds metadata about an array of strings. For easy creation of an AOSLookup, see AOSLCreator.
Source code: AOSLookup.java
Note that the original array of strings is not held in this object. You need to hold it externally.
Take this array of strings: ["aaa", "ccc", "bbb", "bbb", "aaa", "ddd", "ccc", "bbb"]
The central piece of information in this AOSLookup is the unique array of UniqueStrings (wrapped by a UniqueStringAP):
getString() |
getUnqArrIdx() |
getInstanceCount() |
aaa | 0 | 2 |
ccc | 1 | 2 |
bbb | 2 | 3 |
ddd | 3 | 1 |
This array contains metadata about each unique string existing in the string array, in the same order as the first instance found. The getUnqArrIdx
value is simply the array index of itself (useless here, but read on...).
The second object is the absolute array of UniqueStrings (wrapped by a UniqueStringAP), in the same order as the string array, and with the same duplication:
getString() |
getUnqArrIdx() |
getInstanceCount() |
aaa | 0 | 2 |
ccc | 1 | 2 |
bbb | 2 | 3 |
bbb | 2 | 3 |
aaa | 0 | 2 |
ddd | 3 | 1 |
ccc | 1 | 2 |
bbb | 2 | 3 |
These UniqueString objects are are not new instances. They are references to the original object, as exists in the unique array of UniqueStrings. It is in this array in which the getUnqArrIdx
value becomes useful.
The getInstanceCount
value is extra information. It's not critical to AOSLookup.
The final object is an AOSLHashtable. An AOSLHashtable wraps around a Hashtable, where the key is a unique string, and the value is the UniqueString object representing it:
Key (unique string) |
Value (UniqueString) |
aaa | [aaa, 0, 2] |
bbb | [bbb, 2, 3] |
ccc | [ccc, 1, 2] |
ddd | [ddd, 3, 1] |
Again, these UniqueString value objects are references to the original objects, as exist in the unique array of UniqueStrings. Note that the ordering presented here is made up. A Hashtable keeps its ordering behind the scenes.
With these three objects, you can quickly access any piece of information from any other.
From the string value, you can retrieve the unique array index with:
getAOSLHashtable().getUniqueString(__THE_STRING__).getUnqArrIdx()
From the unique array index, you can retrieve the string value:
getUSAPUnique().getUniqueString(__THE_UNQ_ARR_IDX__).getString()
From the absolute array index, you can retrieve the string value...
getUSAPAbsolute().getUniqueString(__THE_ABS_ARR_IDX__).getString()
...or the unique array index:
getUSAPAbsolute().getUniqueString(__THE_ABS_ARR_IDX__).getUnqArrIdx()
Fields inherited from class xbn.XBNObject |
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP |
Constructor Summary | |
AOSLookup(AOSLHashtable aosl_hashtable,
UniqueStringAP usap_unique,
UniqueStringAP usap_absolute)
Create an AOSLookup.unique UniqueStringAP, and absolute UniqueStringAP. |
|
AOSLookup(AOSLHashtable aosl_hashtable,
UniqueStringAP usap_unique,
UniqueStringAP usap_absolute,
boolean b_listUnqStrs)
Create an AOSLookup.unique UniqueStringAP, absolute UniqueStringAP, and list-unique-string setting. |
|
AOSLookup(AOSLHashtable aosl_hashtable,
UniqueStringAP usap_unique,
UniqueStringAP usap_absolute,
boolean b_listUnqStrs,
boolean b_validateParams)
Create an AOSLookup.unique UniqueStringAP, absolute UniqueStringAP, and list-unique-string and validate-parameters settings. |
Method Summary | |
void |
appendUSLToSB(StringBuffer str_buffer)
Append the list of strings to the provided StringBuffer. |
void |
appendUSLToSB(StringBuffer str_buffer,
String s_prefix)
Append the list of strings to the provided StringBuffer. |
void |
appendUSLToSB(StringBuffer str_buffer,
String s_prefix,
String s_whenNoList)
Append the list of strings to the provided StringBuffer. |
protected Object |
clone()
Get a full (deep) copy of this AOSLookup as an Object. |
void |
crashIfBadInternalObjs()
Verifies that all internal objects are correctly formatted, and crashes if they are not. |
void |
crashIfBadInternalObjs(String s_callingClsFnc)
Verifies that all internal objects are correctly formatted, and crashes if they are not. |
boolean |
doListUnqStrs()
Should getUnqStrList and appendUSLToSB print out the list of strings? |
AOSLookup |
getAOSLClone()
Get a full (deep) copy of this AOSLookup. |
AOSLHashtable |
getAOSLHashtable()
Get the AOSLHashtable for direct manipulation. |
String |
getUnqStrList()
Get the list of strings in the original array as a list. |
String |
getUnqStrList(String s_prefix)
Get the list of strings in the original array as a list. |
String |
getUnqStrList(String s_prefix,
String s_whenNoList)
Get the list of strings in the original array as a list. |
UniqueStringAP |
getUSAPAbsolute()
Get the absolute UniqueStringAP for direct manipulation. |
UniqueStringAP |
getUSAPUnique()
Get the unique UniqueStringAP for direct manipulation. |
Methods inherited from class xbn.XBNObject |
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AOSLookup(AOSLHashtable aosl_hashtable, UniqueStringAP usap_unique, UniqueStringAP usap_absolute)
Create an AOSLookup.unique UniqueStringAP, and absolute UniqueStringAP.
Equal to AOSLookup(aosl_hashtable, usap_unique, usap_absolute, b_listUnqStrs, true)
public AOSLookup(AOSLHashtable aosl_hashtable, UniqueStringAP usap_unique, UniqueStringAP usap_absolute, boolean b_listUnqStrs)
Create an AOSLookup.unique UniqueStringAP, absolute UniqueStringAP, and list-unique-string setting.
Equal to AOSLookup(aosl_hashtable, usap_unique, usap_absolute, b_listUnqStrs, b_validateParams, true)
public AOSLookup(AOSLHashtable aosl_hashtable, UniqueStringAP usap_unique, UniqueStringAP usap_absolute, boolean b_listUnqStrs, boolean b_validateParams)
Create an AOSLookup.unique UniqueStringAP, absolute UniqueStringAP, and list-unique-string and validate-parameters settings.
aosl_hashtable
- The AOSLHashtable. May not be null.usap_unique
- The UniqueStringAP representing the unique strings in the string array. May not be null, each element must be non-null.usap_absolute
- The UniqueStringAP representing the absolute strings in the string array. May not be null, and no element may be null.b_listUnqStrs
- Should getUnqStrList and appendUSLToSB actually list the strings (absolutely), or should you get a "strings not listed" message?b_validateParams
- .................Method Detail |
public final AOSLHashtable getAOSLHashtable()
Get the AOSLHashtable for direct manipulation.
public final UniqueStringAP getUSAPUnique()
Get the unique UniqueStringAP for direct manipulation.
See the section regarding this object in the overall documentation.
public final UniqueStringAP getUSAPAbsolute()
Get the absolute UniqueStringAP for direct manipulation.
See the section regarding this object in the overall documentation.
public final boolean doListUnqStrs()
Should getUnqStrList and appendUSLToSB print out the list of strings?
public final String getUnqStrList()
Get the list of strings in the original array as a list.
getUnqStrList("")
public final String getUnqStrList(String s_prefix)
Get the list of strings in the original array as a list.
getUnqStrList(s_prefix, "")
public final String getUnqStrList(String s_prefix, String s_whenNoList)
Get the list of strings in the original array as a list.
appendUSLToSB((new StringBuffer("")), s_prefix, "")
public final void appendUSLToSB(StringBuffer str_buffer)
Append the list of strings to the provided StringBuffer.
Equal to appendUSLToSB(str_buffer, "")
public final void appendUSLToSB(StringBuffer str_buffer, String s_prefix)
Append the list of strings to the provided StringBuffer.
Equal to appendUSLToSB(str_buffer, s_prefix, "")
public final void appendUSLToSB(StringBuffer str_buffer, String s_prefix, String s_whenNoList)
Append the list of strings to the provided StringBuffer.
s_prefix
- What should be first appended to str_buffer, regardless of the doListUnqStrs setting. If null, no prefix is desired.s_whenNoList
- If doListUnqStrs equals false, then this is the string appended to str_buffer (after s_prefix).public final void crashIfBadInternalObjs()
Verifies that all internal objects are correctly formatted, and crashes if they are not.
Equal to crashIfBadInternalObjs("crashIfBadInternalObjs")
public final void crashIfBadInternalObjs(String s_callingClsFnc)
Verifies that all internal objects are correctly formatted, and crashes if they are not.
This class verifies that ..............
s_callingClsFnc
- The class-plus-function name from which potential error messages should appear like they're coming from.public final AOSLookup getAOSLClone()
Get a full (deep) copy of this AOSLookup.
(AOSLookup)clone()
protected Object clone() throws CloneNotSupportedException
Get a full (deep) copy of this AOSLookup as an Object.
clone
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.
http://sourceforge.net/projects/xbnjava