add .equals/.hashCode

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@359537 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2005-12-28 14:25:34 +00:00
parent 396229f18d
commit ca6b9ee2e5
2 changed files with 30 additions and 0 deletions

View File

@ -18,4 +18,19 @@ public class JakartaRegexpCapabilities implements RegexCapabilities {
char[] prefix = RegexpTunnel.getPrefix(regexp);
return prefix == null ? null : new String(prefix);
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final JakartaRegexpCapabilities that = (JakartaRegexpCapabilities) o;
if (regexp != null ? !regexp.equals(that.regexp) : that.regexp != null) return false;
return true;
}
public int hashCode() {
return (regexp != null ? regexp.hashCode() : 0);
}
}

View File

@ -16,4 +16,19 @@ public class JavaUtilRegexCapabilities implements RegexCapabilities {
public String prefix() {
return null;
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final JavaUtilRegexCapabilities that = (JavaUtilRegexCapabilities) o;
if (pattern != null ? !pattern.equals(that.pattern) : that.pattern != null) return false;
return true;
}
public int hashCode() {
return (pattern != null ? pattern.hashCode() : 0);
}
}