Apache Commons Math
Go to file
Tim O'Brien 7651a6b14d * ContractableDoubleArray extends ExpandableDoubleArray - I sense the
need for a DoubleArray interface.

* ExpandableDoubleArray and the extension ContractableDoubleArray should
aim towards presenting a public interface that does not expose any
details of the internal.  To this end, one is no longer able to get the
internal storage array via public double[] getValues(), and the startIndex
(which was relative to the internal storage array) is no longer available.

* [Expandable|Contractable]DoubleArray now allow one to discard
elements from the front of the array.  Before this commit, one could
accomplish the same goal by changing the starting index of the element
array within the internal storage array.  This solution allowed one to
discard elements from the front of the array (as well as) reclaiming
elements by decreases the startIndex.

There were two problems with this approach (especially in
ContractableDoubleArray).   The ContractableDoubleArray can be
"compacted" at anytime thereby reseting the startIndex to zero and the
size of the internal store array to number of elements plus one.  Second,
"reclaiming" elements from the internal storage array by finagling
internal "pointers" to the start and end index seems to violate the
principles of encapsulation.  If you "discard" an element from the
front of the array, consider it unavailable.

It should be noted that calling setNumElements allows one to move the end
index of the internal element array at will.  Assume one has a 100 element
array, and one calls setNumElements(10), thereby decreasing the ending index
of the element array by 90.  The 90 "dumped" elements are not currently
reinitializied to the default double primitive value.  This is an open
question.

* Tests for ExpandableDoubleArray and ContractableDoubleArray were
refactored.  both test classes now extend a DoubleArrayAbstractTest
JUnit class which contained shared unit tests for both "implementations".
An approach like this should be adopted to test the Univariate implementations.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140833 13f79535-47bb-0310-9956-ffa450edef68
2003-05-16 03:55:34 +00:00
src * ContractableDoubleArray extends ExpandableDoubleArray - I sense the 2003-05-16 03:55:34 +00:00
.cvsignore added new commons math component 2003-05-12 15:07:54 +00:00
PROPOSAL.html Added myself to STATUS and PROPOSAL 2003-05-12 20:32:26 +00:00
RELEASE-NOTES.txt added new commons math component 2003-05-12 15:07:54 +00:00
STATUS.html Submitted by: Phil S. 2003-05-15 05:47:51 +00:00
build.properties.sample added new commons math component 2003-05-12 15:07:54 +00:00
build.xml Starting source code - basic matrix operations and univarient stats plus test code. Submitted by Phil Steitz. 2003-05-12 19:04:38 +00:00
project.xml Made a nubmer of change to the ExpandableDoubleArray. 2003-05-15 15:38:48 +00:00