/** * 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 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 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)); }
/** * 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)); }
/** * 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)); }
/** * 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)); }