|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xbn.XBNObject | +--xbn.array.VectorWrapper
Wraps around a Vector, to aid and enhance the process of creating arrays of unknown length. See java.util.Vector.
Source code: VectorWrapper.java. Example code See the example code for VWInt.
This convenience class manages a Vector internally: creates it, validates added objects, and is ultimately converted to an array of the desired type. The order in which objects are added is preserved in the resulting array.
Fields inherited from class xbn.XBNObject |
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP |
Constructor Summary | |
VectorWrapper()
Create a VectorWrapper with default settings. |
|
VectorWrapper(boolean b_orderDirAscDesc)
Create a VectorWrapper. |
|
VectorWrapper(boolean b_addInOrder,
boolean b_orderDirAscDesc)
Create a VectorWrapper. |
|
VectorWrapper(Vector v_ector)
Create a VectorWrapper. |
|
VectorWrapper(Vector v_ector,
boolean b_orderDirAscDesc)
Create a VectorWrapper. |
|
VectorWrapper(Vector v_ector,
boolean b_addInOrder,
boolean b_orderDirAscDesc)
Create a VectorWrapper. |
Method Summary | |
boolean |
doAddInOrder()
When elements are added, should they be added in order of something? |
Object |
elementAt(int i_dx)
Get the requested element. |
String |
getList(String s_divider)
Get a list of all elements. |
boolean |
getOrderDirAscDesc()
When elements are added and definitely ordered, in which direction should ordering occur? |
abstract String |
getString(int i_dx)
Get the element at the requested index, as a string. |
Vector |
getVector()
Get the vector for direct manipulation. |
void |
initializeVector()
Initialize the vector. |
abstract boolean |
isNull(int i_dx)
Is the element at the requested index null?. |
int |
size()
How many elements are in the internal Vector? |
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, toString, wait, wait, wait |
Constructor Detail |
public VectorWrapper()
Create a VectorWrapper with default settings.
Equal to VectorWrapper(new Vector())
public VectorWrapper(Vector v_ector)
Create a VectorWrapper.
Equal to VectorWrapper(v_ector, false, false)
public VectorWrapper(boolean b_orderDirAscDesc)
Create a VectorWrapper.
Equal to VectorWrapper((new Vector()), b_orderDirAscDesc)
public VectorWrapper(Vector v_ector, boolean b_orderDirAscDesc)
Create a VectorWrapper.
Equal to VectorWrapper(v_ector, true, b_orderDirAscDesc)
public VectorWrapper(boolean b_addInOrder, boolean b_orderDirAscDesc)
Create a VectorWrapper.
Equal to VectorWrapper((new Vector()), b_addInOrder, b_orderDirAscDesc)
public VectorWrapper(Vector v_ector, boolean b_addInOrder, boolean b_orderDirAscDesc)
Create a VectorWrapper.
v_ector
- The vector to add elements to. May not be null. It is assumed that this is appropriate for this VectorWrapper (for example, ordered in the proper way, as dictated by b_addInOrder and b orderDirAscDesc). If not, this class may behave unpredictably. See getVector().b_addInOrder
- If true, when a [thing] is added, then add it so that the resulting (internally-held) Vector is ordered by [whatever is appropriate in the sub-class], in the direction defined by b_orderDirAscDesc. See doAddInOrderbOrderDirAscDesc
- If b_addInOrder is true, then this defines the direction in which ordering should occur. If true, then ordering is by ascending name (1, 2, 3). If false, then descending (3, 2, 1). See getOrderDirAscDesc.Method Detail |
public Vector getVector()
Get the vector for direct manipulation.
public final boolean doAddInOrder()
When elements are added, should they be added in order of something?
public final boolean getOrderDirAscDesc()
When elements are added and definitely ordered, in which direction should ordering occur?
public Object elementAt(int i_dx)
Get the requested element.
i_dx
- The Vector index. Must range 0..[size() - 1]
, inclusive.public void initializeVector()
Initialize the vector.
Use this when you want to start from scratch, with zero elements.
public int size()
How many elements are in the internal Vector?
getVector().size()
public abstract String getString(int i_dx)
Get the element at the requested index, as a string.
i_dx
- The Vector index to retrieve. Must range 0..[size() - 1]
, inclusive.public abstract boolean isNull(int i_dx)
Is the element at the requested index null?.
i_dx
- The Vector index to analyze. Must range 0..[size() - 1]
, inclusive.true
- If the requested Vector element is null.
public String getList(String s_divider)
Get a list of all elements. This is not the most efficient, because it always calls getString. It's good for debugging, though.
|
|||||||||
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