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
;
19 * <p>NomenclaturalCodeHelper class.</p>
25 public class NomenclaturalCodeHelper
{
30 * @return a {@link java.util.List} object.
32 public static List
<NomenclaturalCode
> getAllCodes() {
33 return Arrays
.asList(NomenclaturalCode
.values());
38 * <p>getSupportedCodes</p>
40 * @return a {@link java.util.List} object.
42 public static List
<NomenclaturalCode
> getSupportedCodes() {
43 List
<NomenclaturalCode
> supportedCodes
= new ArrayList
<NomenclaturalCode
>();
44 for (NomenclaturalCode code
: getAllCodes()) {
45 if (isSupported(code
)) {
46 supportedCodes
.add(code
);
49 return supportedCodes
;
56 private static boolean isSupported(NomenclaturalCode code
) {
57 if (code
.equals(NomenclaturalCode
.ICNAFP
) || code
.equals(NomenclaturalCode
.ICZN
)) {
66 * <p>getDescription</p>
68 * @param code a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
69 * @return a {@link java.lang.String} object.
71 public static String
getDescription(NomenclaturalCode code
) {
72 if (code
.equals(NomenclaturalCode
.ICNB
)) {
73 return "International Code of Nomenclature of Bacteria (ICNB)";
75 if (code
.equals(NomenclaturalCode
.ICNAFP
)) {
76 return "International Code of Botanical Nomenclature (ICNAFP )";
78 if (code
.equals(NomenclaturalCode
.ICNCP
)) {
79 return "International Code of Cultivated Plants (ICNCP)";
81 if (code
.equals(NomenclaturalCode
.ICZN
)) {
82 return "International Code of Zoological Nomenclature (ICZN)";
84 if (code
.equals(NomenclaturalCode
.ICVCN
)) {
85 return "International Code for Virus Classification and Nomenclature (ICVCN)";
91 * <p>getDefaultCode</p>
93 * @return a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
95 public static NomenclaturalCode
getDefaultCode() {
96 return NomenclaturalCode
.ICNAFP
;