/** * Enforces the invariant that all positions must be disjoint. * * @param position the position to check * @throws BadLocationException if the disjointness check fails */ private void enforceDisjoint(LinkedPosition position) throws BadLocationException { for (LinkedPosition p : fPositions) { if (p.overlapsWith(position)) throw new BadLocationException(); } }
/** * Enforces the invariant that all positions must be disjoint. * * @param position the position to check * @throws BadLocationException if the disjointness check fails */ private void enforceDisjoint(LinkedPosition position) throws BadLocationException { for (Iterator<LinkedPosition> it= fPositions.iterator(); it.hasNext(); ) { LinkedPosition p= it.next(); if (p.overlapsWith(position)) throw new BadLocationException(); } }
/** * Returns whether this position overlaps with <code>position</code>. * * @param position the position to check. * @return <code>true</code> if this position overlaps with * <code>position</code>,<code>false</code> otherwise */ public boolean overlapsWith(LinkedPosition position) { return position.getDocument() == fDocument && overlapsWith(position.getOffset(), position.getLength()); }
/** * Returns whether this position overlaps with <code>position</code>. * * @param position the position to check. * @return <code>true</code> if this position overlaps with * <code>position</code>,<code>false</code> otherwise */ public boolean overlapsWith(LinkedPosition position) { return position.getDocument() == fDocument && overlapsWith(position.getOffset(), position.getLength()); }