/** * Returns <code>true</code> if a line given by the first index * matches a line specified by the other <code>IRangeComparator</code> and index. * * @param thisIndex the number of the line within this range comparator * @param otherComparator the range comparator to compare this with * @param otherIndex the number of the line within the other comparator * @return <code>true</code> if the lines are equal */ @Override public boolean rangesEqual(int thisIndex, IRangeComparator otherComparator, int otherIndex) { if (otherComparator != null && otherComparator.getClass() == getClass()) { DocLineComparator other= (DocLineComparator) otherComparator; if (fIgnoreWhiteSpace) { String[] linesToCompare = extract(thisIndex, otherIndex, other, false); return compare(linesToCompare[0], linesToCompare[1]); } int tlen= getTokenLength(thisIndex); int olen= other.getTokenLength(otherIndex); if (fCompareFilters != null && fCompareFilters.length > 0) { String[] linesToCompare = extract(thisIndex, otherIndex, other, true); return linesToCompare[0].equals(linesToCompare[1]); } else if (tlen == olen) { String[] linesToCompare = extract(thisIndex, otherIndex, other, false); return linesToCompare[0].equals(linesToCompare[1]); } } return false; }
/** * Returns <code>true</code> if a line given by the first index * matches a line specified by the other <code>IRangeComparator</code> and index. * * @param thisIndex the number of the line within this range comparator * @param otherComparator the range comparator to compare this with * @param otherIndex the number of the line within the other comparator * @return <code>true</code> if the lines are equal */ public boolean rangesEqual(int thisIndex, IRangeComparator otherComparator, int otherIndex) { if (otherComparator != null && otherComparator.getClass() == getClass()) { DocLineComparator other= (DocLineComparator) otherComparator; if (fIgnoreWhiteSpace) { String s1= extract(thisIndex); String s2= other.extract(otherIndex); //return s1.trim().equals(s2.trim()); return compare(s1, s2); } int tlen= getTokenLength(thisIndex); int olen= other.getTokenLength(otherIndex); if (tlen == olen) { String s1= extract(thisIndex); String s2= other.extract(otherIndex); return s1.equals(s2); } } return false; }