Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../img/srcFileCovDistChart8.png 47% of files have more coverage
12   126   9   1,5
2   47   0,75   8
8     1,12  
1    
 
  DependencyState       Line # 28 12 9 72,7% 0.72727275
 
  (43)
 
1    /* $Id: DependencyState.java,v 1.1 2008/03/27 05:16:25 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, 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.common;
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.1 $
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    /** Completely loaded. */
46    public static final DependencyState STATE_LOADED_REQUIRED_MODULES = new DependencyState(
47    DependencyStateDescriptions.STATE_STRING_LOADED_REQUIRED_MODULES, false,
48    DependencyStateDescriptions.STATE_CODE_LOADED_REQUIRED_MODULES);
49   
50   
51    /** meaning of this state. */
52    private final String text;
53   
54    /** is this state a failure? */
55    private final boolean failure;
56   
57    /** Code for state. */
58    private final int code;
59   
60    /**
61    * Creates new module state.
62    *
63    * @param text meaning of this state, <code>null</code> is not permitted.
64    * @param failure is this a failure state?
65    * @param code code of this state.
66    * @throws IllegalArgumentException text == <code>null</code>
67    */
 
68  32 toggle private DependencyState(final String text, final boolean failure, final int code) {
69  32 this.text = text;
70  32 if (this.text == null) {
71  0 throw new IllegalArgumentException("text==null");
72    }
73  32 this.failure = failure;
74  32 this.code = code;
75    }
76   
77    /**
78    * Get meaning of module state.
79    *
80    * @return meaning of module state.
81    */
 
82  319 toggle public String getText() {
83  319 return this.text;
84    }
85   
86    /**
87    * Is this a failure state?
88    *
89    * @return is this a failure state?
90    */
 
91  1244 toggle public boolean isFailure() {
92  1244 return this.failure;
93    }
94   
95    /**
96    * Are all required modules loaded?
97    *
98    * @return Are all required modules loaded?
99    */
 
100  486 toggle public boolean areAllRequiredLoaded() {
101  486 return this.code == STATE_LOADED_REQUIRED_MODULES.getCode();
102    }
103   
104    /**
105    * Get module state code.
106    *
107    * @return Module state.
108    */
 
109  734 toggle public int getCode() {
110  734 return this.code;
111    }
112   
 
113  0 toggle public String toString() {
114  0 return this.text;
115    }
116   
 
117  0 toggle public int hashCode() {
118  0 return this.text.hashCode();
119    }
120   
 
121  5 toggle public final boolean equals(final Object obj) {
122    // every instance is unique
123  5 return (this == obj);
124    }
125   
126    }