Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.math
Class MinMax<T extends Comparable<? super T>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.pairs.Pair<T,T>
      extended by de.lmu.ifi.dbs.elki.math.MinMax<T>

public class MinMax<T extends Comparable<? super T>>
extends Pair<T,T>

Class to find the minimum and maximum double values in data.

Author:
Erich Schubert

Nested Class Summary
 
Nested classes/interfaces inherited from class de.lmu.ifi.dbs.elki.utilities.pairs.Pair
Pair.Compare<FIRST,SECOND>, Pair.CompareByFirst<FIRST,SECOND>, Pair.CompareBySecond<FIRST,SECOND>, Pair.CompareSwapped<FIRST,SECOND>
 
Field Summary
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.pairs.Pair
first, second
 
Constructor Summary
MinMax()
          Constructor without starting values.
MinMax(T min, T max)
          Constructor with predefined minimum and maximum values.
 
Method Summary
 Object[] asArray()
          Return minimum and maximum as array.
 T getMax()
          Get the current maximum.
 T getMin()
          Get the current minimum.
 boolean isValid()
          Test if we have seen any data (and thus have a useful minimum and maximum).
 void put(Iterable<T> data)
          Process a whole collection of values.
 void put(SortedSet<T> data)
          Process a whole collection of values.
 void put(T data)
          Process a single value.
 void put(T[] data)
          Process a whole array of values.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.pairs.Pair
equals, getFirst, getSecond, hashCode, newArray, setFirst, setSecond, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MinMax

public MinMax()
Constructor without starting values. The minimum will be initialized to null. The maximum will be initialized to null.


MinMax

public MinMax(T min,
              T max)
Constructor with predefined minimum and maximum values.

Parameters:
min - Minimum value
max - Maximum value
Method Detail

put

public void put(T data)
Process a single value. If the new value is smaller than the current minimum, it will become the new minimum. If the new value is larger than the current maximum, it will become the new maximum.

Parameters:
data - New value

put

public void put(T[] data)
Process a whole array of values. If any of the values is smaller than the current minimum, it will become the new minimum. If any of the values is larger than the current maximum, it will become the new maximum.

Parameters:
data - Data to process

put

public void put(Iterable<T> data)
Process a whole collection of values. If any of the values is smaller than the current minimum, it will become the new minimum. If any of the values is larger than the current maximum, it will become the new maximum.

Parameters:
data - Data to process

put

public void put(SortedSet<T> data)
Process a whole collection of values. If any of the values is smaller than the current minimum, it will become the new minimum. If any of the values is larger than the current maximum, it will become the new maximum.

Parameters:
data - Data to process

getMin

public T getMin()
Get the current minimum.

Returns:
current minimum.

getMax

public T getMax()
Get the current maximum.

Returns:
current maximum.

isValid

public boolean isValid()
Test if we have seen any data (and thus have a useful minimum and maximum).

Returns:
true iff min != null and max != null.

asArray

public Object[] asArray()
Return minimum and maximum as array.

Returns:
Minimum, Maximum

Release 0.2.1 (2009-07-13_1605)