xbn.array
Class VWChar

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

public class VWChar
extends VectorWrapper
implements Cloneable

A VectorWrapper for chars.

Source code:  VWChar.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
VWChar()
          Create a VWChar with default settings.
VWChar(boolean b_orderDirAscDesc)
          Create a VWChar.
VWChar(boolean b_addInOrder, boolean b_orderDirAscDesc)
          Create a VWChar.
VWChar(Vector v_ector)
          Create a VWChar.
VWChar(Vector v_ector, boolean b_orderDirAscDesc)
          Create a VWChar.
VWChar(Vector v_ector, boolean b_addInOrder, boolean b_orderDirAscDesc)
          Create a VWChar.
 
Method Summary
 void add(char c_har)
          Add a char.
 void addAPChar(APChar ap_char)
          Add an array of chars, as protected by the provided APChar.
 void addArray(char[] a_char)
          Add an array of chars.
protected  Object clone()
          Get a full (deep) copy of this VWChar as an Object.
 boolean doesExist(char c_har)
          Was an char already added?
 char[] getAOChar()
           
 char[] getAOChar(boolean b_sort)
          Get the array of chars.
 char getChar(int i_dx)
          Get a char from the vector, at the required array index.
 int getFoundIdx(char c_har)
          Get the index at which the char actually exists.
 int getInsertAddIdx(char c_har)
          Get the index at which to insert the provided char.
 String getString(int i_dx)
          Get the element at the requested index, as a string.
 VWChar getVWCClone()
          Get a full (deep) copy of this VWChar.
 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

VWChar

public VWChar()

Create a VWChar with default settings.

Equal to VectorWrapper()


VWChar

public VWChar(Vector v_ector)

Create a VWChar.

Equal to VectorWrapper(v_ector)

Note: It is expected that this Vector contain only chars (contained in Character objects).


VWChar

public VWChar(boolean b_orderDirAscDesc)

Create a VWChar.

Equal to VectorWrapper(b_orderDirAscDesc)


VWChar

public VWChar(Vector v_ector,
              boolean b_orderDirAscDesc)

Create a VWChar.

Equal to VectorWrapper(v_ector, b_orderDirAscDesc)

Note: It is expected that this Vector contain only chars (contained in Character objects).


VWChar

public VWChar(boolean b_addInOrder,
              boolean b_orderDirAscDesc)

Create a VWChar.

Equal to VectorWrapper(b_addInOrder, b_orderDirAscDesc)


VWChar

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

Create a VWChar.

Equal to VectorWrapper(v_ector, b_addInOrder, b_orderDisAscDesc)

Note: It is expected that this Vector contain only chars (contained in Character objects).

Method Detail

add

public final void add(char c_har)

Add a char.

Parameters:
c_har - The char to add.

getInsertAddIdx

public final int getInsertAddIdx(char c_har)

Get the index at which to insert the provided char. This function is only meaningful when adding is ordered. See doAddInOrder.

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

Get the index at which the char actually exists.

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

doesExist

public final boolean doesExist(char c_har)

Was an char already added?

Parameters:
c_har - The char who's existence you want to test. May not be null.
Returns:
-1 If no char equalling c_har exists.
The array index at which the char is found.

addArray

public final void addArray(char[] a_char)

Add an array of chars.

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.

Parameters:
ap_char - The APChar, whose protected array should be add, via addArray. May not be null.

getChar

public final char getChar(int i_dx)

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

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

getString

public final String getString(int i_dx)
Description copied from class: VectorWrapper

Get the element at the requested index, as a string.

Overrides:
getString in class VectorWrapper
Following copied from class: xbn.array.VectorWrapper
Parameters:
i_dx - The Vector index to retrieve. 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.

getAOChar

public final char[] getAOChar()

getAOChar

public final char[] getAOChar(boolean b_sort)

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

Parameters:
b_sort - If true, then sort the array ascending before returning it (this is redundant when both doAddInOrder and getOrderDirAscDesc equal true). If false, then return the array as it currently exists.
Returns:
An array of chars, as added to this VWChar.

getVWCClone

public final VWChar getVWCClone()

Get a full (deep) copy of this VWChar.

Returns:
(VWChar)clone()

clone

protected final Object clone()
                      throws CloneNotSupportedException

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