/** * Checks whether <code>event</code> is a legal event for this group. An * event is legal if it touches at most one position contained within this * group. * * @param event the document event to check * @return <code>true</code> if <code>event</code> is legal */ boolean isLegalEvent(DocumentEvent event) { fLastPosition= null; fLastRegion= null; for (Iterator<LinkedPosition> it= fPositions.iterator(); it.hasNext(); ) { LinkedPosition pos= it.next(); if (overlapsOrTouches(pos, event)) { if (fLastPosition != null) { fLastPosition= null; fLastRegion= null; return false; } fLastPosition= pos; fLastRegion= new Region(pos.getOffset(), pos.getLength()); } } return true; }
/** * Checks whether <code>event</code> is a legal event for this group. An * event is legal if it touches at most one position contained within this * group. * * @param event the document event to check * @return <code>true</code> if <code>event</code> is legal */ boolean isLegalEvent(DocumentEvent event) { fLastPosition= null; fLastRegion= null; for (LinkedPosition pos : fPositions) { if (overlapsOrTouches(pos, event)) { if (fLastPosition != null) { fLastPosition= null; fLastRegion= null; return false; } fLastPosition= pos; fLastRegion= new Region(pos.getOffset(), pos.getLength()); } } return true; }