diff --git a/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialsUtils.java b/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialsUtils.java index e6e777587..cc08ab38a 100644 --- a/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialsUtils.java +++ b/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialsUtils.java @@ -277,6 +277,20 @@ public class PolynomialsUtils { return (v << 16) ^ w; } + /** Check if the instance represent the same key as another instance. + * @param key other key + * @return true if the instance and the other key refer to the same polynomial + */ + public boolean equals(final Object key) { + + if ((key == null) || !(key instanceof JacobiKey)) { + return false; + } + + final JacobiKey otherK = (JacobiKey) key; + return (v == otherK.v) && (w == otherK.w); + + } } /**