MATH-438
Removed deprecated methods. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1034573 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b749a02ee1
commit
7c9c3017bb
|
@ -97,29 +97,6 @@ public class Frequency implements Serializable {
|
|||
return outBuffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
* 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>
|
||||
|
@ -159,17 +136,6 @@ public class Frequency implements Serializable {
|
|||
addValue(Long.valueOf(v));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
@ -222,19 +188,6 @@ public class Frequency implements Serializable {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @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.
|
||||
|
@ -290,21 +243,6 @@ public class Frequency implements Serializable {
|
|||
|
||||
//-------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 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).
|
||||
|
@ -357,20 +295,6 @@ public class Frequency implements Serializable {
|
|||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @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>
|
||||
|
@ -460,24 +384,6 @@ public class Frequency implements Serializable {
|
|||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @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).
|
||||
|
|
|
@ -51,7 +51,6 @@ public final class FrequencyTest extends TestCase {
|
|||
}
|
||||
|
||||
/** 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 TestCase {
|
|||
}
|
||||
|
||||
/** test pcts */
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testPcts() {
|
||||
f.addValue(oneL);
|
||||
f.addValue(twoL);
|
||||
|
@ -138,8 +136,6 @@ public final class FrequencyTest extends TestCase {
|
|||
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 TestCase {
|
|||
}
|
||||
|
||||
/** test adding incomparable values */
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testAdd() {
|
||||
char aChar = 'a';
|
||||
char bChar = 'b';
|
||||
|
@ -186,23 +181,6 @@ public final class FrequencyTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
// 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 TestCase {
|
|||
fail(ex.getMessage());
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
public void testIntegerValues() {
|
||||
Comparable<?> obj1 = null;
|
||||
obj1 = Integer.valueOf(1);
|
||||
|
|
Loading…
Reference in New Issue