/** * Adds a number of Matches to this search result. This method does nothing for matches that are * already present. * * <p>Subclasses may extend this method. * * @param matches the matches to add */ public void addMatches(Match[] matches) { Collection reallyAdded = new ArrayList(); synchronized (fElementsToMatches) { for (int i = 0; i < matches.length; i++) { if (doAddMatch(matches[i])) reallyAdded.add(matches[i]); } } if (!reallyAdded.isEmpty()) fireChange(getSearchResultEvent(reallyAdded, MatchEvent.ADDED)); }
/** * Removes all matches from this search result. * * <p>Subclasses may extend this method. */ public void removeAll() { synchronized (fElementsToMatches) { doRemoveAll(); } fireChange(new RemoveAllEvent(this)); }
/** * Removes the given matches from this search result. This method has no effect for matches that * are not found * * <p>Subclasses may extend this method. * * @param matches the matches to remove */ public void removeMatches(Match[] matches) { Collection existing = new ArrayList(); synchronized (fElementsToMatches) { for (int i = 0; i < matches.length; i++) { if (doRemoveMatch(matches[i])) existing.add(matches[i]); // no duplicate matches at this point } } if (!existing.isEmpty()) fireChange(getSearchResultEvent(existing, MatchEvent.REMOVED)); }
/** * Adds a number of Matches to this search result. This method does nothing for * matches that are already present. * <p> * Subclasses may extend this method. * </p> * @param matches the matches to add */ public void addMatches(Match[] matches) { Collection<Match> reallyAdded= new ArrayList<>(); synchronized (fElementsToMatches) { for (Match match : matches) { if (doAddMatch(match)) reallyAdded.add(match); } } if (!reallyAdded.isEmpty()) fireChange(getSearchResultEvent(reallyAdded, MatchEvent.ADDED)); }
/** * Adds a number of Matches to this search result. This method does nothing for * matches that are already present. * <p> * Subclasses may extend this method. * </p> * @param matches the matches to add */ public void addMatches(Match[] matches) { Collection reallyAdded= new ArrayList(); synchronized (fElementsToMatches) { for (int i = 0; i < matches.length; i++) { if (doAddMatch(matches[i])) reallyAdded.add(matches[i]); } } if (!reallyAdded.isEmpty()) fireChange(getSearchResultEvent(reallyAdded, MatchEvent.ADDED)); }
/** * Removes the given matches from this search result. This method has no * effect for matches that are not found * <p> * Subclasses may extend this method. * </p> * * @param matches the matches to remove */ public void removeMatches(Match[] matches) { Collection existing= new ArrayList(); synchronized (fElementsToMatches) { for (int i = 0; i < matches.length; i++) { if (doRemoveMatch(matches[i])) existing.add(matches[i]); // no duplicate matches at this point } } if (!existing.isEmpty()) fireChange(getSearchResultEvent(existing, MatchEvent.REMOVED)); }
/** * Removes the given matches from this search result. This method has no * effect for matches that are not found * <p> * Subclasses may extend this method. * </p> * * @param matches the matches to remove */ public void removeMatches(Match[] matches) { Collection<Match> existing= new ArrayList<>(); synchronized (fElementsToMatches) { for (Match match : matches) { if (doRemoveMatch(match)) existing.add(match); // no duplicate matches at this point } } if (!existing.isEmpty()) fireChange(getSearchResultEvent(existing, MatchEvent.REMOVED)); }
/** * Removes all matches from this search result. * <p> * Subclasses may extend this method. * </p> */ public void removeAll() { synchronized (fElementsToMatches) { doRemoveAll(); } fireChange(new RemoveAllEvent(this)); } private void doRemoveAll() {
/** * Removes all matches from this search result. * <p> * Subclasses may extend this method. * </p> */ public void removeAll() { synchronized (fElementsToMatches) { doRemoveAll(); } fireChange(new RemoveAllEvent(this)); } private void doRemoveAll() {
/** * Adds a <code>Match</code> to this search result. This method does nothing if the match is * already present. * * <p>Subclasses may extend this method. * * @param match the match to add */ public void addMatch(Match match) { boolean hasAdded = false; synchronized (fElementsToMatches) { hasAdded = doAddMatch(match); } if (hasAdded) fireChange(getSearchResultEvent(match, MatchEvent.ADDED)); }
/** * Removes the given match from this search result. This method has no effect if the match is not * found. * * <p>Subclasses may extend this method. * * @param match the match to remove */ public void removeMatch(Match match) { boolean existed = false; synchronized (fElementsToMatches) { existed = doRemoveMatch(match); } if (existed) fireChange(getSearchResultEvent(match, MatchEvent.REMOVED)); }
/** * Removes the given match from this search result. This method has no * effect if the match is not found. * <p> * Subclasses may extend this method. * </p> * @param match the match to remove */ public void removeMatch(Match match) { boolean existed= false; synchronized (fElementsToMatches) { existed= doRemoveMatch(match); } if (existed) fireChange(getSearchResultEvent(match, MatchEvent.REMOVED)); }
/** * Removes the given match from this search result. This method has no * effect if the match is not found. * <p> * Subclasses may extend this method. * </p> * @param match the match to remove */ public void removeMatch(Match match) { boolean existed= false; synchronized (fElementsToMatches) { existed= doRemoveMatch(match); } if (existed) fireChange(getSearchResultEvent(match, MatchEvent.REMOVED)); }
/** * Adds a <code>Match</code> to this search result. This method does nothing if the * match is already present. * <p> * Subclasses may extend this method. * </p> * * @param match the match to add */ public void addMatch(Match match) { boolean hasAdded= false; synchronized (fElementsToMatches) { hasAdded= doAddMatch(match); } if (hasAdded) fireChange(getSearchResultEvent(match, MatchEvent.ADDED)); }
/** * Adds a <code>Match</code> to this search result. This method does nothing if the * match is already present. * <p> * Subclasses may extend this method. * </p> * * @param match the match to add */ public void addMatch(Match match) { boolean hasAdded= false; synchronized (fElementsToMatches) { hasAdded= doAddMatch(match); } if (hasAdded) fireChange(getSearchResultEvent(match, MatchEvent.ADDED)); }
private void updateFilterStateForAllMatches() { boolean disableFiltering = getActiveMatchFilters() == null; ArrayList changed = new ArrayList(); Object[] elements = getElements(); for (int i = 0; i < elements.length; i++) { Match[] matches = getMatches(elements[i]); for (int k = 0; k < matches.length; k++) { if (disableFiltering || updateFilterState(matches[k])) { changed.add(matches[k]); } } } Match[] allChanges = (Match[]) changed.toArray(new Match[changed.size()]); fireChange(new FilterUpdateEvent(this, allChanges, getActiveMatchFilters())); }
private void updateFilterStateForAllMatches() { boolean disableFiltering= getActiveMatchFilters() == null; ArrayList changed= new ArrayList(); Object[] elements= getElements(); for (int i= 0; i < elements.length; i++) { Match[] matches= getMatches(elements[i]); for (int k= 0; k < matches.length; k++) { if (disableFiltering || updateFilterState(matches[k])) { changed.add(matches[k]); } } } Match[] allChanges= (Match[]) changed.toArray(new Match[changed.size()]); fireChange(new FilterUpdateEvent(this, allChanges, getActiveMatchFilters())); }
private void updateFilterStateForAllMatches() { boolean disableFiltering= getActiveMatchFilters() == null; ArrayList<Match> changed= new ArrayList<>(); Object[] elements= getElements(); for (Object element : elements) { Match[] matches= getMatches(element); for (Match match : matches) { if (disableFiltering || updateFilterState(match)) { changed.add(match); } } } Match[] allChanges= changed.toArray(new Match[changed.size()]); fireChange(new FilterUpdateEvent(this, allChanges, getActiveMatchFilters())); }