org.apache.solr.analytics.statistics

## Class MinMaxStatsCollector

- java.lang.Object
- - org.apache.solr.analytics.statistics.MinMaxStatsCollector

- All Implemented Interfaces:
    StatsCollector
  Direct Known Subclasses:
    NumericStatsCollector

      public class MinMaxStatsCollector
      extends Object
      implements StatsCollector

  `MinMaxStatsCollector` computes the min, max, number of values and number of missing values.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected FunctionValues` | `function`
    `protected MutableValue` | `max`
    `protected MutableValue` | `min`
    `protected long` | `missingCount`
    `protected ValueSource` | `source`
    `protected Set<String>` | `statsList`
    `protected MutableValue` | `value`
    `protected long` | `valueCount`
    `protected FunctionValues.ValueFiller` | `valueFiller`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MinMaxStatsCollector(ValueSource source, Set<String> statsList)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `collect(int doc)` Collect values from the value source and add to statistics.
    `void` | `compute()` After all documents have been collected, this method should be called to finalize the calculations of each statistic.
    `FunctionValues` | `getFunction()`
    `Comparable` | `getStat(String stat)` Return the value of the given statistic.
    `Set<String>` | `getStatsList()`
    `MutableValue` | `getValue()`
    `void` | `setNextReader(LeafReaderContext context)`
    `String` | `statString(String stat)`
    `String` | `toString()`
    `String` | `valueSourceString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### missingCount

          protected long missingCount

    - #### valueCount

          protected long valueCount

    - #### max

          protected MutableValue max

    - #### min

          protected MutableValue min

    - #### value

          protected MutableValue value

    - #### statsList

          protected final Set<String> statsList

    - #### source

          protected final ValueSource source

    - #### function

          protected FunctionValues function

    - #### valueFiller

          protected FunctionValues.ValueFiller valueFiller

  - ### Constructor Detail

    - #### MinMaxStatsCollector

          public MinMaxStatsCollector(ValueSource source,
                                      Set<String> statsList)

  - ### Method Detail

    - #### setNextReader

          public void setNextReader(LeafReaderContext context)
                             throws IOException

      Specified by:
        `setNextReader` in interface `StatsCollector`
      Parameters:
        `context` - The context to read documents from.
      Throws:
        `IOException` - if setting next reader fails

    - #### collect

          public void collect(int doc)

      Description copied from interface: `StatsCollector`
      Collect values from the value source and add to statistics.
      Specified by:
        `collect` in interface `StatsCollector`
      Parameters:
        `doc` - Document to collect from

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getStat

          public Comparable getStat(String stat)

      Description copied from interface: `StatsCollector`
      Return the value of the given statistic.
      Specified by:
        `getStat` in interface `StatsCollector`
      Parameters:
        `stat` - the stat
      Returns:
        a comparable

    - #### getStatsList

          public Set<String> getStatsList()

      Specified by:
        `getStatsList` in interface `StatsCollector`
      Returns:
        The set of statistics being computed by the stats collector.

    - #### compute

          public void compute()

      Description copied from interface: `StatsCollector`
      After all documents have been collected, this method should be called to finalize the calculations of each statistic.
      Specified by:
        `compute` in interface `StatsCollector`

    - #### getValue

          public MutableValue getValue()

      Specified by:
        `getValue` in interface `StatsCollector`

    - #### getFunction

          public FunctionValues getFunction()

      Specified by:
        `getFunction` in interface `StatsCollector`

    - #### valueSourceString

          public String valueSourceString()

      Specified by:
        `valueSourceString` in interface `StatsCollector`
      Returns:
        The string representation of the value source.

    - #### statString

          public String statString(String stat)

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.