You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Kim van der Linde <ki...@kimvdlinde.com> on 2004/10/03 04:59:47 UTC
[math] evaluate methods
Hi All,
I have a question. All evaluate methods are non-static, but they do not
depend on information stored already in the class. That would suggest
for me to make them static.... So, I guess that there is a compelling
reason not to do that, but one that I do not know.... Can anyone
enlighten me?
Cheers,
Kim
--
http://www.kimvdlinde.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] evaluate methods
Posted by Phil Steitz <ph...@steitz.com>.
Kim van der Linde wrote:
> Ok, my question then becomes: why this structure?
>
> Cheers,
> Kim
>
Probably the best answer here is "browse the archives." Here are a couple
of relevant threads:
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=commons-dev@jakarta.apache.org&msgId=756204
http://nagoya.apache.org/eyebrowse/BrowseList?listName=commons-dev@jakarta.apache.org&by=thread&from=370577
http://nagoya.apache.org/eyebrowse/BrowseList?listName=commons-dev@jakarta.apache.org&by=thread&from=371235
Suffice it to say that we decided to trade off the speed gains (which
benchmarks actually showed were not really that big) from implementing
array-based statistics in static methods for the flexibility /
extensibility provided by the current setup.
Phil
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] evaluate methods
Posted by Kim van der Linde <ki...@kimvdlinde.com>.
Ok, my question then becomes: why this structure?
Cheers,
Kim
Phil Steitz wrote:
> Kim van der Linde wrote:
>
>> Hi All,
>>
>> I have a question. All evaluate methods are non-static, but they do
>> not depend on information stored already in the class. That would
>> suggest for me to make them static.... So, I guess that there is a
>> compelling reason not to do that, but one that I do not know.... Can
>> anyone enlighten me?
>
>
> You are right that conceptually these methods could be static (at least
> from the API contract standpoint). They are not static, however, because
> static methods cannot be overridden in Java (just "hidden") and the
> evaluate methods are designed to be overridden. Evaluate is declared as
> abstract in the base class AbstractUnivariateStatistic and also provided
> with a default implementation in AbstractStorelessUnivariateStatistic.
> The default impl uses the non-static incrementAll method (which actually
> does change the state of the instance), so it can't be static in any case.
>
> Phil
>
>>
>> Cheers,
>>
>> Kim
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
--
http://www.kimvdlinde.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] evaluate methods
Posted by Phil Steitz <ph...@steitz.com>.
Kim van der Linde wrote:
> Hi All,
>
> I have a question. All evaluate methods are non-static, but they do not
> depend on information stored already in the class. That would suggest
> for me to make them static.... So, I guess that there is a compelling
> reason not to do that, but one that I do not know.... Can anyone
> enlighten me?
You are right that conceptually these methods could be static (at least
from the API contract standpoint). They are not static, however, because
static methods cannot be overridden in Java (just "hidden") and the
evaluate methods are designed to be overridden. Evaluate is declared as
abstract in the base class AbstractUnivariateStatistic and also provided
with a default implementation in AbstractStorelessUnivariateStatistic. The
default impl uses the non-static incrementAll method (which actually does
change the state of the instance), so it can't be static in any case.
Phil
>
> Cheers,
>
> Kim
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org