- Revision
- 665
- Author
- felix
- Date
- 2007-01-08 09:16:52 -0600 (Mon, 08 Jan 2007)
Log Message
[fl] fixed equals method
Modified Paths
Diff
Modified: trunk/plugins/eclipse/org.jbehave.plugin.eclipse/src/main/java/org/jbehave/plugin/eclipse/ConfigurationState.java (664 => 665)
--- trunk/plugins/eclipse/org.jbehave.plugin.eclipse/src/main/java/org/jbehave/plugin/eclipse/ConfigurationState.java 2007-01-05 15:29:26 UTC (rev 664) +++ trunk/plugins/eclipse/org.jbehave.plugin.eclipse/src/main/java/org/jbehave/plugin/eclipse/ConfigurationState.java 2007-01-08 15:16:52 UTC (rev 665) @@ -48,17 +48,42 @@ config.setAttribute(JBehaveLaunchConfiguration.ATTR_BEHAVIOUR_METHOD, behaviorMethodName); } - public boolean equals(Object object) { - boolean result = false; - if (object instanceof ConfigurationState) { - ConfigurationState that = (ConfigurationState) object; - result = projectName.equals(that.projectName) && - behaviorClassName.equals(that.behaviorClassName) && - behaviorMethodName.equals(that.behaviorMethodName); - } + + public int hashCode() { + final int PRIME = 31; + int result = 1; + result = PRIME * result + ((behaviorClassName == null) ? 0 : behaviorClassName.hashCode()); + result = PRIME * result + ((behaviorMethodName == null) ? 0 : behaviorMethodName.hashCode()); + result = PRIME * result + ((projectName == null) ? 0 : projectName.hashCode()); return result; } + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + final ConfigurationState other = (ConfigurationState) obj; + if (behaviorClassName == null) { + if (other.behaviorClassName != null) + return false; + } else if (!behaviorClassName.equals(other.behaviorClassName)) + return false; + if (behaviorMethodName == null) { + if (other.behaviorMethodName != null) + return false; + } else if (!behaviorMethodName.equals(other.behaviorMethodName)) + return false; + if (projectName == null) { + if (other.projectName != null) + return false; + } else if (!projectName.equals(other.projectName)) + return false; + return true; + } + public String getName() { String name = behaviorMethodName; if (name.length() == 0) {
To unsubscribe from this list please visit:
