xbn.array
Class VWDouble

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

public class VWDouble
extends VectorWrapper
implements Cloneable

A VectorWrapper for doubles.

Source code:  VWDouble.java.  Example code  XmplVWInt.java.


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
VWDouble()
          Create a VWDouble with default settings.
VWDouble(boolean b_orderDirAscDesc)
          Create a VWDouble.
VWDouble(boolean b_addInOrder, boolean b_orderDirAscDesc)
          Create a VWDouble.
VWDouble(Vector v_ector)
          Create a VWDouble.
VWDouble(Vector v_ector, boolean b_orderDirAscDesc)
          Create a VWDouble.
VWDouble(Vector v_ector, boolean b_addInOrder, boolean b_orderDirAscDesc)
          Create a VWDouble.
 
Method Summary
 void add(double d_ouble)
          Add an double.
 void addArray(double[] a_double)
          Add an array of doubles.
protected  Object clone()
          Get a full (deep) copy of this VWDouble as an Object.
 boolean doesExist(double d_ouble)
          Was an double already added?
 double[] getAODouble()
           
 double[] getAODouble(boolean b_sort)
          Get the array of doubles.
 double getDouble(int i_dx)
          Get an double from the vector, at the required array index.
 int getFoundIdx(double d_ouble)
          Get the index at which the double actually exists.
 int getInsertAddIdx(double d_ouble)
          Get the index at which to insert the provided double.
 String getString(int i_dx)
          Get the element at the requested index, as a string.
 VWDouble getVWIClone()
          Get a full (deep) copy of this VWDouble.
 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

VWDouble

public VWDouble()

Create a VWDouble with default settings.

Equal to VectorWrapper()


VWDouble

public VWDouble(Vector v_ector)

Create a VWDouble.

Equal to VectorWrapper(v_ector)

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


VWDouble

public VWDouble(boolean b_orderDirAscDesc)

Create a VWDouble.

Equal to VectorWrapper(b_orderDirAscDesc)


VWDouble

public VWDouble(Vector v_ector,
                boolean b_orderDirAscDesc)

Create a VWDouble.

Equal to VectorWrapper(v_ector, b_orderDirAscDesc)

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


VWDouble

public VWDouble(boolean b_addInOrder,
                boolean b_orderDirAscDesc)

Create a VWDouble.

Equal to VectorWrapper(b_addInOrder, b_orderDirAscDesc)


VWDouble

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

Create a VWDouble.

Equal to VectorWrapper(v_ector, b_addInOrder, b_orderDisAscDesc)

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

Method Detail

add

public final void add(double d_ouble)

Add an double.

Parameters:
d_ouble - The double to add.

getInsertAddIdx

public final int getInsertAddIdx(double d_ouble)

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

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

Get the index at which the double actually exists.

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

doesExist

public final boolean doesExist(double d_ouble)

Was an double already added?

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

addArray

public final void addArray(double[] a_double)

Add an array of doubles.

Parameters:
a_double - The double array to add. May not be null.

getDouble

public final double getDouble(int i_dx)

Get an double 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.

getAODouble

public final double[] getAODouble()

getAODouble

public final double[] getAODouble(boolean b_sort)

Get the array of doubles. This array is composed of all those doubles 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 doubles, as added to this VWDouble.

getVWIClone

public final VWDouble getVWIClone()

Get a full (deep) copy of this VWDouble.

Returns:
(VWDouble)clone()

clone

protected final Object clone()
                      throws CloneNotSupportedException

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