/** * Create and return a new requirement ({@link IRequirement}) with the specified values. * * @param requirement the match expression * @param filter the filter, or <code>null</code> * @param minCard minimum cardinality * @param maxCard maximum cardinality * @param greedy <code>true</code> if the requirement should be considered greedy and <code>false</code> otherwise * @param description a <code>String</code> description of the requirement, or <code>null</code> * @return the requirement */ public static IRequirement createRequirement(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy, String description) { return new RequiredCapability(requirement, filter, minCard, maxCard, greedy, description); }
/** * Create and return a new requirement ({@link IRequirement}) with the specified values. * * @param requirement the match expression * @param filter The filter used to evaluate whether this capability is applicable in the * current environment, or <code>null</code> to indicate this capability is always applicable * @param minCard minimum cardinality * @param maxCard maximum cardinality * @param greedy <code>true</code> if the requirement should be considered greedy and <code>false</code> otherwise * @return the requirement */ public static IRequirement createRequirement(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy) { return new RequiredCapability(requirement, filter, minCard, maxCard, greedy, null); }
/** * Create and return a new requirement ({@link IRequirement}) with the specified values. * * @param namespace the namespace for the requirement. Must not be <code>null</code>. * @param name the name for the requirement. Must not be <code>null</code>. * @param range the version range. A value of <code>null</code> is equivalent to {@link VersionRange#emptyRange} and matches all versions. * @param filter The filter used to evaluate whether this capability is applicable in the * current environment, or <code>null</code> to indicate this capability is always applicable * @param optional <code>true</code> if this requirement is optional, and <code>false</code> otherwise. * @param multiple <code>true</code> if this requirement can be satisfied by multiple provided capabilities, or <code>false</code> * if it requires exactly one match * @param greedy <code>true</code> if the requirement should be considered greedy and <code>false</code> otherwise * @return the requirement */ public static IRequirement createRequirement(String namespace, String name, VersionRange range, String filter, boolean optional, boolean multiple, boolean greedy) { return new RequiredCapability(namespace, name, range, filter, optional, multiple, greedy); }
/** * Create and return a new requirement ({@link IRequirement}) with the specified values. * * @param namespace the namespace for the requirement. Must not be <code>null</code>. * @param name the name for the requirement. Must not be <code>null</code>. * @param range the version range. A value of <code>null</code> is equivalent to {@link VersionRange#emptyRange} and matches all versions. * @param filter The filter used to evaluate whether this capability is applicable in the * current environment, or <code>null</code> to indicate this capability is always applicable * @param minCard minimum cardinality * @param maxCard maximum cardinality * @param greedy <code>true</code> if the requirement should be considered greedy and <code>false</code> otherwise * @return the requirement */ public static IRequirement createRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy) { return new RequiredCapability(namespace, name, range, filter, minCard, maxCard, greedy, null); }
/** * Create and return a new requirement ({@link IRequirement}) with the specified values. * * @param namespace the namespace for the requirement. Must not be <code>null</code>. * @param name the name for the requirement. Must not be <code>null</code>. * @param range the version range. A value of <code>null</code> is equivalent to {@link VersionRange#emptyRange} and matches all versions. * @param filter The filter used to evaluate whether this capability is applicable in the * current environment, or <code>null</code> to indicate this capability is always applicable * @param minCard minimum cardinality * @param maxCard maximum cardinality * @param greedy <code>true</code> if the requirement should be considered greedy and <code>false</code> otherwise * @param description a <code>String</code> description of the requirement, or <code>null</code> * @return the requirement */ public static IRequirement createRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy, String description) { return new RequiredCapability(namespace, name, range, filter, minCard, maxCard, greedy, description); }
/** * Returns a {@link IRequirement} with the given values. * * @param namespace The capability namespace * @param name The required capability name * @param range The range of versions that are required, or <code>null</code> * to indicate that any version will do. * @param filter The filter used to evaluate whether this capability is applicable in the * current environment, or <code>null</code> to indicate this capability is always applicable * @param optional <code>true</code> if this required capability is optional, * and <code>false</code> otherwise. * @param multiple <code>true</code> if this capability can be satisfied by multiple provided capabilities, * or <code>false</code> if it requires exactly one match * @return the requirement */ public static IRequirement createRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, boolean optional, boolean multiple) { return new RequiredCapability(namespace, name, range, filter, optional ? 0 : 1, multiple ? Integer.MAX_VALUE : 1, true, null); }
Collection<IRequirement> requirements = new ArrayList<IRequirement>(); for (IInstallableUnit unit : request.getRemovals()) { RequiredCapability req = new RequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, unit.getId(), new VersionRange(unit.getVersion(), true, unit.getVersion(), true), null, 0, 0, false, null); requirements.add(req);