/** * Evaluates the predicate returning true if the input equals the stored value. * * @param object the input object * @return true if input object equals stored value */ public boolean evaluate(final T object) { if (equator != null) { return equator.equate(iValue, object); } else { return iValue.equals(object); } }
@Override public boolean equals(final Object obj) { if (!(obj instanceof EquatorWrapper)) { return false; } @SuppressWarnings("unchecked") final EquatorWrapper<O> otherObj = (EquatorWrapper<O>) obj; return equator.equate(object, otherObj.getObject()); }
/** * Build a snake. * * @param start the value of the start of the snake * @param diag the value of the diagonal of the snake * @param end1 the value of the end of the first sequence to be compared * @param end2 the value of the end of the second sequence to be compared * @return the snake built */ private Snake buildSnake(final int start, final int diag, final int end1, final int end2) { int end = start; while (end - diag < end2 && end < end1 && equator.equate(sequence1.get(end), sequence2.get(end - diag))) { ++end; } return new Snake(start, end, diag); }
int j = start2; while (i < end1 || j < end2) { if (i < end1 && j < end2 && equator.equate(sequence1.get(i), sequence2.get(j))) { script.append(new KeepCommand<T>(sequence1.get(i))); ++i;