2 * Copyright (C) 2007 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.
10 package eu
.etaxonomy
.taxeditor
.model
;
12 import eu
.etaxonomy
.cdm
.common
.CdmUtils
;
13 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
14 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
15 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
16 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
24 public class NameHelper
{
26 @SuppressWarnings("unchecked")
27 public static String
getDisplayName(TaxonNameBase name
){
28 return name
.getTitleCache();
31 public static String
getDisplayName(TaxonBase
<?
> taxon
){
32 return getDisplayName(taxon
.getName());
35 @SuppressWarnings("unchecked")
36 public static String
getDisplayNameWithRef(TaxonBase taxonBase
) {
37 TaxonNameBase name
= taxonBase
.getName();
39 if (name
.getFullTitleCache() == null || name
.getFullTitleCache().length() == 0) {
40 return CdmUtils
.Nz(name
.getTitleCache());
42 return name
.getFullTitleCache();
49 * Checks whether name is the basionym for ALL names
55 @SuppressWarnings("unchecked")
56 public static boolean isNameGroupBasionym(TaxonNameBase name
) {
60 return name
.isGroupsBasionym();
68 public static boolean isNameSupraSpecific(TaxonNameBase
<?
, ?
> name
) {
69 if (name
== null || name
.getRank() == null) {
72 return name
.getRank().isHigher(Rank
.SPECIES());
76 * Checks whether name belongs to the same homotypic group as taxon's name.
82 public static boolean isNameHomotypic(TaxonNameBase
<?
, ?
> name
, Taxon taxon
) {
83 return name
.isHomotypic(taxon
.getName());