From 058ff00332fdb3b1e3db82db10ff8e5864ca4f02 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Sun, 14 Mar 2010 02:15:01 +0000 Subject: [PATCH] Raw types documentation git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@922722 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/commons/math/stat/Frequency.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/math/stat/Frequency.java b/src/main/java/org/apache/commons/math/stat/Frequency.java index 56edb0046..da31c0965 100644 --- a/src/main/java/org/apache/commons/math/stat/Frequency.java +++ b/src/main/java/org/apache/commons/math/stat/Frequency.java @@ -65,7 +65,7 @@ public class Frequency implements Serializable { * * @param comparator Comparator used to order values */ - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") // TODO is the cast OK? public Frequency(Comparator comparator) { freqTable = new TreeMap, Long>((Comparator>) comparator); } @@ -378,14 +378,14 @@ public class Frequency implements Serializable { * @param v the value to lookup. * @return the proportion of values equal to v */ - @SuppressWarnings("unchecked") - public long getCumFreq(Comparable v) { + public long getCumFreq(Comparable v) { if (getSumFreq() == 0) { return 0; } if (v instanceof Integer) { return getCumFreq(((Integer) v).longValue()); } + @SuppressWarnings("unchecked") // OK, freqTable is Comparable Comparator> c = (Comparator>) freqTable.comparator(); if (c == null) { c = new NaturalComparator(); @@ -557,7 +557,7 @@ public class Frequency implements Serializable { * @throws ClassCastException when o1 is not a {@link Comparable Comparable}, * or when ((Comparable)o1).compareTo(o2) does */ - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") // cast to (T) may throw ClassCastException, see Javadoc public int compare(Comparable o1, Comparable o2) { return o1.compareTo((T) o2); } @@ -578,8 +578,6 @@ public class Frequency implements Serializable { public boolean equals(Object obj) { if (this == obj) return true; - if (obj == null) - return false; if (!(obj instanceof Frequency)) return false; Frequency other = (Frequency) obj;