org.abora.white.collection.arrays
Class PrimArithmeticArray

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

public abstract class PrimArithmeticArray
extends PrimArray

A common superclass for primitive arrays of arithmetic values such as floats and integers.


Constructor Summary
protected PrimArithmeticArray()
          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.
 void addElements(int to, PrimArithmeticArray other)
          Arithmetic addition of the respective elements of other to this over the index range
 void addElements(int to, PrimArithmeticArray other, int count)
          Arithmetic addition of the respective elements of other to this over the specified index range.
 void addElements(int to, PrimArithmeticArray other, int count, int from)
          Arithmetic addition of the respective elements of other to this over the specified index range.
 int compare(PrimArithmeticArray other)
           
 int compare(PrimArithmeticArray other, int count)
           
 int compare(PrimArithmeticArray other, int count, int here)
           
 int compare(PrimArithmeticArray other, int count, int here, int there)
          Return -1, 0, or +1 according to whether the elements in the specified span of this array are lexically less than, equal to, or greater than the specified span of the other.
protected  int compareData(int myStart, PrimArithmeticArray other, int otherStart, int count)
          Over given range, returns - if this < other; 0 if this == other; + if this > other.
 boolean contentsEqual(PrimArray other)
          Whether the two ranges contain semantically the same values.
 boolean elementsEqual(int here, PrimArray other, int there, int count)
          Whether the two ranges contain the same values, using the criteria defined in contentsEqual
protected abstract  int signOfNonZeroAfter(int start)
          Return the sign, -1 or +1, of the next non-zero element after start, or 0 if no such element.
protected  void subtractData(int myStart, PrimArithmeticArray other, int otherStart, int count)
          Subtract the respective elements of other from this over the given index range.
 void subtractElements(int to, PrimArithmeticArray other)
          Arithmetic subtraction of the respective elements of other from this over the specified index range.
 void subtractElements(int to, PrimArithmeticArray other, int count)
          Arithmetic subtraction of the respective elements of other from this over the specified index range.
 void subtractElements(int to, PrimArithmeticArray other, int count, int from)
          Arithmetic subtraction of the respective elements of other from this over the specified index range.
 
Methods inherited from class org.abora.white.collection.arrays.PrimArray
contentsHash, copy, copy, copy, copy, copy, copyElements, copyGrow, count, elementsEqual, elementsEqual, elementsHash, elementsHash, elementsHash, fetchValue, getValue, indexOf, indexOf, indexOf, indexOfElements, indexOfElements, indexOfElements, indexOfElements, indexOfElements, indexPast, indexPast, indexPast, isEqual, makeNew, printElementOn, printOn, spec, storeAll, storeAll, storeAll, storeMany, storeMany, storeMany, storeValue, zeroElement, 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

PrimArithmeticArray

protected PrimArithmeticArray()
Construct a new array. Restrict public access to constructor; use suitable static factory method instead.

Method Detail

addElements

public void addElements(int to,
                        PrimArithmeticArray other,
                        int count,
                        int from)
Arithmetic addition of the respective elements of other to this over the specified index range.

Note that arithmetic overflows aren't faulted.

Parameters:
to - first index of receiver to be included
other - other elements to be added to the receivers elements
count - number of elements from the other array included in range, or -1 for all others elements starting at from and after. Fail if count is greater than number of elements in range.
from - first index of the other array to be included in the range

addElements

public void addElements(int to,
                        PrimArithmeticArray other,
                        int count)
Arithmetic addition of the respective elements of other to this over the specified index range. Others index range starts from its first element.

Parameters:
to - first index of receiver to be included
other - other elements to be added to the receivers elements
count - number of elements from the other array included in range, or -1 for all of others elements starting at from and after. Fail if count is greater than number of elements in range.

addElements

public void addElements(int to,
                        PrimArithmeticArray other)
Arithmetic addition of the respective elements of other to this over the index range

Parameters:
to - first index of receiver to be included
other - other elements to be added to the receivers elements

addData

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.

Note that arithmetic overflows aren't faulted.

Subclasses should override.


subtractElements

public void subtractElements(int to,
                             PrimArithmeticArray other,
                             int count,
                             int from)
Arithmetic subtraction of the respective elements of other from this over the specified index range.

Note that arithmetic overflows aren't faulted.

Parameters:
to - first index of receiver to be included
other - other elements to be subtracted from the receivers elements
count - number of elements from the other array included in range, or -1 for all of others elements starting at from and after. Fail if count is greater than number of elements in range.
from - first index of the other array to be included

subtractElements

public void subtractElements(int to,
                             PrimArithmeticArray other,
                             int count)
Arithmetic subtraction of the respective elements of other from this over the specified index range. Others index range starts from its first element.

Parameters:
to - first index of receiver to be included
other - other elements to be subtracted from the receivers elements
count - number of elements from the other array included in range, or -1 for all of others elements starting at from and after. Fail if count is greater than number of elements in range.

subtractElements

public void subtractElements(int to,
                             PrimArithmeticArray other)
Arithmetic subtraction of the respective elements of other from this over the specified index range.

Parameters:
to - first index of receiver to be included
other - other elements to be subtracted from the receivers elements

subtractData

protected void subtractData(int myStart,
                            PrimArithmeticArray other,
                            int otherStart,
                            int count)
Subtract the respective elements of other from this over the given index range.

Note that arithmetic overflows aren't faulted.

Subclasses should override.


compare

public int compare(PrimArithmeticArray other,
                   int count,
                   int here,
                   int there)
Return -1, 0, or +1 according to whether the elements in the specified span of this array are lexically less than, equal to, or greater than the specified span of the other. The other array must be of a compatible type. If the count is negative or goes beyond the end of either array, then the shorter array is considered to be extended with zeros.

NOTE: Because of zero extension, this is not the same as elementsEqual; it is possible that a->compare (b) == 0 even though ! a->contentsEqual (b)

Parameters:
other - elements to compare the receivers elements against
count - number of elements in span to consider, or -1 for all elements after here and there. Zero elements are used to extend if there are insufficient elements in either array to fullfill the count.
here - inclusive start index of the receivers span
there - inclusive start index of the other arrays span

compare

public int compare(PrimArithmeticArray other,
                   int count,
                   int here)

compare

public int compare(PrimArithmeticArray other,
                   int count)

compare

public int compare(PrimArithmeticArray other)

signOfNonZeroAfter

protected abstract int signOfNonZeroAfter(int start)
Return the sign, -1 or +1, of the next non-zero element after start, or 0 if no such element. Note that for the unsigned arrays, this will only return 0 or 1.


contentsEqual

public boolean contentsEqual(PrimArray other)
Description copied from class: PrimArray
Whether the two ranges contain semantically the same values. Two non-NULL pointers match iff the Heapers they point to are isEqual. Two integers match iff they have the same value, even though they may be represented as different sizes. Two floats likewise.

Specified by:
contentsEqual in class PrimArray

elementsEqual

public boolean elementsEqual(int here,
                             PrimArray other,
                             int there,
                             int count)
Description copied from class: PrimArray
Whether the two ranges contain the same values, using the criteria defined in contentsEqual

Specified by:
elementsEqual in class PrimArray

compareData

protected int compareData(int myStart,
                          PrimArithmeticArray other,
                          int otherStart,
                          int count)
Over given range, returns - if this < other; 0 if this == other; + if this > other.



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