1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.api.service.statistics;
|
10
|
|
11
|
import java.util.HashMap;
|
12
|
import java.util.Map;
|
13
|
|
14
|
/**
|
15
|
* This class is meant to hold the result of a statistical request to a CDM
|
16
|
* Store. It e.g. holds the information how many classifications, taxa, names,
|
17
|
* synonyms, references, etc. are stored in the store. This information may also
|
18
|
* be hold for certain parts of a store. E.g. may store the statistical
|
19
|
* information for each classification. This partitioninc is recursive so a
|
20
|
* partition is again represented by a {@link Statistics}.
|
21
|
*
|
22
|
* @author a.mueller, a.kohlbecker, s.buers
|
23
|
* @since 21.09.2012
|
24
|
*/
|
25
|
public class Statistics {
|
26
|
|
27
|
private StatisticsConfigurator request;
|
28
|
|
29
|
// it's a pitty, but for JSON Map keys must be Strings
|
30
|
// see also: JSONObject _fromMap( Map map, JsonConfig jsonConfig )
|
31
|
// --> TODO: modify MapJSONValueProcessor.processArrayValue(Object value,
|
32
|
// JsonConfig jsonConfig)???
|
33
|
|
34
|
private Map<String, Number> countMap;
|
35
|
|
36
|
public Statistics(StatisticsConfigurator configurator) {
|
37
|
this.request = configurator;
|
38
|
this.countMap = new HashMap<String, Number>();
|
39
|
}
|
40
|
|
41
|
public void setRequest(StatisticsConfigurator request) {
|
42
|
this.request = request;
|
43
|
}
|
44
|
|
45
|
public StatisticsConfigurator getRequest() {
|
46
|
return request;
|
47
|
}
|
48
|
|
49
|
public Map<String, Number> getCountMap() {
|
50
|
return countMap;
|
51
|
}
|
52
|
|
53
|
public void addCount(StatisticsTypeEnum type, Long number) {
|
54
|
this.countMap.put(type.getLabel(), number);
|
55
|
}
|
56
|
|
57
|
}
|