1 | /* This file is part of the project "Hilbert II" - http://www.qedeq.org |
2 | * |
3 | * Copyright 2000-2014, Michael Meyling <mime@qedeq.org>. |
4 | * |
5 | * "Hilbert II" is free software; you can redistribute |
6 | * it and/or modify it under the terms of the GNU General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2 of the License, or (at your option) any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. |
14 | */ |
15 | |
16 | package org.qedeq.kernel.se.state; |
17 | |
18 | import org.qedeq.kernel.se.common.State; |
19 | |
20 | /** |
21 | * Represents a module state. Every instance of this class is unique. |
22 | * |
23 | * @author Michael Meyling |
24 | */ |
25 | public final class LoadingState extends AbstractState implements State { |
26 | |
27 | /** Undefined loading state. */ |
28 | public static final LoadingState STATE_UNDEFINED = new LoadingState( |
29 | LoadingStateDescriptions.STATE_STRING_UNDEFINED, false, |
30 | LoadingStateDescriptions.STATE_CODE_UNDEFINED); |
31 | |
32 | /** Trying to access web address. */ |
33 | public static final LoadingState STATE_LOCATING_WITHIN_WEB = new LoadingState( |
34 | LoadingStateDescriptions.STATE_STRING_LOCATING_WITHIN_WEB, false, |
35 | LoadingStateDescriptions.STATE_CODE_LOCATING_WITHIN_WEB); |
36 | |
37 | /** Try to access web address failed. */ |
38 | public static final LoadingState STATE_LOCATING_WITHIN_WEB_FAILED = new LoadingState( |
39 | LoadingStateDescriptions.STATE_STRING_LOCATING_WITHIN_WEB_FAILED, true, |
40 | LoadingStateDescriptions.STATE_CODE_LOCATING_WITHIN_WEB_FAILED); |
41 | |
42 | /** Loading from web address. */ |
43 | public static final LoadingState STATE_LOADING_FROM_WEB = new LoadingState( |
44 | LoadingStateDescriptions.STATE_STRING_LOADING_FROM_WEB, false, |
45 | LoadingStateDescriptions.STATE_CODE_LOADING_FROM_WEB); |
46 | |
47 | /** Loading from web address failed. */ |
48 | public static final LoadingState STATE_LOADING_FROM_WEB_FAILED = new LoadingState( |
49 | LoadingStateDescriptions.STATE_STRING_LOADING_FROM_WEB_FAILED, true, |
50 | LoadingStateDescriptions.STATE_CODE_LOADING_FROM_WEB_FAILED); |
51 | |
52 | /** Loading from local file. */ |
53 | public static final LoadingState STATE_LOADING_FROM_LOCAL_FILE = new LoadingState( |
54 | LoadingStateDescriptions.STATE_STRING_LOADING_FROM_LOCAL_FILE, false, |
55 | LoadingStateDescriptions.STATE_CODE_LOADING_FROM_LOCAL_FILE); |
56 | |
57 | /** Loading from local file failed. */ |
58 | public static final LoadingState STATE_LOADING_FROM_LOCAL_FILE_FAILED = new LoadingState( |
59 | LoadingStateDescriptions.STATE_STRING_LOADING_FROM_LOCAL_FILE_FAILED, true, |
60 | LoadingStateDescriptions.STATE_CODE_LOADING_FROM_LOCAL_FILE_FAILED); |
61 | |
62 | /** Loading from local file buffer. */ |
63 | public static final LoadingState STATE_LOADING_FROM_BUFFER = new LoadingState( |
64 | LoadingStateDescriptions.STATE_STRING_LOADING_FROM_BUFFER, false, |
65 | LoadingStateDescriptions.STATE_CODE_LOADING_FROM_BUFFER); |
66 | |
67 | /** Loading from local file buffer failed. */ |
68 | public static final LoadingState STATE_LOADING_FROM_BUFFER_FAILED = new LoadingState( |
69 | LoadingStateDescriptions.STATE_STRING_LOADING_FROM_BUFFER_FAILED, true, |
70 | LoadingStateDescriptions.STATE_CODE_LOADING_FROM_BUFFER_FAILED); |
71 | |
72 | /** Loading into memory. */ |
73 | public static final LoadingState STATE_LOADING_INTO_MEMORY = new LoadingState( |
74 | LoadingStateDescriptions.STATE_STRING_LOADING_INTO_MEMORY, false, |
75 | LoadingStateDescriptions.STATE_CODE_LOADING_INTO_MEMORY); |
76 | |
77 | /** Loading into memory failed. */ |
78 | public static final LoadingState STATE_LOADING_INTO_MEMORY_FAILED = new LoadingState( |
79 | LoadingStateDescriptions.STATE_STRING_LOADING_INTO_MEMORY_FAILED, true, |
80 | LoadingStateDescriptions.STATE_CODE_LOADING_INTO_MEMORY_FAILED); |
81 | |
82 | /** Completely loaded. */ |
83 | public static final LoadingState STATE_LOADED = new LoadingState( |
84 | LoadingStateDescriptions.STATE_STRING_LOADED, false, |
85 | LoadingStateDescriptions.STATE_CODE_LOADED); |
86 | |
87 | /** Deleted. */ |
88 | public static final LoadingState STATE_DELETED = new LoadingState( |
89 | LoadingStateDescriptions.STATE_STRING_DELETED, false, |
90 | LoadingStateDescriptions.STATE_CODE_DELETED); |
91 | |
92 | /** |
93 | * Creates new module state. |
94 | * |
95 | * @param text meaning of this state, <code>null</code> is not permitted. |
96 | * @param failure is this a failure state? |
97 | * @param code code of this state. |
98 | * @throws IllegalArgumentException text == <code>null</code> |
99 | */ |
100 | private LoadingState(final String text, final boolean failure, final int code) { |
101 | super(text, failure, code); |
102 | } |
103 | |
104 | } |