xbn.named
Class VWNamed

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.array.VectorWrapper
              |
              +--xbn.named.VWNamed
All Implemented Interfaces:
Cloneable

public class VWNamed
extends VectorWrapper
implements Cloneable

A VectorWrapper for Named objects. See Named.

Source code:  VWNamed.java.  Example code  See the similar example code for VWInt.

Since:
0.8.2b

Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
VWNamed()
          Create a VWNamed with default settings.
VWNamed(boolean b_orderDirAscDesc)
          Create a VWNamed.
VWNamed(boolean b_addInOrder, boolean b_orderDirAscDesc)
          Create a VWNamed.
VWNamed(Vector v_ector)
          Create a VWNamed.
VWNamed(Vector v_ector, boolean b_orderDirAscDesc)
          Create a VWNamed.
VWNamed(Vector v_ector, boolean b_addInOrder, boolean b_orderDirAscDesc)
          Create a VWNamed.
 
Method Summary
 void add(Named n_amed)
          Add a Named object.
 void addArray(Named[] a_named)
          Add an array of strings.
protected  Object clone()
          Get a full (deep) copy of this VWNamed as an Object.
 boolean doesExist(String s_name)
          Was a Named object with the provided name already added?
 Named[] getAONamed()
          Get the array of strings.
 int getFoundIdx(String s_name)
          Get the index at which the string actually exists.
 int getInsertAddIdx(String s_name)
          Get the index at which to insert the provided string.
 Named getNamed(int i_dx)
          Get a string from the vector, at the required array index.
 String getString(int i_dx)
          Alias for getNamed(i_dx).getName().
 VWNamed getVWSClone()
          Get a full (deep) copy of this VWNamed.
 boolean isNull(int i_dx)
          Is the element at the requested index null?.
 
Methods inherited from class xbn.array.VectorWrapper
doAddInOrder, elementAt, getList, getOrderDirAscDesc, getVector, initializeVector, size
 
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

VWNamed

public VWNamed()

Create a VWNamed with default settings.

Equal to VectorWrapper()


VWNamed

public VWNamed(Vector v_ector)

Create a VWNamed.

Equal to VectorWrapper(v_ector)

Note: It is expected that this Vector contain only Named objects.


VWNamed

public VWNamed(boolean b_orderDirAscDesc)

Create a VWNamed.

Equal to VectorWrapper(b_orderDirAscDesc)


VWNamed

public VWNamed(Vector v_ector,
               boolean b_orderDirAscDesc)

Create a VWNamed.

Equal to VectorWrapper(v_ector, b_orderDirAscDesc)

Note: It is expected that this Vector contain only Named objects.


VWNamed

public VWNamed(boolean b_addInOrder,
               boolean b_orderDirAscDesc)

Create a VWNamed.

Equal to VectorWrapper(b_addInOrder, b_orderDirAscDesc)


VWNamed

public VWNamed(Vector v_ector,
               boolean b_addInOrder,
               boolean b_orderDirAscDesc)

Create a VWNamed.

Equal to VectorWrapper(v_ector, b_addInOrder, b_orderDisAscDesc)

Note: It is expected that this Vector contain only Named objects.

Method Detail

add

public final void add(Named n_amed)

Add a Named object.

Parameters:
n_amed - The string to add. May not be null, nor may the name be null. If not adding in order, then the name may not be less than zero characters in length. If adding in order, the name may not be less than one character in length.

getInsertAddIdx

public final int getInsertAddIdx(String s_name)

Get the index at which to insert the provided string. This function is only meaningful when doAddInOrder() equals true. See doAddInOrder.

Parameters:
s_name - The name of the Named you wish to add. May not be null.
Returns:
If...
  • ...adding is done in order: The array index at which n_amed should be added to preserve the requested ordering. Note that when there are one or more strings equaling n_amed have already been added, then you'll get the array index of (randomly) one of those existing elements.
  • ...size equals zero: 0
  • ...adding is not done in order: 0

getFoundIdx

public final int getFoundIdx(String s_name)

Get the index at which the string actually exists.

Parameters:
n_amed - The string that may already exist in this VWNamed. May not be null.
Returns:
-1 If no Named object whose name equals s_name exists.
The array index at which the Named object exists.

doesExist

public final boolean doesExist(String s_name)

Was a Named object with the provided name already added?

Parameters:
s_name - The name who's existence (of the Named object having that name) you want to test for. May not be null.
Returns:
true If a Named object whose name equals s_name exists.
false if no added Named object has the name s_name.

addArray

public final void addArray(Named[] a_named)

Add an array of strings.

For each element in a_named, this calls, in order: add(a_named[X])

Parameters:
a_named - The Named array to add. May not be null, nor may any element be null.

getString

public final String getString(int i_dx)

Alias for getNamed(i_dx).getName().

Overrides:
getString in class VectorWrapper
Returns:
getNamed(i_dx).getName()

getNamed

public final Named getNamed(int i_dx)

Get a string from the vector, at the required array index.

Parameters:
i_dx - The array index. Must range 0..[size() - 1], inclusive.

isNull

public final boolean isNull(int i_dx)
Description copied from class: VectorWrapper

Is the element at the requested index null?.

Overrides:
isNull in class VectorWrapper
Following copied from class: xbn.array.VectorWrapper
Parameters:
i_dx - The Vector index to analyze. Must range 0..[size() - 1], inclusive.
true - If the requested Vector element is null.
false If non-null.

getAONamed

public final Named[] getAONamed()

Get the array of strings. This array is composed of all those strings added since this object was created, or since the last time this function was called.

Returns:
An array containing all strings added, in the same order as originally added (if not ordered when added), or in order (if ordered when added).

getVWSClone

public final VWNamed getVWSClone()

Get a full (deep) copy of this VWNamed.

Returns:
(VWNamed)clone()

clone

protected final Object clone()
                      throws CloneNotSupportedException

Get a full (deep) copy of this VWNamed as an Object.

Overrides:
clone in class Object



Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.

 

http://sourceforge.net/projects/xbnjava

 

SourceForge.net Logo