endrov.util.collection
Class EvListUtil

java.lang.Object
  extended by endrov.util.collection.EvListUtil

public class EvListUtil
extends java.lang.Object

Utility functions for lists


Constructor Summary
EvListUtil()
           
 
Method Summary
static
<B> EvDecimal
closestFrame(java.util.SortedMap<EvDecimal,B> imageLoader, EvDecimal frame)
          Find out the closest frame
static java.lang.Double findPercentileDouble(double[] list, double perc)
          Find percentile.
static java.lang.Integer findPercentileInt(int[] list, double perc)
          Find percentile.
static java.lang.Integer findPercentileInt(int[] list, double perc, int listLength)
          Find percentile.
static java.lang.Double findRankDouble(double[] list, int q)
          Find value of given rank q (=value at position q in sorted list).
static java.lang.Integer findRankInt(int[] list, int q)
          Find value of given rank q (=value at position q in sorted list).
static int getIndexOfMax(double[] t)
          Get index of element with largest value
static
<E,F extends java.lang.Comparable<F>>
E
getKeyOfMax(java.util.Map<E,F> t)
          Get key of element with largest value
static void main(java.lang.String[] args)
           
static
<A,B> java.util.List<Tuple<A,B>>
map2tuples(java.util.Map<A,B> map)
           
static double modalValue(double[] set)
          Find the modal (most common value)
static
<E,F> java.util.Collection<Tuple<E,F>>
productSet(java.util.Collection<E> a, java.util.Collection<F> b)
          Get the product set, given two sets
static double[] toDoubleArray(java.util.Collection<java.lang.Double> set)
          Convert to scalar array
static int[] toIntArray(java.util.Collection<java.lang.Integer> set)
          Convert to scalar array
static
<A,B> java.util.SortedMap<A,B>
tuples2map(java.util.List<Tuple<A,B>> list)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EvListUtil

public EvListUtil()
Method Detail

map2tuples

public static <A,B> java.util.List<Tuple<A,B>> map2tuples(java.util.Map<A,B> map)

tuples2map

public static <A,B> java.util.SortedMap<A,B> tuples2map(java.util.List<Tuple<A,B>> list)

closestFrame

public static <B> EvDecimal closestFrame(java.util.SortedMap<EvDecimal,B> imageLoader,
                                         EvDecimal frame)
Find out the closest frame


findPercentileInt

public static java.lang.Integer findPercentileInt(int[] list,
                                                  double perc)
Find percentile. q<-[0,1]. O(n)


findPercentileInt

public static java.lang.Integer findPercentileInt(int[] list,
                                                  double perc,
                                                  int listLength)
Find percentile. q<-[0,1]. O(n)


findRankInt

public static java.lang.Integer findRankInt(int[] list,
                                            int q)
Find value of given rank q (=value at position q in sorted list). O(n)


toDoubleArray

public static double[] toDoubleArray(java.util.Collection<java.lang.Double> set)
Convert to scalar array


toIntArray

public static int[] toIntArray(java.util.Collection<java.lang.Integer> set)
Convert to scalar array


findPercentileDouble

public static java.lang.Double findPercentileDouble(double[] list,
                                                    double perc)
Find percentile. q<-[0,1]. O(n)


findRankDouble

public static java.lang.Double findRankDouble(double[] list,
                                              int q)
Find value of given rank q (=value at position q in sorted list). O(n)


modalValue

public static double modalValue(double[] set)
Find the modal (most common value)


getIndexOfMax

public static int getIndexOfMax(double[] t)
Get index of element with largest value


getKeyOfMax

public static <E,F extends java.lang.Comparable<F>> E getKeyOfMax(java.util.Map<E,F> t)
Get key of element with largest value


productSet

public static <E,F> java.util.Collection<Tuple<E,F>> productSet(java.util.Collection<E> a,
                                                                java.util.Collection<F> b)
Get the product set, given two sets


main

public static void main(java.lang.String[] args)