Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Sa Jan 26 2008 14:11:34 CET
file stats: LOC: 137   Methods: 8
NCLOC: 54   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DependencyState.java 50% 66,7% 62,5% 63,6%
coverage coverage
 1    /* $Id: DependencyState.java,v 1.2 2008/01/26 12:39:09 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 mathematical module state. All existing instances of this class are the public
 23    * constants of this class.
 24    *
 25    * @version $Revision: 1.2 $
 26    * @author Michael Meyling
 27    */
 28    public final class DependencyState {
 29   
 30    /** Undefined loading state. */
 31    public static final DependencyState STATE_UNDEFINED = new DependencyState(
 32    DependencyStateDescriptions.STATE_STRING_UNDEFINED, false,
 33    DependencyStateDescriptions.STATE_CODE_UNDEFINED);
 34   
 35    /** Loading required modules. */
 36    public static final DependencyState STATE_LOADING_REQUIRED_MODULES = new DependencyState(
 37    DependencyStateDescriptions.STATE_STRING_LOADING_REQUIRED_MODULES, false,
 38    DependencyStateDescriptions.STATE_CODE_LOADING_REQUIRED_MODULES);
 39   
 40    /** Loading required modules failed. */
 41    public static final DependencyState STATE_LOADING_REQUIRED_MODULES_FAILED = new DependencyState(
 42    DependencyStateDescriptions.STATE_STRING_LOADING_REQUIRED_MODULES_FAILED, true,
 43    DependencyStateDescriptions.STATE_CODE_LOADING_REQUIRED_MODULES_FAILED);
 44   
 45    /** Loading required modules of required modules. */
 46    public static final DependencyState STATE_LOADING_REQUIRED_REQUIREMENTS = new DependencyState(
 47    DependencyStateDescriptions.STATE_STRING_LOADING_REQUIRED_REQUIREMENTS, false,
 48    DependencyStateDescriptions.STATE_CODE_LOADING_REQUIRED_REQUIREMENTS);
 49   
 50    /** Loading required modules of required modules failed. */
 51    public static final DependencyState STATE_LOADING_REQUIRED_REQUIREMENTS_FAILED
 52    = new DependencyState(
 53    DependencyStateDescriptions.STATE_STRING_LOADING_REQUIRED_REQUIREMENTS_FAILED, true,
 54    DependencyStateDescriptions.STATE_CODE_LOADING_REQUIRED_REQUIREMENTS_FAILED);
 55   
 56    /** Completely loaded. */
 57    public static final DependencyState STATE_LOADED_REQUIRED_MODULES = new DependencyState(
 58    DependencyStateDescriptions.STATE_STRING_LOADED_REQUIRED_MODULES, false,
 59    DependencyStateDescriptions.STATE_CODE_LOADED_REQUIRED_MODULES);
 60   
 61   
 62    /** meaning of this state. */
 63    private final String text;
 64   
 65    /** is this state a failure? */
 66    private final boolean failure;
 67   
 68    /** Code for state. */
 69    private final int code;
 70   
 71    /**
 72    * Creates new module state.
 73    *
 74    * @param text meaning of this state, <code>null</code> is not permitted.
 75    * @param failure is this a failure state?
 76    * @param code code of this state.
 77    * @throws IllegalArgumentException text == <code>null</code>
 78    */
 79  24 private DependencyState(final String text, final boolean failure, final int code) {
 80  24 this.text = text;
 81  24 if (this.text == null) {
 82  0 throw new IllegalArgumentException("text==null");
 83    }
 84  24 this.failure = failure;
 85  24 this.code = code;
 86    }
 87   
 88    /**
 89    * Get meaning of module state.
 90    *
 91    * @return meaning of module state.
 92    */
 93  139 public String getText() {
 94  139 return this.text;
 95    }
 96   
 97    /**
 98    * Is this a failure state?
 99    *
 100    * @return is this a failure state?
 101    */
 102  85 public boolean isFailure() {
 103  85 return this.failure;
 104    }
 105   
 106    /**
 107    * Are all required modules loaded?
 108    *
 109    * @return Are all required modules loaded?
 110    */
 111  124 public boolean areAllRequiredLoaded() {
 112  124 return this.code == STATE_LOADED_REQUIRED_MODULES.getCode();
 113    }
 114   
 115    /**
 116    * Get module state code.
 117    *
 118    * @return Module state.
 119    */
 120  360 public int getCode() {
 121  360 return this.code;
 122    }
 123   
 124  0 public String toString() {
 125  0 return this.text;
 126    }
 127   
 128  0 public int hashCode() {
 129  0 return this.text.hashCode();
 130    }
 131   
 132  0 public final boolean equals(final Object obj) {
 133    // every instance is unique
 134  0 return (this == obj);
 135    }
 136   
 137    }