Package weka.core.packageManagement

# Class PackageConstraint

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

Direct Known Subclasses:
  `VersionPackageConstraint`, `VersionRangePackageConstraint`

public abstract class PackageConstraint extends Object
Abstract base class for package constraints. An example implementation might be to encapsulate a constraint with respect to a version number. Checking against a target in this case would typically assume the same package for both this and the target.

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PackageConstraint()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract boolean`
  `checkConstraint(Package target)`
  Check the target package against the constraint embodied in this PackageConstraint.
  `abstract PackageConstraint`
  `checkConstraint(PackageConstraint target)`
  Check the target package constraint against the constraint embodied in this package constraint.
  `Package`
  `getPackage()`
  Get the package that this constraint applies to.
  `void`
  `setPackage(Package p)`
  Set the package that this constraint applies to.

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

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

- ## Constructor Details

  - ### PackageConstraint

    public PackageConstraint()

- ## Method Details

  - ### setPackage

    public void setPackage(Package p)
    Set the package that this constraint applies to.
    Parameters:
      `p` - the package that this constraint applies to.

  - ### getPackage

    public Package getPackage()
    Get the package that this constraint applies to.
    Returns:
      the Package that this constraint applies to.

  - ### checkConstraint

    public abstract boolean checkConstraint(Package target) throws Exception
    Check the target package against the constraint embodied in this 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.

  - ### checkConstraint

    public abstract 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.
    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`