You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2012/09/08 00:35:02 UTC
svn commit: r1382197 - in
/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss:
BaseRuleFactory.java GaussIntegrator.java LegendreRuleFactory.java
Author: erans
Date: Fri Sep 7 22:35:01 2012
New Revision: 1382197
URL: http://svn.apache.org/viewvc?rev=1382197&view=rev
Log:
MATH-854
Populate "throws" clause.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegrator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreRuleFactory.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java?rev=1382197&r1=1382196&r2=1382197&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java Fri Sep 7 22:35:01 2012
@@ -20,6 +20,7 @@ import java.util.Map;
import java.util.TreeMap;
import org.apache.commons.math3.util.Pair;
import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.NotStrictlyPositiveException;
/**
* Base class for rules that determines the integration nodes and their
@@ -41,12 +42,15 @@ public abstract class BaseRuleFactory<T
= new TreeMap<Integer, Pair<double[], double[]>>();
/**
- * Gets a copy of the quadrature rule with given number of integration points.
+ * Gets a copy of the quadrature rule with the given number of integration
+ * points.
*
* @param numberOfPoints Number of integration points.
* @return a copy of the integration rule.
+ * @throws NotStrictlyPositiveException if {@code numberOfPoints < 1}.
*/
- public Pair<double[], double[]> getRule(int numberOfPoints) {
+ public Pair<double[], double[]> getRule(int numberOfPoints)
+ throws NotStrictlyPositiveException {
// Try to obtain the rule from the cache.
Pair<double[], double[]> cached = pointsAndWeightsDouble.get(numberOfPoints);
@@ -74,8 +78,10 @@ public abstract class BaseRuleFactory<T
*
* @param numberOfPoints Order of the rule to be retrieved.
* @return the points and weights corresponding to the given order.
+ * @throws NotStrictlyPositiveException if {@code numberOfPoints < 1}.
*/
- protected synchronized Pair<T[], T[]> getRuleInternal(int numberOfPoints) {
+ protected synchronized Pair<T[], T[]> getRuleInternal(int numberOfPoints)
+ throws NotStrictlyPositiveException {
final Pair<T[], T[]> rule = pointsAndWeights.get(numberOfPoints);
if (rule == null) {
addRule(computeRule(numberOfPoints));
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegrator.java?rev=1382197&r1=1382196&r2=1382197&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegrator.java Fri Sep 7 22:35:01 2012
@@ -18,6 +18,7 @@ package org.apache.commons.math3.analysi
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.NonMonotonicSequenceException;
import org.apache.commons.math3.util.MathArrays;
import org.apache.commons.math3.util.Pair;
@@ -42,11 +43,12 @@ public class GaussIntegrator {
*
* @param points Integration points.
* @param weights Weights of the corresponding integration nodes.
- * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
- * if the {@code points} are not sorted in increasing order.
+ * @throws NonMonotonicSequenceException if the {@code points} are not
+ * sorted in increasing order.
*/
public GaussIntegrator(double[] points,
- double[] weights) {
+ double[] weights)
+ throws NonMonotonicSequenceException {
if (points.length != weights.length) {
throw new DimensionMismatchException(points.length,
weights.length);
@@ -63,12 +65,13 @@ public class GaussIntegrator {
* the pair) and weights (second element of the pair.
*
* @param pointsAndWeights Integration points and corresponding weights.
- * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
- * if the {@code points} are not sorted in increasing order.
+ * @throws NonMonotonicSequenceException if the {@code points} are not
+ * sorted in increasing order.
*
* @see #GaussIntegrator(double[], double[])
*/
- public GaussIntegrator(Pair<double[], double[]> pointsAndWeights) {
+ public GaussIntegrator(Pair<double[], double[]> pointsAndWeights)
+ throws NonMonotonicSequenceException {
this(pointsAndWeights.getFirst(), pointsAndWeights.getSecond());
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreRuleFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreRuleFactory.java?rev=1382197&r1=1382196&r2=1382197&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreRuleFactory.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreRuleFactory.java Fri Sep 7 22:35:01 2012
@@ -34,11 +34,10 @@ import org.apache.commons.math3.exceptio
public class LegendreRuleFactory extends BaseRuleFactory<Double> {
/**
* {@inheritDoc}
- *
- * @throws NotStrictlyPositiveException if {@code numberOfPoints < 1}.
*/
@Override
- protected Pair<Double[], Double[]> computeRule(int numberOfPoints) {
+ protected Pair<Double[], Double[]> computeRule(int numberOfPoints)
+ throws NotStrictlyPositiveException {
if (numberOfPoints <= 0) {
throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS,
numberOfPoints);