Author: erans Date: Fri Nov 12 21:22:34 2010 New Revision: 1034573 URL: http://svn.apache.org/viewvc?rev=1034573&view=rev Log: MATH-438 Removed deprecated methods.
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/FrequencyTest.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java?rev=1034573&r1=1034572&r2=1034573&view=diff ============================================================================== --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java Fri Nov 12 21:22:34 2010 @@ -105,29 +105,6 @@ public class Frequency implements Serial * </p> * * @param v the value to add. - * @throws IllegalArgumentException if <code>v</code> is not Comparable, - * or is not comparable with previous entries - * @deprecated use {...@link #addValue(Comparable)} instead - */ - @Deprecated - public void addValue(Object v) { - if (v instanceof Comparable<?>){ - addValue((Comparable<?>) v); - } else { - throw MathRuntimeException.createIllegalArgumentException( - LocalizedFormats.CLASS_DOESNT_IMPLEMENT_COMPARABLE, - v.getClass().getName()); - } - } - - /** - * Adds 1 to the frequency count for v. - * <p> - * If other objects have already been added to this Frequency, v must - * be comparable to those that have already been added. - * </p> - * - * @param v the value to add. * @throws IllegalArgumentException if <code>v</code> is not comparable with previous entries */ public void addValue(Comparable<?> v){ @@ -163,17 +140,6 @@ public class Frequency implements Serial * Adds 1 to the frequency count for v. * * @param v the value to add. - * @deprecated to be removed in math 3.0 - */ - @Deprecated - public void addValue(Integer v) { - addValue(Long.valueOf(v.longValue())); - } - - /** - * Adds 1 to the frequency count for v. - * - * @param v the value to add. */ public void addValue(long v) { addValue(Long.valueOf(v)); @@ -228,19 +194,6 @@ public class Frequency implements Serial * * @param v the value to lookup. * @return the frequency of v. - * @deprecated replaced by {...@link #getCount(Comparable)} as of 2.0 - */ - @Deprecated - public long getCount(Object v) { - return getCount((Comparable<?>) v); - } - - /** - * Returns the number of values = v. - * Returns 0 if the value is not comparable. - * - * @param v the value to lookup. - * @return the frequency of v. */ public long getCount(Comparable<?> v) { if (v instanceof Integer) { @@ -291,21 +244,6 @@ public class Frequency implements Serial //------------------------------------------------------------- /** - * Returns the percentage of values that are equal to v - * (as a proportion between 0 and 1). - * <p> - * Returns <code>Double.NaN</code> if no values have been added.</p> - * - * @param v the value to lookup - * @return the proportion of values equal to v - * @deprecated replaced by {...@link #getPct(Comparable)} as of 2.0 - */ - @Deprecated - public double getPct(Object v) { - return getPct((Comparable<?>) v); - } - - /** * Returns the percentage of values that are equal to v * (as a proportion between 0 and 1). * <p> @@ -364,20 +302,6 @@ public class Frequency implements Serial * * @param v the value to lookup. * @return the proportion of values equal to v - * @deprecated replaced by {...@link #getCumFreq(Comparable)} as of 2.0 - */ - @Deprecated - public long getCumFreq(Object v) { - return getCumFreq((Comparable<?>) v); - } - - /** - * Returns the cumulative frequency of values less than or equal to v. - * <p> - * Returns 0 if v is not comparable to the values set.</p> - * - * @param v the value to lookup. - * @return the proportion of values equal to v */ public long getCumFreq(Comparable<?> v) { if (getSumFreq() == 0) { @@ -470,24 +394,6 @@ public class Frequency implements Serial * * @param v the value to lookup * @return the proportion of values less than or equal to v - * @deprecated replaced by {...@link #getCumPct(Comparable)} as of 2.0 - */ - @Deprecated - public double getCumPct(Object v) { - return getCumPct((Comparable<?>) v); - - } - - /** - * Returns the cumulative percentage of values less than or equal to v - * (as a proportion between 0 and 1). - * <p> - * Returns <code>Double.NaN</code> if no values have been added. - * Returns 0 if at least one value has been added, but v is not comparable - * to the values set.</p> - * - * @param v the value to lookup - * @return the proportion of values less than or equal to v */ public double getCumPct(Comparable<?> v) { final long sumFreq = getSumFreq(); Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/FrequencyTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/FrequencyTest.java?rev=1034573&r1=1034572&r2=1034573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/FrequencyTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/FrequencyTest.java Fri Nov 12 21:22:34 2010 @@ -51,7 +51,6 @@ public final class FrequencyTest extends } /** test freq counts */ - @SuppressWarnings("deprecation") public void testCounts() { assertEquals("total count",0,f.getSumFreq()); f.addValue(oneL); @@ -125,7 +124,6 @@ public final class FrequencyTest extends } /** test pcts */ - @SuppressWarnings("deprecation") public void testPcts() { f.addValue(oneL); f.addValue(twoL); @@ -138,8 +136,6 @@ public final class FrequencyTest extends assertEquals("one pct",0.25,f.getPct(1),tolerance); assertEquals("two pct",0.25,f.getPct(Long.valueOf(2)),tolerance); assertEquals("three pct",0.5,f.getPct(threeL),tolerance); - // MATH-329 - assertEquals("three (Object) pct",0.5,f.getPct((Object) (Integer.valueOf(3))),tolerance); assertEquals("five pct",0,f.getPct(5),tolerance); assertEquals("foo pct",0,f.getPct("foo"),tolerance); assertEquals("one cum pct",0.25,f.getCumPct(1),tolerance); @@ -152,7 +148,6 @@ public final class FrequencyTest extends } /** test adding incomparable values */ - @SuppressWarnings("deprecation") public void testAdd() { char aChar = 'a'; char bChar = 'b'; @@ -186,23 +181,6 @@ public final class FrequencyTest extends } } - // Check what happens when non-Comparable objects are added - @SuppressWarnings("deprecation") - public void testAddNonComparable(){ - try { - f.addValue(new Object()); // This was previously OK - fail("Expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } - f.clear(); - f.addValue(1); - try { - f.addValue(new Object()); - fail("Expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } - } - /** test empty table */ public void testEmptyTable() { assertEquals("freq sum, empty table", 0, f.getSumFreq()); @@ -245,7 +223,7 @@ public final class FrequencyTest extends fail(ex.getMessage()); } } - @SuppressWarnings("deprecation") + public void testIntegerValues() { Comparable<?> obj1 = null; obj1 = Integer.valueOf(1);