LoadingState.java
001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002  *
003  * Copyright 2000-2013,  Michael Meyling <mime@qedeq.org>.
004  *
005  * "Hilbert II" is free software; you can redistribute
006  * it and/or modify it under the terms of the GNU General Public
007  * License as published by the Free Software Foundation; either
008  * version 2 of the License, or (at your option) any later version.
009  *
010  * This program is distributed in the hope that it will be useful,
011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013  * GNU General Public License for more details.
014  */
015 
016 package org.qedeq.kernel.se.state;
017 
018 import org.qedeq.kernel.se.common.State;
019 
020 /**
021  * Represents a module state. Every instance of this class is unique.
022  *
023  @author Michael Meyling
024  */
025 public final class LoadingState extends AbstractState implements State {
026 
027     /** Undefined loading state. */
028     public static final LoadingState STATE_UNDEFINED = new LoadingState(
029         LoadingStateDescriptions.STATE_STRING_UNDEFINED, false,
030         LoadingStateDescriptions.STATE_CODE_UNDEFINED);
031 
032     /** Trying to access web address. */
033     public static final LoadingState STATE_LOCATING_WITHIN_WEB = new LoadingState(
034         LoadingStateDescriptions.STATE_STRING_LOCATING_WITHIN_WEB, false,
035         LoadingStateDescriptions.STATE_CODE_LOCATING_WITHIN_WEB);
036 
037     /** Try to access web address failed. */
038     public static final LoadingState STATE_LOCATING_WITHIN_WEB_FAILED = new LoadingState(
039         LoadingStateDescriptions.STATE_STRING_LOCATING_WITHIN_WEB_FAILED, true,
040         LoadingStateDescriptions.STATE_CODE_LOCATING_WITHIN_WEB_FAILED);
041 
042     /** Loading from web address. */
043     public static final LoadingState STATE_LOADING_FROM_WEB = new LoadingState(
044         LoadingStateDescriptions.STATE_STRING_LOADING_FROM_WEB, false,
045         LoadingStateDescriptions.STATE_CODE_LOADING_FROM_WEB);
046 
047     /** Loading from web address failed. */
048     public static final LoadingState STATE_LOADING_FROM_WEB_FAILED = new LoadingState(
049         LoadingStateDescriptions.STATE_STRING_LOADING_FROM_WEB_FAILED, true,
050         LoadingStateDescriptions.STATE_CODE_LOADING_FROM_WEB_FAILED);
051 
052     /** Loading from local file. */
053     public static final LoadingState STATE_LOADING_FROM_LOCAL_FILE = new LoadingState(
054         LoadingStateDescriptions.STATE_STRING_LOADING_FROM_LOCAL_FILE, false,
055         LoadingStateDescriptions.STATE_CODE_LOADING_FROM_LOCAL_FILE);
056 
057     /** Loading from local file failed. */
058     public static final LoadingState STATE_LOADING_FROM_LOCAL_FILE_FAILED = new LoadingState(
059         LoadingStateDescriptions.STATE_STRING_LOADING_FROM_LOCAL_FILE_FAILED, true,
060         LoadingStateDescriptions.STATE_CODE_LOADING_FROM_LOCAL_FILE_FAILED);
061 
062     /** Loading from local file buffer. */
063     public static final LoadingState STATE_LOADING_FROM_BUFFER = new LoadingState(
064         LoadingStateDescriptions.STATE_STRING_LOADING_FROM_BUFFER, false,
065         LoadingStateDescriptions.STATE_CODE_LOADING_FROM_BUFFER);
066 
067     /** Loading from local file buffer failed. */
068     public static final LoadingState STATE_LOADING_FROM_BUFFER_FAILED = new LoadingState(
069         LoadingStateDescriptions.STATE_STRING_LOADING_FROM_BUFFER_FAILED, true,
070         LoadingStateDescriptions.STATE_CODE_LOADING_FROM_BUFFER_FAILED);
071 
072     /** Loading into memory. */
073     public static final LoadingState STATE_LOADING_INTO_MEMORY = new LoadingState(
074         LoadingStateDescriptions.STATE_STRING_LOADING_INTO_MEMORY, false,
075         LoadingStateDescriptions.STATE_CODE_LOADING_INTO_MEMORY);
076 
077     /** Loading into memory failed. */
078     public static final LoadingState STATE_LOADING_INTO_MEMORY_FAILED = new LoadingState(
079         LoadingStateDescriptions.STATE_STRING_LOADING_INTO_MEMORY_FAILED, true,
080         LoadingStateDescriptions.STATE_CODE_LOADING_INTO_MEMORY_FAILED);
081 
082     /** Completely loaded. */
083     public static final LoadingState STATE_LOADED = new LoadingState(
084         LoadingStateDescriptions.STATE_STRING_LOADED, false,
085         LoadingStateDescriptions.STATE_CODE_LOADED);
086 
087     /** Deleted. */
088     public static final LoadingState STATE_DELETED = new LoadingState(
089         LoadingStateDescriptions.STATE_STRING_DELETED, false,
090         LoadingStateDescriptions.STATE_CODE_DELETED);
091 
092     /**
093      * Creates new module state.
094      *
095      @param text meaning of this state, <code>null</code> is not permitted.
096      @param failure is this a failure state?
097      @param code code of this state.
098      @throws IllegalArgumentException text == <code>null</code>
099      */
100     private LoadingState(final String text, final boolean failure, final int code) {
101         super(text, failure, code);
102     }
103 
104 }