Skip to main content
summaryrefslogtreecommitdiffstats
blob: e72f44e9a98f3689d1f6807113ee2ae04139f4ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*******************************************************************************
 * Copyright (c) 2007, 2010 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     EclipseSource - ongoing development
 *******************************************************************************/
package org.eclipse.equinox.p2.query;

import java.util.Iterator;
import org.eclipse.equinox.p2.metadata.expression.IExpression;

/**
 * The root interface for all queries that can be performed on an {@link IQueryable}.
 * A query is a piece of logic that selects some objects from a list of provided
 * inputs using some established criteria.
 * <p>
 * Any given query must be stable - running the same query on the same inputs
 * must return an equal query result each time the query is executed. Thus a client
 * that has performed a query can freely cache the result as long as they know the
 * query input has not changed.
 * </p>
 * 
 * @param <T> The type of input object that this query accepts
 * @noimplement This interface is not intended to be implemented directly by clients.
 * @noextend This interface is not intended to be extended directly by clients.
 * @since 2.0
 */
public interface IQuery<T> {
	/**
	 * Evaluates the query for a specific input.  
	 * 
	 * @param iterator The elements for which to evaluate the query on
	 * @return The results of the query.
	 */
	IQueryResult<T> perform(Iterator<T> iterator);

	/**
	 * Returns the IExpression backing this query or <code>null</code> if
	 * this is not an expression query.
	 * @return An expression or <code>null</code>.
	 */
	IExpression getExpression();
}

Back to the top