xbn.array
Class VWString

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

public class VWString
extends VectorWrapper
implements Cloneable

A VectorWrapper for java.lang.Strings. See java.lang.String.

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


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
VWString()
          Create a VWString with default settings.
VWString(boolean b_orderDirAscDesc)
          Create a VWString.
VWString(boolean b_addInOrder, boolean b_orderDirAscDesc)
          Create a VWString.
VWString(Vector v_ector)
          Create a VWString.
VWString(Vector v_ector, boolean b_orderDirAscDesc)
          Create a VWString.
VWString(Vector v_ector, boolean b_addInOrder, boolean b_orderDirAscDesc)
          Create a VWString.
 
Method Summary
 void add(String s_tr)
          Add a string.
 void addAOChar(char[] a_char)
          Add an array of chars.
 void addAOInt(int[] a_int)
          Add an array of ints.
 void addAPChar(APChar ap_char)
          Add an array of chars, as protected by the provided APChar.
 void addAPInt(APInt ap_int)
          Add an array of chars, as protected by the provided APInt.
 void addAPString(APString ap_string)
          Add an array of strings, as protected by the provided APString.
 void addArray(String[] a_string)
          Add an array of strings.
 void addChar(char c_har)
          Add a character.
 void addInt(int i_nt)
          Add an int.
protected  Object clone()
          Get a full (deep) copy of this VWString as an Object.
 boolean doesExist(String s_tr)
          Was a string already added?
 String[] getAOString()
          Get the array of strings.
 int getFoundIdx(String s_tr)
          Get the index at which the string actually exists.
 int getInsertAddIdx(String s_tr)
          Get the index at which to insert the provided string.
 String getString(int i_dx)
          Get a string from the vector, at the required array index.
 VWString getVWSClone()
          Get a full (deep) copy of this VWString.
 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

VWString

public VWString()

Create a VWString with default settings.

Equal to VectorWrapper()


VWString

public VWString(Vector v_ector)

Create a VWString.

Equal to VectorWrapper(v_ector)

Note: It is expected that this Vector contain only strings.


VWString

public VWString(boolean b_orderDirAscDesc)

Create a VWString.

Equal to VectorWrapper(b_orderDirAscDesc)


VWString

public VWString(Vector v_ector,
                boolean b_orderDirAscDesc)

Create a VWString.

Equal to VectorWrapper(v_ector, b_orderDirAscDesc)

Note: It is expected that this Vector contain only strings.


VWString

public VWString(boolean b_addInOrder,
                boolean b_orderDirAscDesc)

Create a VWString.

Equal to VectorWrapper(b_addInOrder, b_orderDirAscDesc)


VWString

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

Create a VWString.

Equal to VectorWrapper(v_ector, b_addInOrder, b_orderDisAscDesc)

Note: It is expected that this Vector contain only strings.

Method Detail

add

public final void add(String s_tr)

Add a string.

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

getInsertAddIdx

public final int getInsertAddIdx(String s_tr)

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

Parameters:
s_tr - The string you're about to insert. May not be null.
Returns:
If...
  • ...adding is done in order: The array index at which s_tr should be added to preserve the requested ordering. Note that when there are one or more strings equaling s_tr 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_tr)

Get the index at which the string actually exists.

Parameters:
s_tr - The string that may already exist in this VWString. May not be null.
Returns:
The array index at which s_tr exists. Note that in the case of multiple instances of s_tr, the first (when not adding in order) or random (when adding in order) one is returned.
-1 If no other string equalling s_tr have yet been added.

doesExist

public final boolean doesExist(String s_tr)

Was a string already added?

Parameters:
s_tr - The string who's existence you want to test. May not be null.
Returns:
true If the string s_tr exists.
false if s_tr does not exist.

addChar

public final void addChar(char c_har)

Add a character.

Equal to add(new Character(c_har).toString())


addInt

public final void addInt(int i_nt)

Add an int.

Equal to add(new Integer(i_nt).toString())


addArray

public final void addArray(String[] a_string)

Add an array of strings.

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

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

addAPString

public final void addAPString(APString ap_string)

Add an array of strings, as protected by the provided APString.

For each element in ap_string, this calls, in order: add(ap_string.getString(X))

Parameters:
ap_string - The APString, whose internally-held string array should be added. May not be null.

addAOChar

public final void addAOChar(char[] a_char)

Add an array of chars.

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

Parameters:
a_char - The char array to add. May not be null.

addAPChar

public final void addAPChar(APChar ap_char)

Add an array of chars, as protected by the provided APChar.

Equal to addAOChar(ap_char.[The internally-held char array])

Parameters:
ap_char - The APChar to add. May not be null.

addAOInt

public final void addAOInt(int[] a_int)

Add an array of ints.

Parameters:
a_int - The int array to add. May not be null.

addAPInt

public final void addAPInt(APInt ap_int)

Add an array of chars, as protected by the provided APInt.

Equal to addAOInt(ap_int.[The internally-held char array])

Parameters:
ap_int - The APInt to add. May not be null.

getString

public final String getString(int i_dx)

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

Overrides:
getString in class VectorWrapper
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.

getAOString

public final String[] getAOString()

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 VWString getVWSClone()

Get a full (deep) copy of this VWString.

Returns:
(VWString)clone()

clone

protected final Object clone()
                      throws CloneNotSupportedException

Get a full (deep) copy of this VWString 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