| IndexStatus.java |
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 as published by
5 * the Free Software Foundation. This program is distributed in the hope
6 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
7 * 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 * Copyright: 2005
18 * The copyright to this program is held by it's authors.
19 *
20 * ID: $Id: IndexStatus.java 2223 2012-01-26 21:28:02Z dmsmith $
21 */
22 package org.crosswire.jsword.index;
23
24
25 /**
26 * An Enumeration of the possible states of an index.
27 *
28 * @see gnu.lgpl.License for license details.<br>
29 * The copyright to this program is held by it's authors.
30 * @author Joe Walker [joe at eireneh dot com]
31 * @author DM Smith [dmsmith555 at yahoo dot com]
32 */
33 public enum IndexStatus {
34 /**
35 * There is a complete and ready to use search index
36 */
37 DONE("Indexed"),
38
39 /**
40 * There is no search index, and no plans to create one
41 */
42 UNDONE("No Index"),
43
44 /**
45 * This Book has been scheduled for index creation
46 */
47 SCHEDULED("Scheduled"),
48
49 /**
50 * An index is currently being generated for this Book
51 */
52 CREATING("Creating"),
53
54 /**
55 * An index is no longer valid and needs to be discarded.
56 */
57 INVALID("Invalid");
58
59 /**
60 * @param name
61 * The name of the BookCategory
62 */
63 private IndexStatus(String name) {
64 this.name = name;
65 }
66
67 /**
68 * Lookup method to convert from a String
69 */
70 public static IndexStatus fromString(String name) {
71 for (IndexStatus o : IndexStatus.values()) {
72 if (o.name.equalsIgnoreCase(name)) {
73 return o;
74 }
75 }
76 // cannot get here
77 assert false;
78 return null;
79 }
80
81 @Override
82 public String toString() {
83 return name;
84 }
85
86 /**
87 * The name of the IndexStatus
88 */
89 private String name;
90
91 }
92