Debian Codegraph @

bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/IQuery.java

raw
1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * IBM Corporation - initial API and implementation
13 * EclipseSource - ongoing development
14 *******************************************************************************/
15 package org.eclipse.equinox.p2.query;
16
17 import java.util.Iterator;
18 import org.eclipse.equinox.p2.metadata.expression.IExpression;
19
20 /**
21 * The root interface for all queries that can be performed on an {@link IQueryable}.
22 * A query is a piece of logic that selects some objects from a list of provided
23 * inputs using some established criteria.
24 * <p>
25 * Any given query must be stable - running the same query on the same inputs
26 * must return an equal query result each time the query is executed. Thus a client
27 * that has performed a query can freely cache the result as long as they know the
28 * query input has not changed.
29 * </p>
30 *
31 * @param <T> The type of input object that this query accepts
32 * @noimplement This interface is not intended to be implemented directly by clients.
33 * @noextend This interface is not intended to be extended directly by clients.
34 * @since 2.0
35 */
36 public interface IQuery<T> {
37 /**
38 * Evaluates the query for a specific input.
39 *
40 * @param iterator The elements for which to evaluate the query on
41 * @return The results of the query.
42 */
43 IQueryResult<T> perform(Iterator<T> iterator);
44
45 /**
46 * Returns the IExpression backing this query or <code>null</code> if
47 * this is not an expression query.
48 * @return An expression or <code>null</code>.
49 */
50 IExpression getExpression();
51 }