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 and Description
    --- | ---
    `static class` | `VersionPackageConstraint.VersionComparison` Enumeration encapsulating version comparison operations

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `VERSION_KEY` The meta data key for the version number

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VersionPackageConstraint(Package p)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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(java.lang.String version1, java.lang.String version2)` Returns a VersionComparison that represents the comparison between the supplied version 1 and version 2.
    `VersionPackageConstraint.VersionComparison` | `getVersionComparison()`
    `void` | `setVersionConstraint(java.lang.String constraint)`
    `void` | `setVersionConstraint(VersionPackageConstraint.VersionComparison c)`
    `java.lang.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 Detail

    - #### VERSION_KEY

          public static java.lang.String VERSION_KEY

      The meta data key for the version number

  - ### Constructor Detail

    - #### VersionPackageConstraint

          public VersionPackageConstraint(Package p)

  - ### Method Detail

    - #### compare

          public static VersionPackageConstraint.VersionComparison compare(java.lang.String version1,
                                                                           java.lang.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(java.lang.String constraint)

    - #### checkConstraint

          public PackageConstraint checkConstraint(PackageConstraint target)
                                            throws java.lang.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:
        `java.lang.Exception`

    - #### checkConstraint

          public boolean checkConstraint(Package target)
                                  throws java.lang.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:
        `java.lang.Exception` - if the constraint can't be checked for some reason.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`