You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2012/09/09 03:47:34 UTC
svn commit: r1382389 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/Frequency.java
Author: psteitz
Date: Sun Sep 9 01:47:34 2012
New Revision: 1382389
URL: http://svn.apache.org/viewvc?rev=1382389&view=rev
Log:
Added missing throws declarations, suppressed warnings. JIRA: MATH-854.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/Frequency.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/Frequency.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/Frequency.java?rev=1382389&r1=1382388&r2=1382389&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/Frequency.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/Frequency.java Sun Sep 9 01:47:34 2012
@@ -131,8 +131,10 @@ public class Frequency implements Serial
* Adds 1 to the frequency count for v.
*
* @param v the value to add.
+ * @throws MathIllegalArgumentException if the table contains entries not
+ * comparable to Integer
*/
- public void addValue(int v) {
+ public void addValue(int v) throws MathIllegalArgumentException {
addValue(Long.valueOf(v));
}
@@ -140,8 +142,10 @@ public class Frequency implements Serial
* Adds 1 to the frequency count for v.
*
* @param v the value to add.
+ * @throws MathIllegalArgumentException if the table contains entries not
+ * comparable to Long
*/
- public void addValue(long v) {
+ public void addValue(long v) throws MathIllegalArgumentException {
addValue(Long.valueOf(v));
}
@@ -149,8 +153,10 @@ public class Frequency implements Serial
* Adds 1 to the frequency count for v.
*
* @param v the value to add.
+ * @throws MathIllegalArgumentException if the table contains entries not
+ * comparable to Char
*/
- public void addValue(char v) {
+ public void addValue(char v) throws MathIllegalArgumentException {
addValue(Character.valueOf(v));
}
@@ -311,6 +317,7 @@ public class Frequency implements Serial
* @param v the value to lookup.
* @return the proportion of values equal to v
*/
+ @SuppressWarnings({ "rawtypes", "unchecked" })
public long getCumFreq(Comparable<?> v) {
if (getSumFreq() == 0) {
return 0;
@@ -318,7 +325,6 @@ public class Frequency implements Serial
if (v instanceof Integer) {
return getCumFreq(((Integer) v).longValue());
}
- @SuppressWarnings("unchecked") // OK, freqTable is Comparable<?>
Comparator<Comparable<?>> c = (Comparator<Comparable<?>>) freqTable.comparator();
if (c == null) {
c = new NaturalComparator();