org.ungoverned.moduleloader.search
Interface CompatibilityPolicy

All Known Implementing Classes:
ExactCompatibilityPolicy, OSGiCompatibilityPolicy

public interface CompatibilityPolicy

This interface represents the naming and version numbering policy of import and export identifiers for the ImportSearchPolicy. A concrete implementation of this interface is required to create an instance of ImportSearchPolicy. The sole purpose of this interface is to allow the ImportSearchPolicy to determine if one import/export identifier and version is compatible with another.

See Also:
ImportSearchPolicy

Method Summary
 int compare(java.lang.Object leftId, java.lang.Object leftVersion, java.lang.Object rightId, java.lang.Object rightVersion)
          Compares two import/export identifiers.
 boolean isCompatible(java.lang.Object leftId, java.lang.Object leftVersion, java.lang.Object rightId, java.lang.Object rightVersion)
          Returns whether the first import/export identifer is compatible with the second; this method should not throw any exceptions.
 

Method Detail

compare

public int compare(java.lang.Object leftId,
                   java.lang.Object leftVersion,
                   java.lang.Object rightId,
                   java.lang.Object rightVersion)
Compares two import/export identifiers.

Parameters:
leftId - the identifier to test for compatibility.
leftVersion - the version number to test for compatibility.
rightId - the identifier used as the compatibility base line.
rightVersion - the version used as the compatibility base line.
Returns:
0 if the identifiers are equal, -1 if the left identifier is less then the right identifier, and 1 if the left identifier is greater than the right identifier.
Throws:
java.lang.IllegalArgumentException - if the two identifiers are not comparable, i.e., they refer to intrinsically different entities.

isCompatible

public boolean isCompatible(java.lang.Object leftId,
                            java.lang.Object leftVersion,
                            java.lang.Object rightId,
                            java.lang.Object rightVersion)
Returns whether the first import/export identifer is compatible with the second; this method should not throw any exceptions.

Parameters:
leftId - the identifier to test for compatibility.
leftVersion - the version number to test for compatibility.
rightId - the identifier used as the compatibility base line.
rightVersion - the version used as the compatibility base line.
Returns:
true if the left version number object is compatible with the right version number object, otherwise false.