Clover Coverage Report
Coverage timestamp: Sat Sep 18 2010 04:09:52 UTC
../../../../img/srcFileCovDistChart8.png 50% of files have more coverage
12   108   9   1.5
2   47   0.75   8
8     1.12  
1    
 
  DependencyState       Line # 25 12 9 72.7% 0.72727275
 
  (58)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2010, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.kernel.common;
17   
18   
19    /**
20    * Represents a mathematical module state. All existing instances of this class are the public
21    * constants of this class.
22    *
23    * @author Michael Meyling
24    */
 
25    public final class DependencyState implements State {
26   
27    /** Undefined loading state. */
28    public static final DependencyState STATE_UNDEFINED = new DependencyState(
29    DependencyStateDescriptions.STATE_STRING_UNDEFINED, false,
30    DependencyStateDescriptions.STATE_CODE_UNDEFINED);
31   
32    /** Loading required modules. */
33    public static final DependencyState STATE_LOADING_REQUIRED_MODULES = new DependencyState(
34    DependencyStateDescriptions.STATE_STRING_LOADING_REQUIRED_MODULES, false,
35    DependencyStateDescriptions.STATE_CODE_LOADING_REQUIRED_MODULES);
36   
37    /** Loading required modules failed. */
38    public static final DependencyState STATE_LOADING_REQUIRED_MODULES_FAILED = new DependencyState(
39    DependencyStateDescriptions.STATE_STRING_LOADING_REQUIRED_MODULES_FAILED, true,
40    DependencyStateDescriptions.STATE_CODE_LOADING_REQUIRED_MODULES_FAILED);
41   
42    /** Completely loaded. */
43    public static final DependencyState STATE_LOADED_REQUIRED_MODULES = new DependencyState(
44    DependencyStateDescriptions.STATE_STRING_LOADED_REQUIRED_MODULES, false,
45    DependencyStateDescriptions.STATE_CODE_LOADED_REQUIRED_MODULES);
46   
47   
48    /** meaning of this state. */
49    private final String text;
50   
51    /** is this state a failure? */
52    private final boolean failure;
53   
54    /** Code for state. */
55    private final int code;
56   
57    /**
58    * Creates new module state.
59    *
60    * @param text meaning of this state, <code>null</code> is not permitted.
61    * @param failure is this a failure state?
62    * @param code code of this state.
63    * @throws IllegalArgumentException text == <code>null</code>
64    */
 
65  44 toggle private DependencyState(final String text, final boolean failure, final int code) {
66  44 this.text = text;
67  44 if (this.text == null) {
68  0 throw new IllegalArgumentException("text==null");
69    }
70  44 this.failure = failure;
71  44 this.code = code;
72    }
73   
 
74  483 toggle public String getText() {
75  483 return this.text;
76    }
77   
 
78  1477 toggle public boolean isFailure() {
79  1477 return this.failure;
80    }
81   
82    /**
83    * Are all required modules loaded?
84    *
85    * @return Are all required modules loaded?
86    */
 
87  487 toggle public boolean areAllRequiredLoaded() {
88  487 return this.code == STATE_LOADED_REQUIRED_MODULES.getCode();
89    }
90   
 
91  875 toggle public int getCode() {
92  875 return this.code;
93    }
94   
 
95  0 toggle public String toString() {
96  0 return this.text;
97    }
98   
 
99  0 toggle public int hashCode() {
100  0 return this.text.hashCode();
101    }
102   
 
103  5 toggle public final boolean equals(final Object obj) {
104    // every instance is unique
105  5 return (this == obj);
106    }
107   
108    }