Debian Codegraph @

bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IRequirement.java

raw
1 /*******************************************************************************
2 * Copyright (c) 2009, 2012 IBM and others.
3 *
4 * This
5 * program and the accompanying materials are made available under the terms of
6 * the Eclipse Public License 2.0 which accompanies this distribution, and is
7 * available at
8 * https://www.eclipse.org/legal/epl-2.0/
9 *
10 * SPDX-License-Identifier: EPL-2.0
11 *
12 * Contributors:
13 * IBM - initial API and implementation
14 ******************************************************************************/
15 package org.eclipse.equinox.p2.metadata;
16
17 import org.eclipse.equinox.p2.metadata.expression.IMatchExpression;
18
19 /**
20 * A requirement represents some external constraint on an {@link IInstallableUnit}.
21 * Each requirement represents something an {@link IInstallableUnit} needs that
22 * it expects to be provided by another {@link IInstallableUnit}. Requirements are
23 * entirely generic, and are intended to be capable of representing anything that
24 * an {@link IInstallableUnit} may need either at install time, or at runtime.
25 * <p>
26 * Instances of this class are handle objects and do not necessarily
27 * reflect entities that exist in any particular profile or repository. These handle
28 * objects can be created using {@link MetadataFactory}.
29 * </p>
30 *
31 * @noimplement This interface is not intended to be implemented by clients.
32 * @noextend This interface is not intended to be extended by clients.
33 * @since 2.0
34 * @see IProvidedCapability
35 * @see MetadataFactory#createRequirement(String, String, VersionRange, String, boolean, boolean, boolean)
36 */
37 public interface IRequirement {
38
39 /**
40 * Returns the minimum cardinality of the requirement. That is, the minimum
41 * number of capabilities that must be provided that match this requirement before
42 * this requirement is considered fully satisfied. A minimum cardinality of 0 indicates
43 * that the requirement is optional.
44 *
45 * @return the minimum cardinality of this requirement
46 */
47 int getMin();
48
49 /**
50 * Returns the maximum cardinality of the requirement. That is, the maximum
51 * number of capabilities that are permitted to be present that satisfy this requirement.
52 * A maximum cardinality of 0 indicates that there must <em>not</em> be
53 * any installable unit in the system that satisfies this requirement.
54 *
55 * @return the maximum cardinality of this requirement
56 */
57 int getMax();
58
59 /**
60 * @noreference This method is not intended to be referenced by clients.
61 * @since 2.0
62 */
63 IMatchExpression<IInstallableUnit> getFilter();
64
65 /**
66 * Returns a boolean match expression that will return true for any
67 * {@link IInstallableUnit} that matches the requirement.
68 * @return A boolean match expression for installable unit matching.
69 */
70 IMatchExpression<IInstallableUnit> getMatches();
71
72 /**
73 * Returns whether the provided capabilities of the given installable unit satisfy
74 * this requirement.
75 *
76 * @param iu the installable unit to check for matching capabilities
77 * @return <code>true</code> if the given installable unit satisfies this
78 * requirement, and <code>false</code> otherwise.
79 */
80 boolean isMatch(IInstallableUnit iu);
81
82 /**
83 * Returns whether this requirement should cause extra installable units
84 * to be installed in order to satisfy it.
85 * @return <code>true</code> if additional installable units should be installed
86 * to satisfy this requirement, and <code>false</code> otherwise
87 */
88 boolean isGreedy();
89
90 /**
91 * Returns a textual description of this requirement.
92 *
93 * @return a textual description of this requirement
94 */
95 String getDescription();
96
97 }