rename abstract classes and some other cleanup
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / format / description / QuantitativeDescriptionBuilderBase.java
1 /**
2 * Copyright (C) 2007 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.format.description;
10
11 import java.math.BigDecimal;
12 import java.util.HashMap;
13 import java.util.List;
14 import java.util.Map;
15
16 import eu.etaxonomy.cdm.model.common.Language;
17 import eu.etaxonomy.cdm.model.description.MeasurementUnit;
18 import eu.etaxonomy.cdm.model.description.QuantitativeData;
19 import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
20 import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
21 import eu.etaxonomy.cdm.model.description.TextData;
22
23 /**
24 * @author m.venin
25 * @since 2010
26 */
27 public abstract class QuantitativeDescriptionBuilderBase
28 extends DescriptionBuilderBase<QuantitativeData>{
29
30 @Override
31 public TextData build(QuantitativeData data, List<Language> languages) {
32 Map<StatisticalMeasure,BigDecimal> measures = new HashMap<>();
33 for (StatisticalMeasurementValue smv : data.getStatisticalValues()){
34 measures.put(smv.getType(),smv.getValue());
35 }
36 return doBuild(measures,data.getUnit(), languages);
37 }
38
39 protected abstract TextData doBuild(Map<StatisticalMeasure,BigDecimal> measures,
40 MeasurementUnit unit, List<Language> languages);
41
42 }