001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002 *
003 * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
004 *
005 * "Hilbert II" is free software; you can redistribute
006 * it and/or modify it under the terms of the GNU General Public
007 * License as published by the Free Software Foundation; either
008 * version 2 of the License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU General Public License for more details.
014 */
015
016 package org.qedeq.kernel.se.dto.module;
017
018 import org.qedeq.base.utility.EqualsUtility;
019 import org.qedeq.kernel.se.base.module.ChangedRule;
020 import org.qedeq.kernel.se.base.module.LatexList;
021
022
023 /**
024 * Rule change.
025 *
026 * @author Michael Meyling
027 */
028 public class ChangedRuleVo implements ChangedRule {
029
030 /** Further proposition description. Normally <code>null</code>. */
031 private LatexList description;
032
033 /** Rule name. */
034 private String name;
035
036 /** Rule version. */
037 private String version;
038
039 /**
040 * Constructs a new rule declaration.
041 */
042 public ChangedRuleVo() {
043 // nothing to do
044 }
045
046
047 /**
048 * Set rule name.
049 *
050 * @param name Rule name.
051 */
052 public final void setName(final String name) {
053 this.name = name;
054 }
055
056 public final String getName() {
057 return name;
058 }
059
060 /**
061 * Set rule version.
062 *
063 * @param version Rule version.
064 */
065 public final void setVersion(final String version) {
066 this.version = version;
067 }
068
069 public final String getVersion() {
070 return version;
071 }
072
073 /**
074 * Set description.
075 *
076 * @param description Description.
077 */
078 public final void setDescription(final LatexListVo description) {
079 this.description = description;
080 }
081
082 public LatexList getDescription() {
083 return description;
084 }
085
086 public boolean equals(final Object obj) {
087 if (!(obj instanceof ChangedRule)) {
088 return false;
089 }
090 final ChangedRule other = (ChangedRule) obj;
091 return EqualsUtility.equals(getName(), other.getName())
092 && EqualsUtility.equals(getVersion(), other.getVersion())
093 && EqualsUtility.equals(getDescription(), other.getDescription());
094 }
095
096 public int hashCode() {
097 return (getName() != null ? 1 ^ getName().hashCode() : 0)
098 ^ (getVersion() != null ? 2 ^ getVersion().hashCode() : 0)
099 ^ (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 }
|