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.ChangedRule; |
20 | import org.qedeq.kernel.se.base.module.LatexList; |
21 | |
22 | |
23 | /** |
24 | * Rule change. |
25 | * |
26 | * @author Michael Meyling |
27 | */ |
28 | public class ChangedRuleVo implements ChangedRule { |
29 | |
30 | /** Further proposition description. Normally <code>null</code>. */ |
31 | private LatexList description; |
32 | |
33 | /** Rule name. */ |
34 | private String name; |
35 | |
36 | /** Rule version. */ |
37 | private String version; |
38 | |
39 | /** |
40 | * Constructs a new rule declaration. |
41 | */ |
42 | public ChangedRuleVo() { |
43 | // nothing to do |
44 | } |
45 | |
46 | |
47 | /** |
48 | * Set rule name. |
49 | * |
50 | * @param name Rule name. |
51 | */ |
52 | public final void setName(final String name) { |
53 | this.name = name; |
54 | } |
55 | |
56 | public final String getName() { |
57 | return name; |
58 | } |
59 | |
60 | /** |
61 | * Set rule version. |
62 | * |
63 | * @param version Rule version. |
64 | */ |
65 | public final void setVersion(final String version) { |
66 | this.version = version; |
67 | } |
68 | |
69 | public final String getVersion() { |
70 | return version; |
71 | } |
72 | |
73 | /** |
74 | * Set description. |
75 | * |
76 | * @param description Description. |
77 | */ |
78 | public final void setDescription(final LatexListVo description) { |
79 | this.description = description; |
80 | } |
81 | |
82 | public LatexList getDescription() { |
83 | return description; |
84 | } |
85 | |
86 | public boolean equals(final Object obj) { |
87 | if (!(obj instanceof ChangedRule)) { |
88 | return false; |
89 | } |
90 | final ChangedRule other = (ChangedRule) obj; |
91 | return EqualsUtility.equals(getName(), other.getName()) |
92 | && EqualsUtility.equals(getVersion(), other.getVersion()) |
93 | && EqualsUtility.equals(getDescription(), other.getDescription()); |
94 | } |
95 | |
96 | public int hashCode() { |
97 | return (getName() != null ? 1 ^ getName().hashCode() : 0) |
98 | ^ (getVersion() != null ? 2 ^ getVersion().hashCode() : 0) |
99 | ^ (getDescription() != null ? 4 ^ getDescription().hashCode() : 0); |
100 | } |
101 | |
102 | public String toString() { |
103 | final StringBuffer buffer = new StringBuffer(); |
104 | buffer.append("Rule change: " + getName() + " [" + getVersion() + "]\n"); |
105 | buffer.append("\nDescription:\n"); |
106 | buffer.append(getDescription()); |
107 | return buffer.toString(); |
108 | } |
109 | } |