intermediate/DefiniteNumericCollection

From ggc

Jump to: navigation, search

01 package intermediate;
02 
03 public interface DefiniteNumericCollection
04 {
05   /**
06    * adds a number to the collection if it has a definite value.
07    * If the number does not have a definite value (e.g. NaN,
08    * POSITIVE_INFINITY, or NEGATIVE_INFINITY), this method should
09    return without adding the number.
10    @param number the numeric value to add
11    */
12   public void add(Number number);
13 
14   /**
15    * removes a number from the collection.
16    * If the number does not exist in the collection, 
17    * no exception is thrown and the method call is 
18    * just ignored.
19    @param number the number vaule to be removed
20    */
21   public void remove(Number number);
22 
23   /**
24    * gets the minimum value in the collection.
25    * This method should return Double.NaN when
26    * there are no items in the collection.
27    @return the least value in the collection
28    * or Double.NaN if there are no items.
29    */
30   public Number getMin();
31 
32   /**
33    * gets the maximum value in the collection.
34    * This method should return Double.NaN when
35    * there are no items in the collection.
36    @return the greatest value in the collection
37    * or Double.NaN if there are no items.
38    */
39   public Number getMax();
40 
41   /**
42    * gets the median value in the collection.
43    * The median value is the number where there
44    * are an equal count of elements less than and
45    * greater than the given number.  If there are
46    * If there is an even count, there will be two
47    * medians.  In this case the method returns the
48    * average of the two medians.
49    * This method should return Double.NaN when
50    * there are no items in the collection.
51    @return the greatest value in the collection
52    * or Double.NaN if there are no items.
53    */
54   public Number getMedian();
55   /**
56    * gets the average value in the collection.
57    * This method should return Double.NaN when
58    * there are no items in the collection.
59    @return the greatest value in the collection
60    * or Double.NaN if there are no items.
61    */
62   public Number getAverage();
63   /**
64    * removes all numbers from the collection.
65    */
66   public void clear();
67 }


Download/View intermediate/DefiniteNumericCollection.java





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter