| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2010 Cloudsmith Inc. 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 |
* Cloudsmith Inc. - initial API and implementation |
| 13 |
*******************************************************************************/ |
| 14 |
package org.eclipse.equinox.p2.metadata.index; |
| 15 |
|
| 16 |
import java.util.Iterator; |
| 17 |
import org.eclipse.equinox.p2.metadata.expression.IEvaluationContext; |
| 18 |
import org.eclipse.equinox.p2.metadata.expression.IExpression; |
| 19 |
|
| 20 |
/** |
| 21 |
* Indexed access to the elements provided by an IQueryable |
| 22 |
* @since 2.0 |
| 23 |
*/ |
| 24 |
public interface IIndex<T> { |
| 25 |
/** |
| 26 |
* Obtains the elements that are candidates for the given <code>booleanExpr</code> when applied |
| 27 |
* using the given <code>variable</code> as <code>this</code>. |
| 28 |
* The returned set of elements are the elements that must be present in order for the expression |
| 29 |
* to evaluate to <code>true</code>. The set may contain false positives. |
| 30 |
* |
| 31 |
* TODO: Write more about how the valid set of elements is determined. |
| 32 |
* |
| 33 |
* @param ctx The evaluation context used when examining the <code>booleanExpr</code>. |
| 34 |
* @param variable The variable used as <code>this</code>. |
| 35 |
* @param booleanExpr The boolean expression. |
| 36 |
* @return The candidate elements or <code>null</code> if this index cannot be used. |
| 37 |
*/ |
| 38 |
Iterator<T> getCandidates(IEvaluationContext ctx, IExpression variable, IExpression booleanExpr); |
| 39 |
} |