xbn.array.primitive
Class PASAOObject

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.util.XBNLocked
              |
              +--xbn.array.primitive.PrimitiveArray
                    |
                    +--xbn.array.primitive.PrimitiveArrayString
                          |
                          +--xbn.array.primitive.PASAOObject
All Implemented Interfaces:
LockOneWay
Direct Known Subclasses:
PASNamed, PASString, PASStringBuffer, PASStringOrBuffer, UniqueStringPAS

public class PASAOObject
extends PrimitiveArrayString
implements LockOneWay

A PrimitiveArrayString that wraps around an array of java.lang.Objects. This class defines the string (see PrimitiveArray.getString) to be the Object's toString. Extend this class to make the string represent something else.

Source code:  PASAOObject.java.


Field Summary
static String sPASAOO
           
 
Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
PASAOObject()
          Create a PASAOObject with default values.
PASAOObject(Object[] a_object)
          Create a PASAOObject.
PASAOObject(Object[] a_object, boolean b_lock)
          Create a PASAOObject.
PASAOObject(Object[] a_object, PARString par_string)
          Create a PASAOObject.
PASAOObject(Object[] a_object, PARString par_string, boolean b_lock)
          Create a PASAOObject.
PASAOObject(String s_fqExtendingClass, Object[] a_object)
          Create a PASAOObject.
PASAOObject(String s_fqExtendingClass, Object[] a_object, boolean b_lock)
          Create a PASAOObject.
PASAOObject(String s_fqExtendingClass, Object[] a_object, PARString par_string)
          Create a PASAOObject.
PASAOObject(String s_fqExtendingClass, Object[] a_object, PARString par_string, boolean b_lock)
          Create an PASAOObject.
 
Method Summary
 void appendTSList(StringOrBuffer str_orBfr, String s_prefix, String s_divider, String s_postfix, String s_ifNull, String s_ifEmpty, String s_ifLmntNull)
          Get a new PASString representing the toStrings() of the internally-held array of Objects.
 Object[] getAOObject()
          Get the array of objects for direct manipulation.
 int getLength()
          How many strings exist in this PASAOObject?
 Object getObject(int i_dx)
          Get the object at the requested array index.
 PASNamed getPASNamed()
           
 PASString getPASString()
          Get a new PASString representing the internally-held array of Objects (as Strings).
 String getString(int i_dx)
          Get the toString of the requested element.
 boolean isLocked()
          Is the value locked?
 boolean isNull()
          Is the array of objects null?
 boolean isNull(int i_dx)
          Is the object at the requested array index null?
 void lock()
          Lock the value, forbidding further sets.
 
Methods inherited from class xbn.array.primitive.PrimitiveArrayString
areLmntsEqual, areLmntsEqual, getPARString, isValid
 
Methods inherited from class xbn.array.primitive.PrimitiveArray
areLmntsEqual, crashIfBad, crashIfBad, declareNoViolation, getFQClassName, getList, getList, getList, getList, getNewAOSOBString, getNewAOSOBStringBuffer, getNewAOString, getPAViolation, getPrimitiveArrayRule, getSOBString, getSOBStringBuffer, isValid, setPAViolation, throwAXIllegal, throwLmntsEqualAioobx, wasValidated
 
Methods inherited from class xbn.util.XBNLocked
throwLX, throwLX, throwLXIfLocked, throwLXIfLocked, throwLXIfLocked, throwLXIfUnlocked
 
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
 

Field Detail

sPASAOO

public static final String sPASAOO
Constructor Detail

PASAOObject

public PASAOObject()

Create a PASAOObject with default values.

Equal to PASAOObject(null)


PASAOObject

public PASAOObject(Object[] a_object)

Create a PASAOObject.

Equal to PASAOObject(sPASAOO, a_object)


PASAOObject

public PASAOObject(String s_fqExtendingClass,
                   Object[] a_object)

Create a PASAOObject.

Equal to PASAOObject(s_fqExtendingClass, a_object, (new PARString())))


PASAOObject

public PASAOObject(Object[] a_object,
                   PARString par_string)

Create a PASAOObject.

Equal to PASAOObject(sPASAOO, a_object, par_string)


PASAOObject

public PASAOObject(Object[] a_object,
                   boolean b_lock)

Create a PASAOObject.

Equal to PASAOObject(sPASAOO, a_object, (new PARString()), b_lock)


PASAOObject

public PASAOObject(Object[] a_object,
                   PARString par_string,
                   boolean b_lock)

Create a PASAOObject.

Equal to PASAOObject(sPASAOO, a_object, par_string, b_lock)


PASAOObject

public PASAOObject(String s_fqExtendingClass,
                   Object[] a_object,
                   PARString par_string)

Create a PASAOObject.

Equal to PASAOObject(s_fqExtendingClass, a_object, par_string, false)


PASAOObject

public PASAOObject(String s_fqExtendingClass,
                   Object[] a_object,
                   boolean b_lock)

Create a PASAOObject.

Equal to PASAOObject(s_fqExtendingClass, a_object, (new PARString()), b_lock)


PASAOObject

public PASAOObject(String s_fqExtendingClass,
                   Object[] a_object,
                   PARString par_string,
                   boolean b_lock)

Create an PASAOObject.

The first line of this constructor calls PrimitiveArrayChar(s_fqExtendingClass, par_string)

Parameters:
a_object - The array of Objects that should somehow appear like an array of strings.
b_lock - Should a_object be directly accessible, via getAOObject? If true, yes. If false, no. See lock and isLocked.
Method Detail

getLength

public final int getLength()

How many strings exist in this PASAOObject?

Overrides:
getLength in class PrimitiveArray
Throws:
AssertException - If isNull equals true.

getObject

public final Object getObject(int i_dx)

Get the object at the requested array index.

Parameters:
i_dx - The array index. Must range 0..[getLength() - 1], inclusive
Throws:
AssertException - If isNull equals true.

getAOObject

public final Object[] getAOObject()

Get the array of objects for direct manipulation.

Returns:
a_object Exactly as provided to the constructor.
Throws:
LockedException - If isLocked equals false.

isNull

public final boolean isNull()

Is the array of objects null?

Overrides:
isNull in class PrimitiveArray
Returns:
(a_object == null) where a_object is exactly as provided to the constructor.

isNull

public final boolean isNull(int i_dx)

Is the object at the requested array index null?

Overrides:
isNull in class PrimitiveArray
Parameters:
i_dx - The array index. Must range 0..[getLength() - 1], inclusive
Returns:
(a_object[i_dx] == null) where a_object is exactly as provided to the constructor.

getPASNamed

public final PASNamed getPASNamed()

getString

public String getString(int i_dx)

Get the toString of the requested element.

Overrides:
getString in class PrimitiveArray
Returns:
getObject(i_dx).toString()

getPASString

public final PASString getPASString()

Get a new PASString representing the internally-held array of Objects (as Strings).

Returns:
(new PASString((String[])[the internally-held array of Objects], isLocked()))

appendTSList

public final void appendTSList(StringOrBuffer str_orBfr,
                               String s_prefix,
                               String s_divider,
                               String s_postfix,
                               String s_ifNull,
                               String s_ifEmpty,
                               String s_ifLmntNull)

Get a new PASString representing the toStrings() of the internally-held array of Objects.

Equal to [UtilArray].appendTSList(str_orBfr, [the internally-held array of objects], s_prefix, s_divider, s_postfix, s_ifNull, s_ifEmpty, s_ifLmntNull)


lock

public final void lock()
Description copied from interface: LockOneWay

Lock the value, forbidding further sets. There is no way to unlock the value, so consider this function a "one way ticket".

It is recommended to crash if the value is already locked (isLocked is true). You must crash in your class' "set" functions when isLocked is true.

Specified by:
lock in interface LockOneWay
Following copied from interface: xbn.util.LockOneWay
Throws:
AssertException - If isLocked is true.

isLocked

public final boolean isLocked()
Description copied from interface: LockOneWay

Is the value locked?

Specified by:
isLocked in interface LockOneWay
Following copied from interface: xbn.util.LockOneWay
Returns:
true If lock has been called at some moment before now. This indicates that the value is locked and may no longer be altered.
false If lock has not yet been called. This indicates that the value may still be altered.



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