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.
9 package eu
.etaxonomy
.taxeditor
.model
;
11 import java
.util
.ArrayList
;
12 import java
.util
.Arrays
;
13 import java
.util
.List
;
15 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
16 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
22 public class NomenclaturalCodeHelper
{
24 public static List
<NomenclaturalCode
> getAllCodes() {
25 return Arrays
.asList(NomenclaturalCode
.values());
28 public static List
<NomenclaturalCode
> getSupportedCodes() {
29 List
<NomenclaturalCode
> supportedCodes
= new ArrayList
<>();
30 NomenclaturalCode nomenclaturalCode
=PreferencesUtil
.getPreferredNomenclaturalCode();
31 for (NomenclaturalCode code
: getAllCodes()) {
32 if (isSupported(code
)) {
33 if (nomenclaturalCode
!= null && nomenclaturalCode
.equals(code
)){
34 supportedCodes
.add(0, code
);
36 supportedCodes
.add(code
);
40 return supportedCodes
;
43 private static boolean isSupported(NomenclaturalCode code
) {
44 if (code
.equals(NomenclaturalCode
.ICNAFP
) || code
.equals(NomenclaturalCode
.ICZN
)) {
51 public static String
getDescription(NomenclaturalCode code
) {
52 if (code
.equals(NomenclaturalCode
.ICNP
)) {
53 return "International Code of Nomenclature of Prokaryotes (ICNP)";
55 if (code
.equals(NomenclaturalCode
.ICNAFP
)) {
56 return "International Code of Botanical Nomenclature (ICNAFP )";
58 if (code
.equals(NomenclaturalCode
.ICNCP
)) {
59 return "International Code of Cultivated Plants (ICNCP)";
61 if (code
.equals(NomenclaturalCode
.ICZN
)) {
62 return "International Code of Zoological Nomenclature (ICZN)";
64 if (code
.equals(NomenclaturalCode
.ICVCN
)) {
65 return "International Code for Virus Classification and Nomenclature (ICVCN)";
70 public static NomenclaturalCode
getDefaultCode() {
71 return NomenclaturalCode
.ICNAFP
;