Package weka.core.packageManagement

# Class VersionPackageConstraint

java.lang.Object
weka.core.packageManagement.PackageConstraint
weka.core.packageManagement.VersionPackageConstraint

public class VersionPackageConstraint extends PackageConstraint
Concrete implementation of PackageConstraint that encapsulates constraints related to version numbers. Handles equality = and open-ended inequalities (e.g. > x, < x, >= x, <= x).

Version:
  $Revision: 51469 $
Author:
  mhall (mhall{[at]}pentaho{[dot]}com)

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `VersionPackageConstraint.VersionComparison`
  Enumeration encapsulating version comparison operations

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static String`
  `VERSION_KEY`
  The meta data key for the version number

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VersionPackageConstraint(Package p)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `checkConstraint(Package target)`
  Check the target package against the constraint embodied in this PackageConstraint.
  `PackageConstraint`
  `checkConstraint(PackageConstraint target)`
  Check the target package constraint against the constraint embodied in this package constraint.
  `static VersionPackageConstraint.VersionComparison`
  `compare(String version1, String version2)`
  Returns a VersionComparison that represents the comparison between the supplied version 1 and version 2.
  `VersionPackageConstraint.VersionComparison`
  `getVersionComparison()`
  `void`
  `setVersionConstraint(String constraint)`
  `void`
  `setVersionConstraint(VersionPackageConstraint.VersionComparison c)`
  `String`
  `toString()`

  ### Methods inherited from class weka.core.packageManagement.PackageConstraint

  `getPackage, setPackage`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### VERSION_KEY

    public static String VERSION_KEY
    The meta data key for the version number

- ## Constructor Details

  - ### VersionPackageConstraint

    public VersionPackageConstraint(Package p)

- ## Method Details

  - ### compare

    public static VersionPackageConstraint.VersionComparison compare(String version1, String version2)
    Returns a VersionComparison that represents the comparison between the supplied version 1 and version 2.
    Parameters:
      `version1` - String containing version number 1.
      `version2` - String containing version number 2.
    Returns:
      a VersionComparison object.

  - ### setVersionConstraint

    public void setVersionConstraint(VersionPackageConstraint.VersionComparison c)

  - ### getVersionComparison

    public VersionPackageConstraint.VersionComparison getVersionComparison()

  - ### setVersionConstraint

    public void setVersionConstraint(String constraint)

  - ### checkConstraint

    public PackageConstraint checkConstraint(PackageConstraint target) throws Exception
    Check the target package constraint against the constraint embodied in this package constraint. Returns either the package constraint that covers both this and the target constraint, or null if this and the target are incompatible. Try and return the *least* restrictive constraint that satisfies this and the target.
    Specified by:
      `checkConstraint` in class `PackageConstraint`
    Parameters:
      `target` - the package constraint to compare against
    Returns:
      a package constraint that covers this and the supplied constraint, or null if they are incompatible.
    Throws:
      `Exception`

  - ### checkConstraint

    public boolean checkConstraint(Package target) throws Exception
    Check the target package against the constraint embodied in this PackageConstraint.
    Specified by:
      `checkConstraint` in class `PackageConstraint`
    Parameters:
      `target` - a package to check with respect to the encapsulated package and the constraint.
    Returns:
      true if the constraint is met by the target package with respect to the encapsulated package + constraint.
    Throws:
      `Exception` - if the constraint can't be checked for some reason.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`