org.abora.white.collection.arrays
Class PrimFloatArray

java.lang.Object
  |
  +--org.abora.white.xpp.basic.Heaper
        |
        +--org.abora.white.collection.arrays.PrimArray
              |
              +--org.abora.white.collection.arrays.PrimArithmeticArray
                    |
                    +--org.abora.white.collection.arrays.PrimFloatArray
Direct Known Subclasses:
IEEE32Array, IEEE64Array

public abstract class PrimFloatArray
extends PrimArithmeticArray

Fixed size array containing floating point numbers of the same precision.

The double primitive type is assumed to have the greatest precision stored by all subclass implementations and so is used to implement general floating-point implementations. Subclasses should reimplement operations for performance or where their specific element type has to be reflected in the API.

You should be aware that the methods defined at this level will often convert array element values into double primitive type before operating on the value. Sometimes when converting from float to double values values can subtely change. This may manifest in operations such as comparison producing unexpected results.


Constructor Summary
protected PrimFloatArray()
          Construct a new array.
 
Method Summary
protected  void addData(int start, PrimArithmeticArray other, int otherStart, int count)
          Arithmetic addition of the respective elements of other to this over the specified index range.
abstract  int bitCount()
          Return the maximum bits/entry that can be stored in this array.
protected  int compareData(int start, PrimArithmeticArray other, int otherStart, int count)
          Over given range, returns - if this < other; 0 if this == other; + if this > other.
 int elementsHash(int count, int start)
          A hash of the range of values out of the array.
abstract  double floatAt(int index)
          Return the floating point number at the specified index.
 int indexOf(Heaper value, int start, int nth)
          Return the index of the nth occurrence of the given value at or after (before if nth is negative) the given index, or -1 if there is none.
 int indexPast(Heaper value, int start, int nth)
          Return the index of the nth occurrence of anything but the given value at or after (before if nth is negative) the given index, or -1 if there is none.
abstract  void storeFloat(int index, double value)
          Store a floating point number at the specified index.
protected  void subtractData(int start, PrimArithmeticArray other, int otherStart, int count)
          Subtract the respective elements of other from this over the given index range.
protected  Heaper zeroElement()
          Return a suitable immutable zero element for this type of array; either 0 or null.
 
Methods inherited from class org.abora.white.collection.arrays.PrimArithmeticArray
addElements, addElements, addElements, compare, compare, compare, compare, contentsEqual, elementsEqual, signOfNonZeroAfter, subtractElements, subtractElements, subtractElements
 
Methods inherited from class org.abora.white.collection.arrays.PrimArray
contentsHash, copy, copy, copy, copy, copy, copyElements, copyGrow, count, elementsEqual, elementsEqual, elementsHash, elementsHash, fetchValue, getValue, indexOf, indexOf, indexOfElements, indexOfElements, indexOfElements, indexOfElements, indexOfElements, indexPast, indexPast, isEqual, makeNew, printElementOn, printOn, spec, storeAll, storeAll, storeAll, storeMany, storeMany, storeMany, storeValue, zeroElements, zeroElements, zeroElements
 
Methods inherited from class org.abora.white.xpp.basic.Heaper
actualHashForEqual, destroy, destruct, equals, hashForEqual, printContentsOn, sendSelfTo, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PrimFloatArray

protected PrimFloatArray()
Construct a new array.

Restrict public access to constructor; use suitable static factory method instead.

Method Detail

storeFloat

public abstract void storeFloat(int index,
                                double value)
Store a floating point number at the specified index.

Parameters:
index - 0 based index to store the value at.
value - value to store in array, may lose precision if array cant hold the full extent of it.

floatAt

public abstract double floatAt(int index)
Return the floating point number at the specified index.

Parameters:
index - 0 based index of this to read the number from.
Returns:
value at the specified index.

bitCount

public abstract int bitCount()
Return the maximum bits/entry that can be stored in this array.


elementsHash

public int elementsHash(int count,
                        int start)
Description copied from class: PrimArray
A hash of the range of values out of the array. If two ranges are elementsEqual, they will have the same hash. For data values, additional zeros on the end make no difference to the hash.

Specified by:
elementsHash in class PrimArray

compareData

protected int compareData(int start,
                          PrimArithmeticArray other,
                          int otherStart,
                          int count)
Description copied from class: PrimArithmeticArray
Over given range, returns - if this < other; 0 if this == other; + if this > other.

Overrides:
compareData in class PrimArithmeticArray

indexOf

public int indexOf(Heaper value,
                   int start,
                   int nth)
Description copied from class: PrimArray
Return the index of the nth occurrence of the given value at or after (before if nth is negative) the given index, or -1 if there is none.

Specified by:
indexOf in class PrimArray
Parameters:
value - element that is to be matched
start - index to start the search. If positive start from that index, if negative start from relatie to end of array
Returns:
index of element matched or -1 if there is none

indexPast

public int indexPast(Heaper value,
                     int start,
                     int nth)
Description copied from class: PrimArray
Return the index of the nth occurrence of anything but the given value at or after (before if nth is negative) the given index, or -1 if there is none.

Specified by:
indexPast in class PrimArray
Parameters:
value - anything except this element that is to be matched
start - index to start the search. If positive start from that index, if negative start from relatie to end of array
Returns:
index of element matched or -1 if there is none

zeroElement

protected Heaper zeroElement()
Description copied from class: PrimArray
Return a suitable immutable zero element for this type of array; either 0 or null.

Specified by:
zeroElement in class PrimArray
Returns:
zero element for this type of array

addData

protected void addData(int start,
                       PrimArithmeticArray other,
                       int otherStart,
                       int count)
Description copied from class: PrimArithmeticArray
Arithmetic addition of the respective elements of other to this over the specified index range.

Note that arithmetic overflows aren't faulted.

Subclasses should override.

Overrides:
addData in class PrimArithmeticArray

subtractData

protected void subtractData(int start,
                            PrimArithmeticArray other,
                            int otherStart,
                            int count)
Description copied from class: PrimArithmeticArray
Subtract the respective elements of other from this over the given index range.

Note that arithmetic overflows aren't faulted.

Subclasses should override.

Overrides:
subtractData in class PrimArithmeticArray


Copyright © 2003 David G Jones. All Rights Reserved.
Original Udanax-Gold - Copyright © 1979-1999 Udanax.com. All rights reserved.