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 java
.util
.ArrayList
;
13 import java
.util
.Arrays
;
14 import java
.util
.List
;
16 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
17 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
20 * <p>NomenclaturalCodeHelper class.</p>
26 public class NomenclaturalCodeHelper
{
31 * @return a {@link java.util.List} object.
33 public static List
<NomenclaturalCode
> getAllCodes() {
34 return Arrays
.asList(NomenclaturalCode
.values());
39 * <p>getSupportedCodes</p>
41 * @return a {@link java.util.List} object.
43 public static List
<NomenclaturalCode
> getSupportedCodes() {
44 List
<NomenclaturalCode
> supportedCodes
= new ArrayList
<NomenclaturalCode
>();
45 for (NomenclaturalCode code
: getAllCodes()) {
46 if (isSupported(code
)) {
47 if (PreferencesUtil
.getPreferredNomenclaturalCode().equals(code
)){
48 supportedCodes
.add(0, code
);
50 supportedCodes
.add(code
);
54 return supportedCodes
;
61 private static boolean isSupported(NomenclaturalCode code
) {
62 if (code
.equals(NomenclaturalCode
.ICNAFP
) || code
.equals(NomenclaturalCode
.ICZN
)) {
71 * <p>getDescription</p>
73 * @param code a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
74 * @return a {@link java.lang.String} object.
76 public static String
getDescription(NomenclaturalCode code
) {
77 if (code
.equals(NomenclaturalCode
.ICNB
)) {
78 return "International Code of Nomenclature of Bacteria (ICNB)";
80 if (code
.equals(NomenclaturalCode
.ICNAFP
)) {
81 return "International Code of Botanical Nomenclature (ICNAFP )";
83 if (code
.equals(NomenclaturalCode
.ICNCP
)) {
84 return "International Code of Cultivated Plants (ICNCP)";
86 if (code
.equals(NomenclaturalCode
.ICZN
)) {
87 return "International Code of Zoological Nomenclature (ICZN)";
89 if (code
.equals(NomenclaturalCode
.ICVCN
)) {
90 return "International Code for Virus Classification and Nomenclature (ICVCN)";
96 * <p>getDefaultCode</p>
98 * @return a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
100 public static NomenclaturalCode
getDefaultCode() {
101 return NomenclaturalCode
.ICNAFP
;