/** * Indicates if this Factor is the reciprocal of another Factor. * * @param that * The other factor. * @return <code>true</code> if and only if this Factor is the reciprocal of * <code>that</code>. */ public boolean isReciprocalOf(final Factor that) { return getBase().equals(that.getBase()) && getExponent() == -that.getExponent(); }
/** * Indicates if this Factor is the reciprocal of another Factor. * * @param that * The other factor. * @return <code>true</code> if and only if this Factor is the reciprocal of * <code>that</code>. */ public boolean isReciprocalOf(final Factor that) { return getBase().equals(that.getBase()) && getExponent() == -that.getExponent(); }
/** * Indicates if this Factor is semantically identical to another object. * * @param object * The object. * @return <code>true</code> if and only if this Factor is semantically * identical to <code>object< * /code>. */ @Override public boolean equals(final Object object) { boolean equals; if (this == object) { equals = true; } else if (!(object instanceof Factor)) { equals = false; } else { final Factor that = (Factor) object; equals = getExponent() != that.getExponent() ? false : getExponent() == 0 || getBase().equals(that.getBase()); } return equals; }
/** * Indicates if this Factor is semantically identical to another object. * * @param object * The object. * @return <code>true</code> if and only if this Factor is semantically * identical to <code>object< * /code>. */ @Override public boolean equals(final Object object) { boolean equals; if (this == object) { equals = true; } else if (!(object instanceof Factor)) { equals = false; } else { final Factor that = (Factor) object; equals = getExponent() != that.getExponent() ? false : getExponent() == 0 || getBase().equals(that.getBase()); } return equals; }