Documentation of 'com.yahoo.egads.data.WeightedValue' Java class
WeightedValue
com.yahoo.egads.data

Class WeightedValue

  • All Implemented Interfaces:
    java.lang.Comparable<WeightedValue>


    public class WeightedValue
    extends java.lang.Object
    implements java.lang.Comparable<WeightedValue>
    Class for holding a weighted value that can then be aggregated when stored in a list using various functions.
    • Constructor Summary

      Constructors 
      Constructor and Description
      WeightedValue(double value, int weight)
      Default ctor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static double aggregate(java.util.List<WeightedValue> values, java.lang.String agg)
      Aggregates the values in the list using the given agg function.
      int compareTo(WeightedValue other) 
      static void drop(java.util.List<WeightedValue> accumulator, int count, boolean highest)
      Drops as many of the highest or lowest values as possible, leaving at least one value in the list.
      double getValue() 
      int getWeight() 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WeightedValue

        public WeightedValue(double value,
                             int weight)
        Default ctor.
        Parameters:
        value - The value of the data point.
        weight - A weight for the data point.
    • Method Detail

      • compareTo

        public int compareTo(WeightedValue other)
        Specified by:
        compareTo in interface java.lang.Comparable<WeightedValue>
      • drop

        public static void drop(java.util.List<WeightedValue> accumulator,
                                int count,
                                boolean highest)
        Drops as many of the highest or lowest values as possible, leaving at least one value in the list.
        Parameters:
        accumulator - A non-null accumulator list.
        count - A count of 1 or more.
        highest - Drop higher values == true or drop lower values == false.
      • getValue

        public double getValue()
        Returns:
        The data point value.
      • getWeight

        public int getWeight()
        Returns:
        The weight for the data point.
      • aggregate

        public static double aggregate(java.util.List<WeightedValue> values,
                                       java.lang.String agg)
        Aggregates the values in the list using the given agg function. For all functions, NaNs are skipped so if an entire list is NaN'd or the list is empty, the results will be a NaN.
        Parameters:
        values - A non-null list of values to aggregate.
        agg - A non-null or empty aggregator function to use.
        Returns:
        An aggregated value or NaN.
        Throws:
        java.lang.IllegalArgumentException - if the values was null, agg was null or empty or we had an unimplemented agg function.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.