/** * Compares instance of this rectangle with given deviation equals to 0.0001 * * @param that the {@link Rectangle} to compare with. * @return {@code true} if the difference between corresponding rectangle values is less than deviation and {@code false} otherwise. */ public boolean equalsWithEpsilon(Rectangle that) { return equalsWithEpsilon(that, EPS); }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (getClass() != obj.getClass()) { return false; } LayoutArea that = (LayoutArea) obj; return pageNumber == that.pageNumber && bBox.equalsWithEpsilon(that.bBox); }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (getClass() != obj.getClass()) { return false; } LayoutArea that = (LayoutArea) obj; return pageNumber == that.pageNumber && bBox.equalsWithEpsilon(that.bBox); }
private void removeDuplicates(List<IPdfTextLocation> sortedList) { IPdfTextLocation lastItem = null; int orgSize = sortedList.size(); for (int i = orgSize - 1; i >= 0; i--) { IPdfTextLocation currItem = sortedList.get(i); Rectangle currRect = currItem.getRectangle(); if (lastItem != null && currRect.equalsWithEpsilon(lastItem.getRectangle())) { sortedList.remove(currItem); } lastItem = currItem; } }