2 * Copyright (C) 2018 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.editor
.descriptiveDataSet
.matrix
;
13 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
14 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
15 import eu
.etaxonomy
.cdm
.model
.description
.DescriptiveDataSet
;
16 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
17 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
20 * Utility class for the character matrix editor
25 public class MatrixUtility
{
28 * Returns the column property string for the given {@link Feature}
32 public static String
getProperty(Feature feature
){
33 return feature
.getLabel();
37 * Returns a string representation for the given {@link QuantitativeData}
38 * @param data the quantitative data
39 * @return a string representation of the data
41 public static String
getQuantitativeLabel(QuantitativeData data
) {
42 Float min
= data
.getMin();
43 Float max
= data
.getMax();
44 return getQuantitativeLabel(min
, max
);
48 * Returns a string representation for the given min/max values
49 * @param minTotal the min value
50 * @param maxTotal the max value
51 * @return a string representation of the data
53 public static String
getQuantitativeLabel(Float min
, Float max
) {
54 return (min
==null?
"?":min
.toString()) //$NON-NLS-1$
56 +(max
==null?
"?":max
.toString()); //$NON-NLS-1$
60 public static Classification
getClassificationForDescriptiveDataSet(DescriptiveDataSet descriptiveDataSet
){
61 Set
<TaxonNode
> taxonSubtreeFilter
= descriptiveDataSet
.getTaxonSubtreeFilter();
62 if(taxonSubtreeFilter
!=null && !taxonSubtreeFilter
.isEmpty()){
63 return taxonSubtreeFilter
.iterator().next().getClassification();