commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <p...@steitz.com>
Subject Re: [math] evaluate methods
Date Sun, 03 Oct 2004 12:02:02 GMT
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


Mime
View raw message