Holger's Java API

## com.antelmann.math
Class ObjectAnalyzer<T>

    java.lang.Object
      com.antelmann.math.ObjectAnalyzer<T>

All Implemented Interfaces:
  TimeDataParser<T>, Iterable<T>

Direct Known Subclasses:
  EntryAnalyzer

    public class ObjectAnalyzer<T>

extends Object
implements TimeDataParser<T>, Iterable<T>

provides a convenient base and several methods to easily analyze aggregated data; the underlying data can either be provided as a cached `Collection` or via a retriever of an iterable object.

Since:
  21.12.2011, 14:02:06
Author:
  Holger Antelmann
See Also:
  `enumerate()`, `TimeDataGrid`, `createLoadedTimeDataGrid(Monitor)`

Constructor Summary
`ObjectAnalyzer()` creates an instance that simply has no data (as a cached, empty list)
`ObjectAnalyzer(Iterable<T> data)`
`ObjectAnalyzer(Iterable<T> data, Filter<? super T> filter)`
`ObjectAnalyzer(ValueRetriever<Enumeration<T>> retriever)`

Method Summary
`protected void` `clearData()` clears all data, so that another data source can be set
`DataMatrix<T>` `createLoadedMatrix(DataParser<? super T> parser, Monitor mon)`
`TimeDataGrid<T>` `createLoadedTimeDataGrid()`
`TimeDataGrid<T>` `createLoadedTimeDataGrid(Monitor mon)`
`Enumeration<T>` `enumerate()` enumerates over the data
`Object` `extractCriteria(T entry)` allows for an additional criteria to be extracted; may return null
`Date` `extractDate(T entry)` extracts the relevant date from the given entry; must not return null
`Number` `extractNumber(T entry)` extracts the relevant number to be aggregated by for the given entry; must not return null
`Collection<T>` `getCachedData()`
`PatternExtractor<? super T,Date>` `getDateExtractor()`
`TimeInterval` `getDateInterval()` `TimeInterval.DAY` by default
`Filter<? super T>` `getFilter()`
`String` `getFilterString()`
`PatternExtractor<? super T,?>` `getGrouping()`
`PatternExtractor<? super T,? extends Number>` `getNumberExtractor()`
`DataPoint.ValueType` `getValueType()` `DataPoint.ValueType.SUM` by default
`Iterator<T>` `iterator()`
`void` `loadGrid(TimeDataGrid<T> grid, Monitor mon)`
`void` `setData(Collection<T> cachedData)`
`void` `setData(Iterable<T> i)`
`void` `setData(ListRetriever<T> listRetriever)` convenience method; calls `setData(ValueRetriever)` eventually
`void` `setData(ValueRetriever<Enumeration<T>> retriever)`
`void` `setDateExtractor(PatternExtractor<? super T,Date> dateExtractor)`
`void` `setDateInterval(TimeInterval dateInterval)`
`void` `setFilter(Filter<? super T> filter)`
`void` `setFilterString(String filterString)`
`void` `setGrouping(PatternExtractor<? super T,?> grouping)`
`void` `setGroupingMethod(String methodName)`
`void` `setNumberExtractor(PatternExtractor<? super T,? extends Number> numberExtractor)`
`void` `setValueType(DataPoint.ValueType valueType)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ObjectAnalyzer

    public ObjectAnalyzer()

  creates an instance that simply has no data (as a cached, empty list)

### ObjectAnalyzer

    public ObjectAnalyzer(Iterable<T> data)

### ObjectAnalyzer

    public ObjectAnalyzer(Iterable<T> data,
                          Filter<? super T> filter)

### ObjectAnalyzer

    public ObjectAnalyzer(ValueRetriever<Enumeration<T>> retriever)

Method Detail

### clearData

    protected void clearData()

  clears all data, so that another data source can be set

### getCachedData

    public Collection<T> getCachedData()

### setData

    public void setData(Collection<T> cachedData)

### setData

    public void setData(Iterable<T> i)

### setData

    public void setData(ValueRetriever<Enumeration<T>> retriever)

### setData

    public void setData(ListRetriever<T> listRetriever)

  convenience method; calls `setData(ValueRetriever)` eventually

### getValueType

    public DataPoint.ValueType getValueType()

  `DataPoint.ValueType.SUM` by default

### setValueType

    public void setValueType(DataPoint.ValueType valueType)

### getDateInterval

    public TimeInterval getDateInterval()

  `TimeInterval.DAY` by default

### setDateInterval

    public void setDateInterval(TimeInterval dateInterval)

### setFilter

    public void setFilter(Filter<? super T> filter)

### getFilter

    public Filter<? super T> getFilter()

### getFilterString

    public String getFilterString()

### setFilterString

    public void setFilterString(String filterString)

### iterator

    public Iterator<T> iterator()

  Specified by:
    `iterator` in interface `Iterable<T>`

### enumerate

    public Enumeration<T> enumerate()
                             throws IOException

  enumerates over the data

  Throws:
    `IOException`

### getGrouping

    public PatternExtractor<? super T,?> getGrouping()

### setGrouping

    public void setGrouping(PatternExtractor<? super T,?> grouping)

### setGroupingMethod

    public void setGroupingMethod(String methodName)

### getDateExtractor

    public PatternExtractor<? super T,Date> getDateExtractor()

### setDateExtractor

    public void setDateExtractor(PatternExtractor<? super T,Date> dateExtractor)

  See Also:
    `Timed.DATE_EXTRACTOR`

### getNumberExtractor

    public PatternExtractor<? super T,? extends Number> getNumberExtractor()

### setNumberExtractor

    public void setNumberExtractor(PatternExtractor<? super T,? extends Number> numberExtractor)

### createLoadedMatrix

    public DataMatrix<T> createLoadedMatrix(DataParser<? super T> parser,
                                            Monitor mon)
                                     throws IOException

  Throws:
    `IOException`

### createLoadedTimeDataGrid

    public TimeDataGrid<T> createLoadedTimeDataGrid()
                                             throws IOException

  Throws:
    `IOException`

### createLoadedTimeDataGrid

    public TimeDataGrid<T> createLoadedTimeDataGrid(Monitor mon)
                                             throws IOException

  Throws:
    `IOException`

### loadGrid

    public void loadGrid(TimeDataGrid<T> grid,
                         Monitor mon)
                  throws IOException

  Throws:
    `IOException`

### extractCriteria

    public Object extractCriteria(T entry)

  Description copied from interface: `TimeDataParser`
  allows for an additional criteria to be extracted; may return null

  Specified by:
    `extractCriteria` in interface `TimeDataParser<T>`

### extractDate

    public Date extractDate(T entry)

  Description copied from interface: `TimeDataParser`
  extracts the relevant date from the given entry; must not return null

  Specified by:
    `extractDate` in interface `TimeDataParser<T>`
  See Also:
    `TimeInterval`

### extractNumber

    public Number extractNumber(T entry)

  Description copied from interface: `TimeDataParser`
  extracts the relevant number to be aggregated by for the given entry; must not return null

  Specified by:
    `extractNumber` in interface `TimeDataParser<T>`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads