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

Gilles commented on MATH-845:
-----------------------------

After a _very_ quick look at the code, some remarks about style:
* "if"-blocks must not be on the same line as the condition check, even if 
there is a single statement.
* There must be one space characted before an opening bracket.
* Closing brackets must be on the following line.
* "assert" statements should be replaced by precondition checks (raising an 
appropriate exception if they fail).

Design question:
Wouldn't it be useful to create an interface {{Primes<T extends Number>}} that 
would define all the methods to be implemented for each type (Integer, Long, 
BigInteger, ...)? Your "Primes" class then becomes
{code}
public class IntegerPrimes implements Primes<Integer> {
  // ...
}
{code}

Implementation (and performance) question: Is it useful to have this 
functionality for "int" rather than just for "long". I mean: Is the "int" 
implementation faster in any actual application?
If not, what would it take to convert all your proposed code to work with 
"long"?

                
> Basic number theory features such as primality testing, factorization and 
> prime number generation
> -------------------------------------------------------------------------------------------------
>
>                 Key: MATH-845
>                 URL: https://issues.apache.org/jira/browse/MATH-845
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.1
>         Environment: ubuntu/java6/intel-i5
>            Reporter: Sebastien Riou
>            Priority: Minor
>              Labels: features
>             Fix For: 3.1
>
>         Attachments: primes-src.zip
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> A set of static methods to perform primality test, factorization and prime 
> number generation. Currently it is limited to the int data type, extension to 
> long/BigInteger will follow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to