3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.model
;
13 import java
.util
.ArrayList
;
14 import java
.util
.Arrays
;
15 import java
.util
.List
;
17 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
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 supportedCodes
.add(code
);
50 return supportedCodes
;
57 private static boolean isSupported(NomenclaturalCode code
) {
58 if (code
.equals(NomenclaturalCode
.ICNAFP
) || code
.equals(NomenclaturalCode
.ICZN
)) {
67 * <p>getDescription</p>
69 * @param code a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
70 * @return a {@link java.lang.String} object.
72 public static String
getDescription(NomenclaturalCode code
) {
73 if (code
.equals(NomenclaturalCode
.ICNB
)) {
74 return "International Code of Nomenclature of Bacteria (ICNB)";
76 if (code
.equals(NomenclaturalCode
.ICNAFP
)) {
77 return "International Code of Botanical Nomenclature (ICNAFP )";
79 if (code
.equals(NomenclaturalCode
.ICNCP
)) {
80 return "International Code of Cultivated Plants (ICNCP)";
82 if (code
.equals(NomenclaturalCode
.ICZN
)) {
83 return "International Code of Zoological Nomenclature (ICZN)";
85 if (code
.equals(NomenclaturalCode
.ICVCN
)) {
86 return "International Code for Virus Classification and Nomenclature (ICVCN)";
92 * <p>getDefaultCode</p>
94 * @return a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
96 public static NomenclaturalCode
getDefaultCode() {
97 return NomenclaturalCode
.ICNAFP
;