From fa3dae8f4fb19d14dd04f4e00669a215cc6a13c8 Mon Sep 17 00:00:00 2001 From: John Arthorne Date: Sun, 10 Feb 2008 22:46:21 +0000 Subject: Bug 218451 [prov] Rename API packages to provisional API --- .../equinox/p2/core/ProvisionException.java | 101 ------------------ .../p2/core/eventbus/ProvisioningEventBus.java | 81 --------------- .../p2/core/eventbus/ProvisioningListener.java | 18 ---- .../eventbus/SynchronousProvisioningListener.java | 15 --- .../equinox/p2/core/location/AgentLocation.java | 33 ------ .../equinox/p2/core/repository/IRepository.java | 114 --------------------- .../repository/RepositoryCreationException.java | 21 ---- .../org/eclipse/equinox/p2/query/Collector.java | 102 ------------------ .../eclipse/equinox/p2/query/CompoundQuery.java | 67 ------------ .../org/eclipse/equinox/p2/query/IQueryable.java | 36 ------- .../src/org/eclipse/equinox/p2/query/Query.java | 53 ---------- 11 files changed, 641 deletions(-) delete mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/ProvisionException.java delete mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/ProvisioningEventBus.java delete mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/ProvisioningListener.java delete mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/SynchronousProvisioningListener.java delete mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/location/AgentLocation.java delete mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/repository/IRepository.java delete mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/repository/RepositoryCreationException.java delete mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/Collector.java delete mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/CompoundQuery.java delete mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/IQueryable.java delete mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/Query.java (limited to 'bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2') diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/ProvisionException.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/ProvisionException.java deleted file mode 100644 index 4b81dc967..000000000 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/ProvisionException.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.core; - -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.core.Activator; - -/** - * A checked exception indicating a recoverable error occurred while provisioning. - * The status provides a further description of the problem. - *

- * This exception class is not intended to be subclassed by clients. - *

- */ -public class ProvisionException extends CoreException { - private static final long serialVersionUID = 1L; - - //Core status codes [0-100] - /** - * Status code constant (value 1) for an uncategorized error. - */ - public static final int INTERNAL_ERROR = 1; - - //Repository status codes [1000-1999] - - /** - * Status code constant (value 1000) indicating a repository - * unexpectedly does not exist. - */ - public static final int REPOSITORY_NOT_FOUND = 1000; - - /** - * Status code constant (value 1001) indicating a repository - * unexpectedly exists. - */ - public static final int REPOSITORY_EXISTS = 1001; - - /** - * Status code constant (value 1002) indicating a repository - * could not be read - */ - public static final int REPOSITORY_FAILED_READ = 1002; - - /** - * Status code constant (value 1003) indicating a failure occurred - * while writing to a repository. - */ - public static final int REPOSITORY_FAILED_WRITE = 1003; - - /** - * Status code constant (value 1004) indicating a repository - * could not be written because it is a read-only repository. - */ - public static final int REPOSITORY_READ_ONLY = 1004; - - /** - * Status code constant (value 1005) indicating an attempt was - * made to create or access a repository of unknown type. - */ - public static final int REPOSITORY_UNKNOWN_TYPE = 1005; - - /** - * Creates a new exception with the given status object. The message - * of the given status is used as the exception message. - * - * @param status the status object to be associated with this exception - */ - public ProvisionException(IStatus status) { - super(status); - } - - /** - * Creates a new exception with the given message and a severity of - * {@link IStatus#ERROR}. - * - * @param message The human-readable problem message - */ - public ProvisionException(String message) { - super(new Status(IStatus.ERROR, Activator.ID, message)); - } - - /** - * Creates a new exception with the given message and cause, and - * a severity of {@link IStatus#ERROR}. - * - * @param message The human-readable problem message - * @param cause The underlying cause of the exception - */ - public ProvisionException(String message, Throwable cause) { - super(new Status(IStatus.ERROR, Activator.ID, message, cause)); - } - -} diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/ProvisioningEventBus.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/ProvisioningEventBus.java deleted file mode 100644 index e754ea6b0..000000000 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/ProvisioningEventBus.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.core.eventbus; - -import java.util.EventObject; -import org.eclipse.osgi.framework.eventmgr.*; - -//TODO Need to clean up the lifecycle of this class -public class ProvisioningEventBus implements EventDispatcher { - private EventListeners syncListeners = new EventListeners(); - private EventListeners asyncListeners = new EventListeners(); - private EventManager eventManager = new EventManager("Provisioning Event Dispatcher"); //$NON-NLS-1$ - - public void addListener(ProvisioningListener toAdd) { - if (toAdd instanceof SynchronousProvisioningListener) { - synchronized (syncListeners) { - syncListeners.addListener(toAdd, toAdd); - } - } else { - synchronized (asyncListeners) { - asyncListeners.addListener(toAdd, toAdd); - } - } - } - - public void removeListener(ProvisioningListener toRemove) { - if (toRemove instanceof SynchronousProvisioningListener) { - synchronized (syncListeners) { - if (syncListeners != null) { - syncListeners.removeListener(toRemove); - } - } - } else { - synchronized (asyncListeners) { - if (asyncListeners != null) { - asyncListeners.removeListener(toRemove); - } - } - } - } - - public void publishEvent(EventObject event) { - /* queue to hold set of listeners */ - ListenerQueue listeners = new ListenerQueue(eventManager); - - /* synchronize while building the listener list */ - synchronized (syncListeners) { - /* add set of BundleContexts w/ listeners to queue */ - listeners.queueListeners(syncListeners, this); - /* synchronously dispatch to populate listeners queue */ - listeners.dispatchEventSynchronous(0, event); - } - - listeners = new ListenerQueue(eventManager); - synchronized (asyncListeners) { - listeners.queueListeners(asyncListeners, this); - listeners.dispatchEventAsynchronous(0, event); - } - } - - public void dispatchEvent(Object eventListener, Object listenerObject, int eventAction, Object eventObject) { - try { - ((ProvisioningListener) eventListener).notify((EventObject) eventObject); - } catch (Exception e) { - e.printStackTrace(); - //TODO Need to do the appropriate logging - } - } - - public void close() { - eventManager.close(); - } -} diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/ProvisioningListener.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/ProvisioningListener.java deleted file mode 100644 index 46e451208..000000000 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/ProvisioningListener.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.core.eventbus; - -import java.util.EventListener; -import java.util.EventObject; - -public interface ProvisioningListener extends EventListener { - public void notify(EventObject o); -} diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/SynchronousProvisioningListener.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/SynchronousProvisioningListener.java deleted file mode 100644 index db312a2a3..000000000 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/eventbus/SynchronousProvisioningListener.java +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.core.eventbus; - -public interface SynchronousProvisioningListener extends ProvisioningListener { - -} diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/location/AgentLocation.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/location/AgentLocation.java deleted file mode 100644 index 6f0988e1d..000000000 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/location/AgentLocation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.core.location; - -import java.net.URL; -import org.eclipse.osgi.service.datalocation.Location; - -/** - * TODO: We are not allowed to extend Location because it's not intended - * to be implemented by clients. - */ -public interface AgentLocation extends Location { - - public URL getArtifactRepositoryURL(); - - public URL getMetadataRepositoryURL(); - - /** - * Returns the location where the bundle with the given namespace - * may write its agent-related data. - * @param namespace The namespace of the bundle storing the data - * @return The data location - */ - public URL getDataArea(String namespace); -} diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/repository/IRepository.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/repository/IRepository.java deleted file mode 100644 index 10206e141..000000000 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/repository/IRepository.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.core.repository; - -import java.net.URL; -import java.util.Map; -import org.eclipse.core.runtime.IAdaptable; - -/** - * Base interface that defines common properties that may be provided by - * various kinds of repositories. - *

- * This interface is not intended to be implemented by clients. - */ -public interface IRepository extends IAdaptable { - /** - * The property key for a boolean property indicating that the repository - * is a system repository. System repositories are implementation details - * that are not subject to general access, hidden from the typical user, etc. - */ - static public String PROP_SYSTEM = "p2.system"; //$NON-NLS-1$ - - /** - * The key for a boolean property indicating that repository metadata is - * stored in compressed form. A compressed repository will have lower - * bandwidth cost to read when remote, but higher processing cost to - * uncompress when reading. - */ - public static final String PROP_COMPRESSED = "p2.compressed"; //$NON-NLS-1$ - - /** - * Returns the URL of the repository. - * TODO: Should we use URL or URI? URL requires a protocol handler - * to be installed in Java. Can the URL have any protocol? - * @return the URL of the repository. - */ - public URL getLocation(); - - /** - * Returns the name of the repository. - * @return the name of the repository. - */ - public String getName(); - - /** - * Returns a string representing the type of the repository. - * @return the type of the repository. - */ - public String getType(); - - /** - * Returns a string representing the version for the repository type. - * @return the version of the type of the repository. - */ - public String getVersion(); - - /** - * Returns a brief description of the repository. - * @return the description of the repository. - */ - public String getDescription(); - - /** - * Returns the name of the provider of the repository. - * @return the provider of this repository. - */ - public String getProvider(); - - /** - * Returns a read-only collection of the properties of the repository. - * @return the properties of this repository. - */ - public Map getProperties(); - - /** - * Returns true if this repository can be modified. - * @return whether or not this repository can be modified - */ - public boolean isModifiable(); - - /** - * Set the name of the repository. - */ - public void setName(String name); - - /** - * Sets the description of the repository. - */ - public void setDescription(String description); - - /** - * Sets the value of the property with the given key. Returns the old property - * associated with that key, if any. Setting a value of null will - * remove the corresponding key from the properties of this repository. - * - * @param key The property key - * @param value The new property value, or null to remove the key - * @return The old property value, or null if there was no old value - */ - public String setProperty(String key, String value); - - /** - * Sets the name of the provider of the repository. - */ - public void setProvider(String provider); -} diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/repository/RepositoryCreationException.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/repository/RepositoryCreationException.java deleted file mode 100644 index b121a4747..000000000 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/repository/RepositoryCreationException.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.core.repository; - -public class RepositoryCreationException extends Exception { - - private static final long serialVersionUID = -5648382121963317100L; - - public RepositoryCreationException(Throwable e) { - super(e); - } - -} diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/Collector.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/Collector.java deleted file mode 100644 index 33634602c..000000000 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/Collector.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.query; - -import java.lang.reflect.Array; -import java.util.*; - -/** - * A collector is a generic visitor that collects objects passed to it, - * and can then express the result of the visit in various forms. The collector - * can also short-circuit a traversal by returning false from - * its {@link #accept(Object)} method. - *

- * This default collector just accepts all objects passed to it. Clients may subclass - * to perform different processing on the objects passed to it. - */ -public class Collector { - private ArrayList collected = null; - - /** - * Creates a new collector. - */ - public Collector() { - super(); - } - - /** - * Accepts an object. - *

- * This default implementation adds the objects to a list. Clients may - * override this method to perform additional filtering, add different objects - * to the list, short-circuit the traversal, or process the objects directly without - * collecting them. - * - * @param object the object to collect or visit - * @return true if the traversal should continue, - * or false to indicate the traversal should stop. - */ - public boolean accept(Object object) { - getList().add(object); - return true; - } - - /** - * Returns the list that is being used to collect results. - * @return the list being used to collect results. - */ - protected List getList() { - if (collected == null) - collected = new ArrayList(); - return collected; - } - - /** - * Returns whether this collector is empty. - * @return true if this collector has accepted any results, - * and false otherwise. - */ - public boolean isEmpty() { - return collected == null || collected.isEmpty(); - } - - /** - * Returns an iterator on the collected objects. - * - * @return an iterator of the collected objects. - */ - public Iterator iterator() { - return collected == null ? Collections.EMPTY_LIST.iterator() : collected.iterator(); - } - - /** - * Returns the number of collected objects. - */ - public int size() { - return collected == null ? 0 : collected.size(); - } - - /** - * Returns the collected objects as an array - * - * @param clazz The type of array to return - * @return The array of results - * @throws ArrayStoreException the runtime type of the specified array is - * not a supertype of the runtime type of every collected object - */ - public Object[] toArray(Class clazz) { - int size = collected == null ? 0 : collected.size(); - Object[] result = (Object[]) Array.newInstance(clazz, size); - if (size != 0) - collected.toArray(result); - return result; - } -} diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/CompoundQuery.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/CompoundQuery.java deleted file mode 100644 index f755b7d49..000000000 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/CompoundQuery.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.query; - -/** - * A query that combines a group of other queries. - */ -public class CompoundQuery extends Query { - private boolean and; - private Query[] queries; - - /** - * Creates a compound query that combines the given queries. The queries - * will be performed by the compound query in the given order. This method - * might not perform all queries if it can determine the result of the compound - * expression without doing so. - * - * @param queries The queries to perform - * @param and true if this query represents a logical 'and', and - * false if this query represents a logical 'or'. - */ - public CompoundQuery(Query[] queries, boolean and) { - this.queries = queries; - this.and = and; - } - - public Query[] getQueries() { - return queries; - } - - /** - * Returns whether this compound query combines its queries with a logical - * 'and' or 'or'. - * @return true if this query represents a logical 'and', and - * false if this query represents a logical 'or'. - */ - public boolean isAnd() { - return and; - } - - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.query2.Query#isMatch(java.lang.Object) - */ - public boolean isMatch(Object candidate) { - for (int i = 0; i < queries.length; i++) { - boolean valid = queries[i].isMatch(candidate); - // if we are OR'ing then the first time we find a requirement that is met, return success - if (valid && !and) - return true; - // if we are AND'ing then the first time we find a requirement that is NOT met, return failure - if (!valid && and) - return false; - } - // if we get past the requirements check and we are AND'ing then return true - // since all requirements must have been met. If we are OR'ing then return false - // since none of the requirements were met. - return and; - } -} diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/IQueryable.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/IQueryable.java deleted file mode 100644 index b40c3e111..000000000 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/IQueryable.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.query; - -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * An IQueryable contains objects, and is able to perform queries on those objects. - *

- * This interface may be implemented by clients. - */ -public interface IQueryable { - /** - * Performs a query, passing any objects that satisfy the - * query to the provided collector. - *

- * This method is long-running; progress and cancellation are provided - * by the given progress monitor. - *

- * - * @param query The query to perform - * @param collector Collects the results of the query - * @param monitor a progress monitor, or null if progress - * reporting is not desired - * @return The collector argument - */ - public Collector query(Query query, Collector collector, IProgressMonitor monitor); -} diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/Query.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/Query.java deleted file mode 100644 index 3e619a55e..000000000 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/query/Query.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.query; - -import java.util.Iterator; - -/** - * The superclass of all queries that can be performed on an {@link IQueryable}. - *

- * This class may be subclassed by clients. Subclasses should specify the type - * of object they support querying on. Subclasses are also encouraged to clearly - * specify their match algorithm, and expose the parameters involved in the match - * computation, to allow {@link IQueryable} implementations to optimize their - * execution of the query. - */ -public abstract class Query { - /** - * Creates a new query. - */ - public Query() { - super(); - } - - /** - * Returns whether the given object satisfies the parameters of this query. - * - * @param candidate The object to perform the query against - * @return true if the unit satisfies the parameters - * of this query, and false otherwise - */ - public abstract boolean isMatch(Object candidate); - - /** - * Performs this query on the given iterator, passing all objects in the iterator - * that match the criteria of this query to the given result. - */ - public Collector perform(Iterator iterator, Collector result) { - while (iterator.hasNext()) { - Object candidate = iterator.next(); - if (isMatch(candidate)) - result.accept(candidate); - } - return result; - } -} -- cgit v1.2.3