01 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
02 *
03 * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
04 *
05 * "Hilbert II" is free software; you can redistribute
06 * it and/or modify it under the terms of the GNU General Public
07 * License as published by the Free Software Foundation; either
08 * version 2 of the License, or (at your option) any later version.
09 *
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 /**
22 * Represents a mathematical module state. All existing instances of this class are the public
23 * constants of this class.
24 *
25 * @author Michael Meyling
26 */
27 public final class LoadingImportsState extends AbstractState implements State {
28
29 /** Undefined loading state. */
30 public static final LoadingImportsState STATE_UNDEFINED = new LoadingImportsState(
31 LoadingImportsStateDescriptions.STATE_STRING_UNDEFINED, false,
32 LoadingImportsStateDescriptions.STATE_CODE_UNDEFINED);
33
34 /** Loading directly required (= imported) modules. */
35 public static final LoadingImportsState STATE_LOADING_IMPORTS = new LoadingImportsState(
36 LoadingImportsStateDescriptions.STATE_STRING_LOADING_IMPORTS, false,
37 LoadingImportsStateDescriptions.STATE_CODE_LOADING_IMPORTS);
38
39 /** Loading directly required modules failed. */
40 public static final LoadingImportsState STATE_LOADING_IMPORTS_FAILED = new LoadingImportsState(
41 LoadingImportsStateDescriptions.STATE_STRING_LOADING_IMPORTS_FAILED, true,
42 LoadingImportsStateDescriptions.STATE_CODE_LOADING_IMPORTS_FAILED);
43
44 /** Completely loaded. */
45 public static final LoadingImportsState STATE_LOADED_IMPORTED_MODULES = new LoadingImportsState(
46 LoadingImportsStateDescriptions.STATE_STRING_LOADED_IMPORTED_MODULES, false,
47 LoadingImportsStateDescriptions.STATE_CODE_LOADED_IMPORTED_MODULES);
48
49
50 /**
51 * Creates new module state.
52 *
53 * @param text meaning of this state, <code>null</code> is not permitted.
54 * @param failure is this a failure state?
55 * @param code code of this state.
56 * @throws IllegalArgumentException text == <code>null</code>
57 */
58 private LoadingImportsState(final String text, final boolean failure, final int code) {
59 super(text, failure, code);
60 }
61
62 /**
63 * Are all directly required modules loaded?
64 *
65 * @return Are all directly imported modules loaded?
66 */
67 public boolean areAllDirectlyRequiredLoaded() {
68 return getCode() == STATE_LOADED_IMPORTED_MODULES.getCode();
69 }
70
71 }
|