Skip to content

Commit

Permalink
tighten rules for public/private/abstract/final/... modifiers
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@811786 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Luc Maisonobe committed Sep 6, 2009
1 parent fd5e4bf commit e837f7c
Show file tree
Hide file tree
Showing 44 changed files with 203 additions and 194 deletions.
6 changes: 4 additions & 2 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@
<property name="message" value="developers names should be in pom file"/>
</module>

<!-- Use a consistent way to put modifiers -->
<module name="RedundantModifier" />
<module name="ModifierOrder" />

<!--
<module name="DeclarationOrder" />
<module name="IllegalCatch" />
<module name="RedundantModifier" />
<module name="StringLiteralEquality" />
<module name="ModifierOrder" />
<module name="MultipleStringLiterals" />
<module name="MultipleVariableDeclarations" />
<module name="TodoComment" />
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/org/apache/commons/math/ConvergingAlgorithm.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public interface ConvergingAlgorithm {
*
* @param count maximum number of iterations
*/
public abstract void setMaximalIterationCount(int count);
void setMaximalIterationCount(int count);

/**
* Get the upper limit for the number of iterations.
*
* @return the actual upper limit
*/
public abstract int getMaximalIterationCount();
int getMaximalIterationCount();

/**
* Reset the upper limit for the number of iterations to the default.
Expand All @@ -57,7 +57,7 @@ public interface ConvergingAlgorithm {
*
* @see #setMaximalIterationCount(int)
*/
public abstract void resetMaximalIterationCount();
void resetMaximalIterationCount();

/**
* Set the absolute accuracy.
Expand All @@ -74,21 +74,21 @@ public interface ConvergingAlgorithm {
* @throws IllegalArgumentException if the accuracy can't be achieved by
* the solver or is otherwise deemed unreasonable.
*/
public abstract void setAbsoluteAccuracy(double accuracy);
void setAbsoluteAccuracy(double accuracy);

/**
* Get the actual absolute accuracy.
*
* @return the accuracy
*/
public abstract double getAbsoluteAccuracy();
double getAbsoluteAccuracy();

/**
* Reset the absolute accuracy to the default.
* <p>
* The default value is provided by the algorithm implementation.</p>
*/
public abstract void resetAbsoluteAccuracy();
void resetAbsoluteAccuracy();

/**
* Set the relative accuracy.
Expand All @@ -104,19 +104,19 @@ public interface ConvergingAlgorithm {
* @throws IllegalArgumentException if the accuracy can't be achieved by
* the algorithm or is otherwise deemed unreasonable.
*/
public abstract void setRelativeAccuracy(double accuracy);
void setRelativeAccuracy(double accuracy);

/**
* Get the actual relative accuracy.
* @return the accuracy
*/
public abstract double getRelativeAccuracy();
double getRelativeAccuracy();

/**
* Reset the relative accuracy to the default.
* The default value is provided by the algorithm implementation.
*/
public abstract void resetRelativeAccuracy();
void resetRelativeAccuracy();

/**
* Get the number of iterations in the last run of the algorithm.
Expand All @@ -131,6 +131,6 @@ public interface ConvergingAlgorithm {
* @throws IllegalStateException if there is no result available, either
* because no result was yet computed or the last attempt failed.
*/
public abstract int getIterationCount();
int getIterationCount();

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public interface DifferentiableUnivariateMatrixFunction
*
* @return the derivative function
*/
public UnivariateMatrixFunction derivative();
UnivariateMatrixFunction derivative();

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public interface DifferentiableUnivariateRealFunction
*
* @return the derivative function
*/
public UnivariateRealFunction derivative();
UnivariateRealFunction derivative();

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public interface DifferentiableUnivariateVectorialFunction
*
* @return the derivative function
*/
public UnivariateVectorialFunction derivative();
UnivariateVectorialFunction derivative();

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
* @since 2.0
*/
public interface UnivariateMatrixFunction {

/**
* Compute the value for the function.
* @param x the point for which the function value should be computed
* @return the value
* @throws FunctionEvaluationException if the function evaluation fails
*/
public double[][] value(double x) throws FunctionEvaluationException;
double[][] value(double x) throws FunctionEvaluationException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
* @version $Revision$ $Date$
*/
public interface UnivariateRealFunction {

/**
* Compute the value for the function.
* @param x the point for which the function value should be computed
* @return the value
* @throws FunctionEvaluationException if the function evaluation fails
*/
public double value(double x) throws FunctionEvaluationException;
double value(double x) throws FunctionEvaluationException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
* @since 2.0
*/
public interface UnivariateVectorialFunction {

/**
* Compute the value for the function.
* @param x the point for which the function value should be computed
* @return the value
* @throws FunctionEvaluationException if the function evaluation fails
*/
public double[] value(double x) throws FunctionEvaluationException;
double[] value(double x) throws FunctionEvaluationException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public interface UnivariateRealInterpolator {
* @throws MathException if arguments violate assumptions made by the
* interpolationg algorithm
*/
public UnivariateRealFunction interpolate(double xval[], double yval[])
UnivariateRealFunction interpolate(double xval[], double yval[])
throws MathException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public double cumulativeProbability(double x0, double x1)
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
abstract public double cumulativeProbability(int x) throws MathException;
public abstract double cumulativeProbability(int x) throws MathException;

/**
* For a random variable X whose values are distributed according
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,41 @@
* @version $Revision$ $Date$
*/
public interface HypergeometricDistribution extends IntegerDistribution {

/**
* Access the number of successes.
* @return the number of successes.
*/
public abstract int getNumberOfSuccesses();
int getNumberOfSuccesses();

/**
* Access the population size.
* @return the population size.
*/
public abstract int getPopulationSize();
int getPopulationSize();

/**
* Access the sample size.
* @return the sample size.
*/
public abstract int getSampleSize();
int getSampleSize();

/**
* Modify the number of successes.
* @param num the new number of successes.
*/
public abstract void setNumberOfSuccesses(int num);
void setNumberOfSuccesses(int num);

/**
* Modify the population size.
* @param size the new population size.
*/
public abstract void setPopulationSize(int size);
void setPopulationSize(int size);

/**
* Modify the sample size.
* @param size the new sample size.
*/
public abstract void setSampleSize(int size);
void setSampleSize(int size);

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public interface PoissonDistribution extends IntegerDistribution {
*
* @return the mean for the distribution.
*/
public double getMean();
double getMean();

/**
* Set the mean for the distribution.
Expand All @@ -48,7 +48,7 @@ public interface PoissonDistribution extends IntegerDistribution {
* @param p the mean
* @throws IllegalArgumentException if p &le; 0
*/
public void setMean(double p);
void setMean(double p);

/**
* Calculates the Poisson distribution function using a normal approximation.
Expand All @@ -57,5 +57,6 @@ public interface PoissonDistribution extends IntegerDistribution {
* @return the distribution function value calculated using a normal approximation
* @throws MathException if an error occurs computing the normal approximation
*/
public double normalApproximateProbability(int x) throws MathException;
double normalApproximateProbability(int x) throws MathException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@
* @version $Revision$ $Date$
*/
public interface ZipfDistribution extends IntegerDistribution {

/**
* Get the number of elements (e.g. corpus size) for the distribution.
*
* @return the number of elements
*/
public int getNumberOfElements();
int getNumberOfElements();

/**
* Set the number of elements (e.g. corpus size) for the distribution.
Expand All @@ -45,14 +46,14 @@ public interface ZipfDistribution extends IntegerDistribution {
* @param n the number of elements
* @throws IllegalArgumentException if n &le; 0
*/
public void setNumberOfElements(int n);
void setNumberOfElements(int n);

/**
* Get the exponent characterising the distribution.
*
* @return the exponent
*/
public double getExponent();
double getExponent();

/**
* Set the exponent characterising the distribution.
Expand All @@ -62,5 +63,6 @@ public interface ZipfDistribution extends IntegerDistribution {
* @param s the exponent
* @throws IllegalArgumentException if s &le; 0.0
*/
public void setExponent(double s);
void setExponent(double s);

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,23 @@
*/
@Deprecated
public interface EstimationProblem {
/**
* Get the measurements of an estimation problem.
* @return measurements
*/
public WeightedMeasurement[] getMeasurements();

/**
* Get the unbound parameters of the problem.
* @return unbound parameters
*/
public EstimatedParameter[] getUnboundParameters();
/**
* Get the measurements of an estimation problem.
* @return measurements
*/
WeightedMeasurement[] getMeasurements();

/**
* Get all the parameters of the problem.
* @return parameters
*/
public EstimatedParameter[] getAllParameters();
/**
* Get the unbound parameters of the problem.
* @return unbound parameters
*/
EstimatedParameter[] getUnboundParameters();

/**
* Get all the parameters of the problem.
* @return parameters
*/
EstimatedParameter[] getAllParameters();

}
11 changes: 4 additions & 7 deletions src/main/java/org/apache/commons/math/estimation/Estimator.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public interface Estimator {
* @exception EstimationException if the problem cannot be solved
*
*/
public void estimate(EstimationProblem problem)
throws EstimationException;
void estimate(EstimationProblem problem) throws EstimationException;

/**
* Get the Root Mean Square value.
Expand All @@ -68,7 +67,7 @@ public void estimate(EstimationProblem problem)
* @param problem estimation problem
* @return RMS value
*/
public double getRMS(EstimationProblem problem);
double getRMS(EstimationProblem problem);

/**
* Get the covariance matrix of estimated parameters.
Expand All @@ -77,8 +76,7 @@ public void estimate(EstimationProblem problem)
* @exception EstimationException if the covariance matrix
* cannot be computed (singular problem)
*/
public double[][] getCovariances(EstimationProblem problem)
throws EstimationException;
double[][] getCovariances(EstimationProblem problem) throws EstimationException;

/**
* Guess the errors in estimated parameters.
Expand All @@ -87,7 +85,6 @@ public double[][] getCovariances(EstimationProblem problem)
* @return errors in estimated parameters
* @exception EstimationException if the error cannot be guessed
*/
public double[] guessParametersErrors(EstimationProblem problem)
throws EstimationException;
double[] guessParametersErrors(EstimationProblem problem) throws EstimationException;

}
4 changes: 3 additions & 1 deletion src/main/java/org/apache/commons/math/genetics/Fitness.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
* @since 2.0
*/
public interface Fitness {

/**
* Compute the fitness. This is usually very time-consuming, so the value
* should be cached.
*
* @return fitness
*/
public double fitness();
double fitness();

}
Loading

0 comments on commit e837f7c

Please sign in to comment.