commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rostislav Krasny (JIRA)" <>
Subject [jira] [Commented] (MATH-1307) Create a base class for all RNGs
Date Mon, 28 Dec 2015 17:15:49 GMT


Rostislav Krasny commented on MATH-1307:

Isn't there some naming convention? For example a {{HashMap}} implements a {{Map}} interface
and extends an {{AbstractMap}} class. And in CM3 we have a few classes with names starting
with BaseAbstract, for example {{BaseAbstractMultivariateOptimizer}}. And there are also many
(much more) classes with names startign with just Abstract, for example {{AbstractFieldMatrix}}.
Classes with names starting with BaseAbstract are superclasses of some other abstract classes.
For example the {{BaseAbstractMultivariateOptimizer}} is a superclass of {{AbstractScalarDifferentiableOptimizer}}.

> Create a base class for all RNGs
> --------------------------------
>                 Key: MATH-1307
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Minor
>              Labels: api, inheritance
>             Fix For: 4.0
>         Attachments:
> I proposed to create a base class which the existing abstract classes {{AbstractRandomGenerator}}
and {{BitsStreamGenerator}} will extend.
> This would allow to define {{nextBytes(byte[])}} at the base class level.
> The code for that method is almost identical in the two hierarchies: they only differ
in a call to either {{nextInt()}} or {{next(32)}} respectively; the latter is however the
same as the former, in disguise, and is not subject to change given the type of return value.
> As a corollary, the new base class can be the unique place where to add utilities such
as the one proposed in MATH-1306.
> *Update:* {{AbstractRandomGenerator}} and {{BitsStreamGenerator}} are both obsoleted
by the class proposed in this report.

This message was sent by Atlassian JIRA

View raw message