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)
  • 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