commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-894) Spurious method call in "ResizableDoubleArray" ("o.a.c.m.util")
Date Fri, 09 Nov 2012 15:46:11 GMT

    [ https://issues.apache.org/jira/browse/MATH-894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13494054#comment-13494054
] 

Gilles commented on MATH-894:
-----------------------------

Removed call to "contract()" in revision 1407485.

As part of this issue I'd also add a new method:
{code}
public int getCapacity() {
  return internalArray.length;
}
{code}
and deprecate the current "getInternalLength()" (which the doc says is there only for the
unit tests' sake). "getCapacity" is reminiscent of the argument passed to one of the "ArrayList"
constructors.

I'd also deprecate
{code}
public double[] getInternalValues() {
  return internalArray;
}
{code}
because it breaks encapsulation, making it possible to destroy the internal consistency of
the object.

Any objection?

                
> Spurious method call in "ResizableDoubleArray" ("o.a.c.m.util")
> ---------------------------------------------------------------
>
>                 Key: MATH-894
>                 URL: https://issues.apache.org/jira/browse/MATH-894
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.0
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Minor
>             Fix For: 3.1
>
>
> Method "addElement" should not call "contract()", as it will almost always make the storage
array shrink on the first call since it will be considered "too big" (for just storing one
element).
> See discussion about this change in MATH-757.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message