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