1   /**
2    * Distribution License:
3    * JSword is free software; you can redistribute it and/or modify it under
4    * the terms of the GNU Lesser General Public License, version 2.1 or later
5    * as published by the Free Software Foundation. This program is distributed
6    * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
7    * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8    * See the GNU Lesser General Public License for more details.
9    *
10   * The License is available on the internet at:
11   *      http://www.gnu.org/copyleft/lgpl.html
12   * or by writing to:
13   *      Free Software Foundation, Inc.
14   *      59 Temple Place - Suite 330
15   *      Boston, MA 02111-1307, USA
16   *
17   * © CrossWire Bible Society, 2005 - 2016
18   *
19   */
20  package org.crosswire.jsword.book;
21  
22  
23  
24  /**
25   * An Enumeration of the possible Features a Book may have.
26   * 
27   * @see gnu.lgpl.License The GNU Lesser General Public License for details.
28   * @author Joe Walker
29   */
30  public enum FeatureType {
31      /**
32       * The book is one of Greek Definitions. AKA, Strong's.
33       */
34      GREEK_DEFINITIONS ("GreekDef"),
35  
36      /**
37       * The book is one of Greek word parsings. AKA, Robinson.
38       */
39      GREEK_PARSE ("GreekParse"),
40  
41      /**
42       * The book is one of Hebrew Definitions. AKA, Strong's.
43       */
44      HEBREW_DEFINITIONS ("HebrewDef"),
45  
46      /**
47       * The book is one of Hebrew word parsings. AKA, ???.
48       */
49      HEBREW_PARSE ("HebrewParse"),
50  
51      /**
52       * The book is one of Daily Devotions.
53       */
54      DAILY_DEVOTIONS ("DailyDevotions"),
55  
56      /**
57       * The book is glossary of translations from one language to another.
58       */
59      GLOSSARY ("Glossary"),
60  
61      /**
62       * The book contains Strong's Numbers.
63       * The alias is used to match GlobalOptionFilters.
64       */
65      STRONGS_NUMBERS ("StrongsNumbers", "Strongs"),
66  
67      /**
68       * The book contains footnotes
69       */
70      FOOTNOTES ("Footnotes"),
71  
72      /**
73       * The book contains Scripture cross references
74       */
75      SCRIPTURE_REFERENCES ("Scripref"),
76  
77      /**
78       * The book marks the Word's of Christ
79       */
80      WORDS_OF_CHRIST ("RedLetterWords"),
81  
82      /**
83       * The book contains Morphology info
84       */
85      MORPHOLOGY ("Morph"),
86  
87      /**
88       * The book contains Headings
89       */
90      HEADINGS ("Headings");
91  
92      /**
93       * @param name
94       *            The name of the FeatureType
95       */
96      FeatureType(String name) {
97          this(name, "");
98      }
99  
100     /**
101      * @param name
102      *            The name of the FeatureType
103      * @param alias
104      *            The alias of the FeatureType
105      */
106     FeatureType(String name, String alias) {
107         this.name = name;
108         this.alias = alias;
109     }
110 
111     /**
112      * Lookup method to convert from a String
113      * 
114      * @param name the name of a FeatureType
115      * @return the matching FeatureType
116      */
117     public static FeatureType fromString(String name) {
118         for (FeatureType v : values()) {
119             if (v.name.equalsIgnoreCase(name)) {
120                 return v;
121             }
122         }
123 
124         // cannot get here
125         assert false;
126         return null;
127     }
128 
129     /* (non-Javadoc)
130      * @see java.lang.Enum#toString()
131      */
132     @Override
133     public String toString() {
134         return name;
135     }
136 
137     /**
138      * Get the alias for this feature.
139      * 
140      * @return the alias
141      */
142     public String getAlias() {
143         return alias;
144     }
145 
146     /**
147      * The name of the FeatureType
148      */
149     private String name;
150 
151     /**
152      * The alias of the FeatureType
153      */
154     private String alias;
155 }
156