Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../img/srcFileCovDistChart0.png 88% of files have more coverage
12   74   9   6
8   30   0,75   2
2     4,5  
1    
 
  LogicalEquivalence       Line # 35 12 9 0% 0.0
 
No Tests
 
1    /* $Id: LogicalEquivalence.java,v 1.1 2008/07/26 07:58:30 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.bo.logic;
19   
20    import org.qedeq.kernel.base.list.Element;
21    import org.qedeq.kernel.bo.logic.wf.FormulaCheckException;
22    import org.qedeq.kernel.bo.logic.wf.LogicalCheckException;
23    import org.qedeq.kernel.bo.logic.wf.Operators;
24   
25   
26    /**
27    * This class deals with {@link org.qedeq.kernel.base.list.Element}s and could check
28    * if two formulas are logically equivalent.
29    *
30    * LATER mime 20050205: work in progress
31    *
32    * @version $Revision: 1.1 $
33    * @author Michael Meyling
34    */
 
35    public final class LogicalEquivalence {
36   
37    /**
38    * Constructor.
39    */
 
40  0 toggle private LogicalEquivalence() {
41    // nothing to do
42    }
43   
44    /**
45    * Assures that two words are logically equivalent.
46    *
47    * @param formula1 First formula.
48    * @param formula2 Second formula.
49    * @throws LogicalCheckException Check failed.
50    */
 
51  0 toggle public static final void checkEquivalence(final Element formula1,
52    final Element formula2)
53    throws LogicalCheckException {
54  0 if (formula1.equals(formula2)) {
55  0 return;
56    }
57  0 if (formula1.isAtom() || formula2.isAtom()) {
58  0 return; // LATER mime 20050330: where is the check???
59    }
60  0 final String op1 = formula1.getList().getOperator();
61  0 final String op2 = formula2.getList().getOperator();
62  0 if (op1.equals(op2) && (op1.equals(Operators.CONJUNCTION_OPERATOR)
63    || op1.equals(Operators.DISJUNCTION_OPERATOR))) {
64  0 final EqualFormulaSet sub1 = new EqualFormulaSet(formula1.getList());
65  0 final EqualFormulaSet sub2 = new EqualFormulaSet(formula2.getList());
66  0 if (sub1.equals(sub2)) {
67  0 return;
68    }
69   
70    }
71  0 throw new FormulaCheckException(61, "no logical equivalence found", formula2, null);
72    }
73   
74    }