| 1 | /* This file is part of the project "Hilbert II" - http://www.qedeq.org |
| 2 | * |
| 3 | * Copyright 2000-2014, 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.se.dto.module; |
| 17 | |
| 18 | import org.qedeq.base.utility.EqualsUtility; |
| 19 | import org.qedeq.kernel.se.base.module.LatexList; |
| 20 | import org.qedeq.kernel.se.base.module.Proof; |
| 21 | |
| 22 | |
| 23 | /** |
| 24 | * Contains a non formal proof for a proposition or rule. |
| 25 | * |
| 26 | * @author Michael Meyling |
| 27 | */ |
| 28 | public class ProofVo implements Proof { |
| 29 | |
| 30 | /** Kind of proof. */ |
| 31 | private String kind; |
| 32 | |
| 33 | /** Proof detail level. */ |
| 34 | private String level; |
| 35 | |
| 36 | /** LaTeX text for non formal proof. */ |
| 37 | private LatexList nonFormalProof; |
| 38 | |
| 39 | /** |
| 40 | * Constructs an empty proof. |
| 41 | */ |
| 42 | public ProofVo() { |
| 43 | // nothing to do |
| 44 | } |
| 45 | |
| 46 | public String getKind() { |
| 47 | return kind; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Set kind of proof. E.g. "informal". |
| 52 | * |
| 53 | * @param kind Set proof type. |
| 54 | */ |
| 55 | public final void setKind(final String kind) { |
| 56 | this.kind = kind; |
| 57 | } |
| 58 | |
| 59 | public String getLevel() { |
| 60 | return level; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Set proof level. Higher proof levels contain more detailed proofs. |
| 65 | * |
| 66 | * @param level Proof level. |
| 67 | */ |
| 68 | public final void setLevel(final String level) { |
| 69 | this.level = level; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Set LaTeX text for non formal proof. |
| 74 | * |
| 75 | * @param nonFormalProof The proof text. |
| 76 | */ |
| 77 | public final void setNonFormalProof(final LatexList nonFormalProof) { |
| 78 | this.nonFormalProof = nonFormalProof; |
| 79 | } |
| 80 | |
| 81 | public final LatexList getNonFormalProof() { |
| 82 | return nonFormalProof; |
| 83 | } |
| 84 | |
| 85 | public boolean equals(final Object obj) { |
| 86 | if (!(obj instanceof ProofVo)) { |
| 87 | return false; |
| 88 | } |
| 89 | final ProofVo other = (ProofVo) obj; |
| 90 | return EqualsUtility.equals(getKind(), other.getKind()) |
| 91 | && EqualsUtility.equals(getLevel(), other.getLevel()) |
| 92 | && EqualsUtility.equals(getNonFormalProof(), other.getNonFormalProof()); |
| 93 | } |
| 94 | |
| 95 | public int hashCode() { |
| 96 | return (getKind() != null ? getKind().hashCode() : 0) |
| 97 | ^ (getLevel() != null ? 1 ^ getLevel().hashCode() : 0) |
| 98 | ^ (getNonFormalProof() != null ? 2 ^ getNonFormalProof().hashCode() : 0); |
| 99 | } |
| 100 | |
| 101 | public String toString() { |
| 102 | return "Proof (" + getKind() + ", " + getLevel() + "): " + getNonFormalProof(); |
| 103 | } |
| 104 | |
| 105 | } |