commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r1540498 - in /commons/proper/math/trunk/src: changes/ main/java/org/apache/commons/math3/exception/ main/java/org/apache/commons/math3/exception/util/ main/resources/assets/org/apache/commons/math3/exception/util/ test/java/org/apache/comm...
Date Sun, 10 Nov 2013 17:45:39 GMT
Author: psteitz
Date: Sun Nov 10 17:45:38 2013
New Revision: 1540498

URL: http://svn.apache.org/r1540498
Log:
Added InsufficientDataException.  JIRA: MATH-1061

Added:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/InsufficientDataException.java
  (with props)
Modified:
    commons/proper/math/trunk/src/changes/changes.xml
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java
    commons/proper/math/trunk/src/main/resources/assets/org/apache/commons/math3/exception/util/LocalizedFormats_fr.properties
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/exception/util/LocalizedFormatsTest.java

Modified: commons/proper/math/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/changes/changes.xml?rev=1540498&r1=1540497&r2=1540498&view=diff
==============================================================================
--- commons/proper/math/trunk/src/changes/changes.xml (original)
+++ commons/proper/math/trunk/src/changes/changes.xml Sun Nov 10 17:45:38 2013
@@ -51,6 +51,9 @@ If the output is not quite correct, chec
   </properties>
   <body>
     <release version="3.3" date="TBD" description="TBD">
+      <action dev="psteitz" type="add" issue="MATH-1061>
+        Added InsufficientDataException.
+      </action>
       <action dev="psteitz" type="fix" issue="MATH-1056" due-to="Sean Owen">
         Fixed unintended integer division error in PoissonDistribution sampling method.
       </action>

Added: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/InsufficientDataException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/InsufficientDataException.java?rev=1540498&view=auto
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/InsufficientDataException.java
(added)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/InsufficientDataException.java
Sun Nov 10 17:45:38 2013
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math3.exception;
+
+import org.apache.commons.math3.exception.util.Localizable;
+import org.apache.commons.math3.exception.util.LocalizedFormats;
+
+/**
+ * Exception to be thrown when there is insufficient data to perform a computation.
+ *
+ * @since 3.3
+ * @version $Id$
+ */
+public class InsufficientDataException
+    extends MathIllegalArgumentException {
+
+    /** Serializable version Id. */
+    private static final long serialVersionUID = -2629324471511903359L;
+
+    /**
+     * Construct the exception.
+     */
+    public InsufficientDataException() {
+        this(LocalizedFormats.INSUFFICIENT_DATA);
+    }
+
+    /**
+     * Construct the exception with a specific context.
+     *
+     * @param pattern Message pattern providing the specific context of the error.
+     * @param arguments Values for replacing the placeholders in {@code pattern}.
+     */
+    public InsufficientDataException(Localizable pattern, Object... arguments) {
+        super(pattern, arguments);
+    }
+}

Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/InsufficientDataException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/InsufficientDataException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java?rev=1540498&r1=1540497&r2=1540498&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java
Sun Nov 10 17:45:38 2013
@@ -130,6 +130,7 @@ public enum LocalizedFormats implements 
     @Deprecated
     INPUT_DATA_FROM_UNSUPPORTED_DATASOURCE("input data comes from unsupported datasource:
{0}, supported sources: {1}, {2}"),
     INSTANCES_NOT_COMPARABLE_TO_EXISTING_VALUES("instance of class {0} not comparable to
existing values"),
+    INSUFFICIENT_DATA("insufficient data"),
     INSUFFICIENT_DATA_FOR_T_STATISTIC("insufficient data for t statistic, needs at least
2, got {0}"),
     INSUFFICIENT_DIMENSION("insufficient dimension {0}, must be at least {1}"),
     DIMENSION("dimension ({0})"), /* keep */

Modified: commons/proper/math/trunk/src/main/resources/assets/org/apache/commons/math3/exception/util/LocalizedFormats_fr.properties
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/resources/assets/org/apache/commons/math3/exception/util/LocalizedFormats_fr.properties?rev=1540498&r1=1540497&r2=1540498&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/resources/assets/org/apache/commons/math3/exception/util/LocalizedFormats_fr.properties
(original)
+++ commons/proper/math/trunk/src/main/resources/assets/org/apache/commons/math3/exception/util/LocalizedFormats_fr.properties
Sun Nov 10 17:45:38 2013
@@ -101,6 +101,7 @@ INITIAL_COLUMN_AFTER_FINAL_COLUMN = colo
 INITIAL_ROW_AFTER_FINAL_ROW = ligne initiale {1} apr\u00e8s la ligne finale {0}
 INPUT_DATA_FROM_UNSUPPORTED_DATASOURCE = les donn\u00e9es d''entr\u00e9e proviennent d''une
source non prise en compte : {0}, sources prises en comptes : {1}, {2}
 INSTANCES_NOT_COMPARABLE_TO_EXISTING_VALUES = l''instance de la classe {0} n''est pas comparable
aux valeurs existantes
+INSUFFICIENT_DATA = donn\u00e9es insuffisantes
 INSUFFICIENT_DATA_FOR_T_STATISTIC = deux valeurs ou plus sont n\u00e9cessaires pour la statistique
t, il y en a {0}
 INSUFFICIENT_DIMENSION = dimension {0} insuffisante, elle devrait \u00eatre au moins {1}
 DIMENSION = dimension ({0})

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/exception/util/LocalizedFormatsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/exception/util/LocalizedFormatsTest.java?rev=1540498&r1=1540497&r2=1540498&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/exception/util/LocalizedFormatsTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/exception/util/LocalizedFormatsTest.java
Sun Nov 10 17:45:38 2013
@@ -30,7 +30,7 @@ public class LocalizedFormatsTest {
 
     @Test
     public void testMessageNumber() {
-        Assert.assertEquals(315, LocalizedFormats.values().length);
+        Assert.assertEquals(316, LocalizedFormats.values().length);
     }
 
     @Test



Mime
View raw message