Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../img/srcFileCovDistChart5.png 74% of files have more coverage
11   126   8   1,57
2   50   0,73   7
7     1,14  
1    
 
  LogicalState       Line # 26 11 8 50% 0.5
 
  (43)
 
1    /* $Id: LogicalState.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    * Represents a mathematical module state. Every instance of this class is unique.
22    *
23    * @version $Revision: 1.1 $
24    * @author Michael Meyling
25    */
 
26    public final class LogicalState {
27   
28    /** Unchecked. */
29    public static final LogicalState STATE_UNCHECKED
30    = new LogicalState(LogicalStateDescriptions.STATE_STRING_UNCHECKED,
31    false, LogicalStateDescriptions.STATE_CODE_UNCHECKED);
32   
33    /** External checking. */
34    public static final LogicalState STATE_EXTERNAL_CHECKING
35    = new LogicalState(LogicalStateDescriptions.STATE_STRING_EXTERNAL_CHECKING,
36    false, LogicalStateDescriptions.STATE_CODE_EXTERNAL_CHECKING);
37   
38    /** Successfully created. */
39    public static final LogicalState STATE_EXTERNAL_CHECKING_FAILED
40    = new LogicalState(LogicalStateDescriptions.STATE_STRING_EXTERNAL_CHECKING_FAILED,
41    true, LogicalStateDescriptions.STATE_CODE_EXTERNAL_CHECKING_FAILED);
42   
43    /** Internal checking phase. */
44    public static final LogicalState STATE_INTERNAL_CHECKING
45    = new LogicalState(LogicalStateDescriptions.STATE_STRING_INTERNAL_CHECKING,
46    false, LogicalStateDescriptions.STATE_CODE_INTERNAL_CHECKING);
47   
48    /** Internal check failed. */
49    public static final LogicalState STATE_INTERNAL_CHECKING_FAILED
50    = new LogicalState(LogicalStateDescriptions.STATE_STRING_INTERNAL_CHECKING_FAILED,
51    true, LogicalStateDescriptions.STATE_CODE_INTERNAL_CHECKING_FAILED);
52   
53   
54    /** Successfully completely checked. */
55    public static final LogicalState STATE_CHECKED
56    = new LogicalState(LogicalStateDescriptions.STATE_STRING_COMPLETELY_CHECKED,
57    false, LogicalStateDescriptions.STATE_CODE_COMPLETELY_CHECKED);
58   
59   
60    /** meaning of this state. */
61    private final String text;
62   
63    /** is this state a failure? */
64    private final boolean failure;
65   
66    /** Code for state. */
67    private final int code;
68   
69    /**
70    * Creates new module state.
71    *
72    * @param text meaning of this state, <code>null</code> is not permitted.
73    * @param failure is this a failure state?
74    * @param code code of this state.
75    * @throws IllegalArgumentException text == <code>null</code>
76    */
 
77  48 toggle private LogicalState(final String text, final boolean failure, final int code) {
78  48 this.text = text;
79  48 if (this.text == null) {
80  0 throw new IllegalArgumentException("text==null");
81    }
82  48 this.failure = failure;
83  48 this.code = code;
84    }
85   
86    /**
87    * Get meaning of module state.
88    *
89    * @return meaning of module state.
90    */
 
91  186 toggle public String getText() {
92  186 return this.text;
93    }
94   
95    /**
96    * Is this a failure state?
97    *
98    * @return is this a failure state?
99    */
 
100  1068 toggle public boolean isFailure() {
101  1068 return this.failure;
102    }
103   
104    /**
105    * Get module state code.
106    *
107    * @return Module state.
108    */
 
109  0 toggle public int getCode() {
110  0 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  0 toggle public boolean equals(final Object obj) {
122    // every instance is unique
123  0 return (this == obj);
124    }
125   
126    }