xbn.array
Class APChar

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.array.ArrayProtector
              |
              +--xbn.array.APChar
All Implemented Interfaces:
Cloneable

public class APChar
extends ArrayProtector

An ArrayProtector for chars.

Source code:  APChar.java


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
APChar(char[] a_char)
          Create an APChar.
APChar(char[] a_char, boolean b_cloneAOC)
          Create an APChar.
 
Method Summary
 void addToACChar(VWChar ac_char)
          Add the char-array-being-protected to the provided VWChar.
 int binarySearch(char c_har)
          Return the array index at which the provided character exists.
protected  Object clone()
          Get a full (deep) copy of this APChar as an Object.
 boolean doesExistInSrtd(char c_har)
          Does the provided character exist in the sorted char-array-being-protected?
 char[] getAOCClone()
          Get a full (deep) copy of the char-array-being-wrapped.
 APChar getAPCClone()
          Get a full (deep) copy of this APChar.
 char getChar(int i_dx)
          Get the char at the requested array index.
 int getLength()
          How many elements exist in the array-being-protected?
 PACChar getPACChar()
          Get a new PACChar wrapping around the char-array-being-protected.
 String getString(int i_dx)
           
 boolean isNull()
          As a whole, is the array-being-protected null?
 boolean isNull(int i_dx)
           
 String toString()
          Get some information about this ArrayProtector.
 
Methods inherited from class xbn.array.ArrayProtector
getList, getList, getList, getList, getPASArrayProtector
 
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, wait, wait, wait
 

Constructor Detail

APChar

public APChar(char[] a_char)

Create an APChar.


APChar

public APChar(char[] a_char,
              boolean b_cloneAOC)

Create an APChar.

Method Detail

isNull

public final boolean isNull()
Description copied from class: ArrayProtector

As a whole, is the array-being-protected null?

Overrides:
isNull in class ArrayProtector
Returns:
(a_char == null) Where a_char is exactly as provided to the constructor.

getLength

public final int getLength()
Description copied from class: ArrayProtector

How many elements exist in the array-being-protected?

Overrides:
getLength in class ArrayProtector
Returns:
a_char.length Where a_char is exactly as provided to the constructor.
Throws:
AssertException - If isNull is true.

getChar

public final char getChar(int i_dx)

Get the char at the requested array index.

Returns:
a_char[i_dx] Where a_char is exactly as provided to the constructor.

getString

public final String getString(int i_dx)
Overrides:
getString in class ArrayProtector

isNull

public final boolean isNull(int i_dx)
Overrides:
isNull in class ArrayProtector

doesExistInSrtd

public final boolean doesExistInSrtd(char c_har)

Does the provided character exist in the sorted char-array-being-protected?

Returns:
(binarySearch(c_har) > -1)

binarySearch

public final int binarySearch(char c_har)

Return the array index at which the provided character exists.

You must ensure that the a_char constructor parameter is properly sorted. Otherwise this function provides unpredictable results

Returns:
Arrays.binarySearch([CHAR-ARRAY-BEING-PROTECTED], c_har)
Throws:
AssertException - If isNull equals true.

addToACChar

public final void addToACChar(VWChar ac_char)

Add the char-array-being-protected to the provided VWChar.

If isNull equals true, nothing is done. If false, then ac_char.addArray([INTERNAL CHAR ARRAY]) is called.

Parameters:
ac_char - The VWChar to add to. May not be null.

getAOCClone

public final char[] getAOCClone()

Get a full (deep) copy of the char-array-being-wrapped.

Returns:
(new UtilArray()).getAOCClone(a_char) Where a_char is exactly as provided to the constructor. Note that this function only creates the clone once. Once created, the copy is then internally stored, and returned for all subsequent calls.

getPACChar

public final PACChar getPACChar()

Get a new PACChar wrapping around the char-array-being-protected.

Returns:
(new PACChar(getAOCClone(), true))

getAPCClone

public final APChar getAPCClone()

Get a full (deep) copy of this APChar.

Returns:
(APChar)clone()

clone

protected final Object clone()
                      throws CloneNotSupportedException

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

Overrides:
clone in class Object

toString

public String toString()
Description copied from class: ArrayProtector

Get some information about this ArrayProtector.

Overrides:
toString in class ArrayProtector



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