Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
file stats: LOC: 147   Methods: 7
NCLOC: 65   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LoadingState.java 25% 53,8% 57,1% 50%
coverage coverage
 1    /* $Id: LoadingState.java,v 1.1 2007/04/12 23:50:04 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2007, Michael Meyling <mime@qedeq.org>.
 6    *
 7    * "Hilbert II" is free software; you can redistribute
 8    * it and/or modify it under the terms of the GNU General Public
 9    * License as published by the Free Software Foundation; either
 10    * version 2 of the License, or (at your option) any later version.
 11    *
 12    * This program is distributed in the hope that it will be useful,
 13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 15    * GNU General Public License for more details.
 16    */
 17   
 18    package org.qedeq.kernel.bo.module;
 19   
 20   
 21    /**
 22    * Represents a module state.
 23    *
 24    * @version $Revision: 1.1 $
 25    * @author Michael Meyling
 26    */
 27    public final class LoadingState {
 28   
 29    /** Undefined loading state. */
 30    public static final LoadingState STATE_UNDEFINED = new LoadingState(
 31    LoadingStateDescriptions.STATE_STRING_UNDEFINED, false,
 32    LoadingStateDescriptions.STATE_CODE_UNDEFINED);
 33   
 34    /** Trying to access web address. */
 35    public static final LoadingState STATE_LOCATING_WITHIN_WEB = new LoadingState(
 36    LoadingStateDescriptions.STATE_STRING_LOCATING_WITHIN_WEB, false,
 37    LoadingStateDescriptions.STATE_CODE_LOCATING_WITHIN_WEB);
 38   
 39    /** Try to access web address failed. */
 40    public static final LoadingState STATE_LOCATING_WITHIN_WEB_FAILED = new LoadingState(
 41    LoadingStateDescriptions.STATE_STRING_LOCATING_WITHIN_WEB_FAILED, true,
 42    LoadingStateDescriptions.STATE_CODE_LOCATING_WITHIN_WEB_FAILED);
 43   
 44    /** Loading from web address. */
 45    public static final LoadingState STATE_LOADING_FROM_WEB = new LoadingState(
 46    LoadingStateDescriptions.STATE_STRING_LOADING_FROM_WEB, false,
 47    LoadingStateDescriptions.STATE_CODE_LOADING_FROM_WEB);
 48   
 49    /** Loading from web address failed. */
 50    public static final LoadingState STATE_LOADING_FROM_WEB_FAILED = new LoadingState(
 51    LoadingStateDescriptions.STATE_STRING_LOADING_FROM_WEB_FAILED, true,
 52    LoadingStateDescriptions.STATE_CODE_LOADING_FROM_WEB_FAILED);
 53   
 54    /** Loading from local file buffer. */
 55    public static final LoadingState STATE_LOADING_FROM_BUFFER = new LoadingState(
 56    LoadingStateDescriptions.STATE_STRING_LOADING_FROM_BUFFER, false,
 57    LoadingStateDescriptions.STATE_CODE_LOADING_FROM_BUFFER);
 58   
 59    /** Loading from local file buffer failed. */
 60    public static final LoadingState STATE_LOADING_FROM_BUFFER_FAILED = new LoadingState(
 61    LoadingStateDescriptions.STATE_STRING_LOADING_FROM_BUFFER_FAILED, true,
 62    LoadingStateDescriptions.STATE_CODE_LOADING_FROM_BUFFER_FAILED);
 63   
 64    /** Loading into memory. */
 65    public static final LoadingState STATE_LOADING_INTO_MEMORY = new LoadingState(
 66    LoadingStateDescriptions.STATE_STRING_LOADING_INTO_MEMORY, false,
 67    LoadingStateDescriptions.STATE_CODE_LOADING_INTO_MEMORY);
 68   
 69    /** Loading into memory failed. */
 70    public static final LoadingState STATE_LOADING_INTO_MEMORY_FAILED = new LoadingState(
 71    LoadingStateDescriptions.STATE_STRING_LOADING_INTO_MEMORY_FAILED, true,
 72    LoadingStateDescriptions.STATE_CODE_LOADING_INTO_MEMORY_FAILED);
 73   
 74    /** Completly loaded. */
 75    public static final LoadingState STATE_LOADED = new LoadingState(
 76    LoadingStateDescriptions.STATE_STRING_LOADED, false,
 77    LoadingStateDescriptions.STATE_CODE_LOADED);
 78   
 79    /** meaning of this state. */
 80    private final String text;
 81   
 82    /** is this state a failure? */
 83    private final boolean failure;
 84   
 85    /** Code for state. */
 86    private final int code;
 87   
 88    /**
 89    * Creates new module state.
 90    *
 91    * @param text meaning of this state, <code>null</code> is not permitted.
 92    * @param failure is this a failure state?
 93    * @param code code of this state.
 94    * @throws IllegalArgumentException text == <code>null</code>
 95    */
 96  30 private LoadingState(final String text, final boolean failure, final int code) {
 97  30 this.text = text;
 98  30 if (this.text == null) {
 99  0 throw new IllegalArgumentException("text==null");
 100    }
 101  30 this.failure = failure;
 102  30 this.code = code;
 103    }
 104   
 105    /**
 106    * Get meaning of module state.
 107    *
 108    * @return meaning of module state.
 109    */
 110  30 public final String getText() {
 111  30 return this.text;
 112    }
 113   
 114    /**
 115    * Is this a failure state?
 116    *
 117    * @return is this a failure state?
 118    */
 119  68 public final boolean isFailure() {
 120  68 return this.failure;
 121    }
 122   
 123    /**
 124    * Get module state code.
 125    *
 126    * @return Module state.
 127    */
 128  0 public final int getCode() {
 129  0 return this.code;
 130    }
 131   
 132  1 public final String toString() {
 133  1 return this.text;
 134    }
 135   
 136  0 public final int hashCode() {
 137  0 return this.text.hashCode();
 138    }
 139   
 140  0 public final boolean equals(final Object obj) {
 141  0 if (obj == null || !(obj instanceof LoadingState)) {
 142  0 return false;
 143    }
 144  0 return text.equals(((LoadingState) obj).text);
 145    }
 146   
 147    }