Clover Coverage Report
Coverage timestamp: Sat Sep 18 2010 04:09:52 UTC
../../../../img/srcFileCovDistChart6.png 73% of files have more coverage
11   108   8   1.57
2   50   0.73   7
7     1.14  
1    
 
  LogicalState       Line # 23 11 8 60% 0.6
 
  (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    * Represents a mathematical module state. Every instance of this class is unique.
20    *
21    * @author Michael Meyling
22    */
 
23    public final class LogicalState implements State {
24   
25    /** Unchecked. */
26    public static final LogicalState STATE_UNCHECKED
27    = new LogicalState(LogicalStateDescriptions.STATE_STRING_UNCHECKED,
28    false, LogicalStateDescriptions.STATE_CODE_UNCHECKED);
29   
30    /** External checking. */
31    public static final LogicalState STATE_EXTERNAL_CHECKING
32    = new LogicalState(LogicalStateDescriptions.STATE_STRING_EXTERNAL_CHECKING,
33    false, LogicalStateDescriptions.STATE_CODE_EXTERNAL_CHECKING);
34   
35    /** External checking failed. */
36    public static final LogicalState STATE_EXTERNAL_CHECKING_FAILED
37    = new LogicalState(LogicalStateDescriptions.STATE_STRING_EXTERNAL_CHECKING_FAILED,
38    true, LogicalStateDescriptions.STATE_CODE_EXTERNAL_CHECKING_FAILED);
39   
40    /** Internal checking phase. */
41    public static final LogicalState STATE_INTERNAL_CHECKING
42    = new LogicalState(LogicalStateDescriptions.STATE_STRING_INTERNAL_CHECKING,
43    false, LogicalStateDescriptions.STATE_CODE_INTERNAL_CHECKING);
44   
45    /** Internal check failed. */
46    public static final LogicalState STATE_INTERNAL_CHECKING_FAILED
47    = new LogicalState(LogicalStateDescriptions.STATE_STRING_INTERNAL_CHECKING_FAILED,
48    true, LogicalStateDescriptions.STATE_CODE_INTERNAL_CHECKING_FAILED);
49   
50   
51    /** Successfully completely checked. */
52    public static final LogicalState STATE_CHECKED
53    = new LogicalState(LogicalStateDescriptions.STATE_STRING_COMPLETELY_CHECKED,
54    false, LogicalStateDescriptions.STATE_CODE_COMPLETELY_CHECKED);
55   
56   
57    /** meaning of this state. */
58    private final String text;
59   
60    /** is this state a failure? */
61    private final boolean failure;
62   
63    /** Code for state. */
64    private final int code;
65   
66    /**
67    * Creates new module state.
68    *
69    * @param text meaning of this state, <code>null</code> is not permitted.
70    * @param failure is this a failure state?
71    * @param code code of this state.
72    * @throws IllegalArgumentException text == <code>null</code>
73    */
 
74  66 toggle private LogicalState(final String text, final boolean failure, final int code) {
75  66 this.text = text;
76  66 if (this.text == null) {
77  0 throw new IllegalArgumentException("text==null");
78    }
79  66 this.failure = failure;
80  66 this.code = code;
81    }
82   
 
83  441 toggle public String getText() {
84  441 return this.text;
85    }
86   
 
87  1445 toggle public boolean isFailure() {
88  1445 return this.failure;
89    }
90   
 
91  0 toggle public int getCode() {
92  0 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  1 toggle public boolean equals(final Object obj) {
104    // every instance is unique
105  1 return (this == obj);
106    }
107   
108    }