|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xbn.XBNObject | +--xbn.named.ManualNamedArray
A manual implementation of NamedArray. Where the heart of a NamedArray is an AOSLookup, the heart of ManualNamedArray is a plain array of Named objects.
Source code: ManualNamedArray.java
Don't use this when speed and efficiency are critical. Do use this when you must not be dependent on the xbn.named (and other fundamental) classes. ManualNamedArray is intended for use in objects that cannot depend on NamedArray (to avoid circular dependencies), but need most of it's functionality.
Fields inherited from class xbn.XBNObject |
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP |
Constructor Summary | |
ManualNamedArray(Named[] a_named)
Create a ManualNamedArray. |
|
ManualNamedArray(Named[] a_named,
boolean b_lock)
Create a ManualNamedArray. |
Method Summary | |
void |
add(Named n_amed)
Add a new Named object to the array. |
void |
addOrReplace(Named n_amed)
Add a new or replace an existing Named object in the array. |
boolean |
doesExist(String s_name)
Does the provided name exist in the Named array? |
Named[] |
getAONamed()
Get the array of Named objects for direct manipulation. |
int |
getArrIdx(String s_name)
At which array index does the requested Named element exist? |
protected int |
getArrIdx(String s_name,
boolean b_crashIfNotFound)
At which array index does the requested Named element exist? |
int |
getLength()
How many Named elements exist in the array? |
Named |
getNamed(int i_dx)
Get the Named element at the requested array index. |
Named |
getNamed(String s_name)
Get the Named element having the provided name. |
void |
replace(Named n_amed)
Replace a Named object already existing in the array. |
String |
toString()
Get some information about this ManualNamedArray. |
Methods inherited from class xbn.XBNObject |
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ManualNamedArray(Named[] a_named)
Create a ManualNamedArray.
Equal to ManualNamedArray(a_named, false)
public ManualNamedArray(Named[] a_named, boolean b_lock)
Create a ManualNamedArray.
a_named
- The array of Named objects. May not be null, zero elements in length, and every element must be non null, and have unique names.b_lock
- Should direct access be allowed to a_named? If true, then yes. If false, no. See getAONamed, add, addOrReplace and replace.Method Detail |
public boolean doesExist(String s_name)
Does the provided name exist in the Named array?
(getArrIdx(s_name, false) != -1)
public Named getNamed(String s_name)
Get the Named element having the provided name.
a_named[getArrIdx(s_name)]
Where a_named is exactly as provided to the constructor.public Named getNamed(int i_dx)
Get the Named element at the requested array index.
a_named[i_dx]
Where a_named is exactly as provided to the constructor.public int getLength()
How many Named elements exist in the array?
a_named.length
Where a_named is exactly as provided to the constructor.public Named[] getAONamed()
Get the array of Named objects for direct manipulation.
a_named
Where a_named is exactly as provided to the constructor.public void addOrReplace(Named n_amed)
Add a new or replace an existing Named object in the array.
n_amed
- The Named object to add or replace. May not be null. If n_amed.getName does exist in the array of Named objects, then that element is replaced by this. If the name does not exist, this n_amed is added to the end of the array.public void replace(Named n_amed)
Replace a Named object already existing in the array.
n_amed
- The Named object to add. May not be null and getName must exist.public void add(Named n_amed)
Add a new Named object to the array.
n_amed
- The Named object to add. May not be null and getName may not exist.public int getArrIdx(String s_name)
At which array index does the requested Named element exist?
getArrIdx(s_name, true)
protected int getArrIdx(String s_name, boolean b_crashIfNotFound)
At which array index does the requested Named element exist?
s_name
- The name of the Named object. May not be null.b_crashIfNotFound
- If true and s_name does not exist, then an AssertException is thrown with an error message saying so. If false and s_name does not exist, then -1 is returned.public String toString()
Get some information about this ManualNamedArray.
toString
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