Package org.identityconnectors.common
Class VersionRange
java.lang.Object
org.identityconnectors.common.VersionRange
A version range is an interval describing a set of
versions.
A range has a left (lower) endpoint and a right (upper) endpoint. Each endpoint can be open (excluded from the set) or closed (included in the set).
VersionRange objects are immutable.
- Since:
- 1.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charThe left endpoint is closed and is included in the range.static final charThe left endpoint is open and is excluded from the range.static final charThe right endpoint is closed and is included in the range.static final charThe right endpoint is open and is excluded from the range. -
Constructor Summary
ConstructorsConstructorDescriptionVersionRange(Version low, boolean isLowInclusive, Version high, boolean isHighInclusive) Construct a version range from components. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn the highest version supported by the range.getFloor()Return the lowest version supported by this range.inthashCode()booleanReturn whether the highest supported version is part of the range.booleanisEmpty()Returns whether this version range is empty.booleanisExact()Returns whether this version range contains only a single version.booleanReturn whether the lowest supported version is part of the range.booleanReturn whether a given version is covered by this range.static VersionRangeCreates a version range from the specified string.toString()
-
Field Details
-
LEFT_OPEN
public static final char LEFT_OPENThe left endpoint is open and is excluded from the range.The value of
LEFT_OPENis'('.- See Also:
-
LEFT_CLOSED
public static final char LEFT_CLOSEDThe left endpoint is closed and is included in the range.The value of
LEFT_CLOSEDis'['.- See Also:
-
RIGHT_OPEN
public static final char RIGHT_OPENThe right endpoint is open and is excluded from the range.The value of
RIGHT_OPENis')'.- See Also:
-
RIGHT_CLOSED
public static final char RIGHT_CLOSEDThe right endpoint is closed and is included in the range.The value of
RIGHT_CLOSEDis']'.- See Also:
-
-
Constructor Details
-
VersionRange
Construct a version range from components.- Parameters:
low- the lowest version the range should supportisLowInclusive- whether the low version is part of the range or just beyond the lower boundhigh- the highest version the range should supportisHighInclusive- whether the high version is part of the range or just outside the upper bound
-
-
Method Details
-
parse
Creates a version range from the specified string.Version range string grammar:
range ::= interval | at least interval ::= ( '[' | '(' ) left ',' right ( ']' | ')' ) left ::= version right ::= version at least ::= version- Parameters:
range- String representation of the version range. The versions in the range must contain no whitespace. Other whitespace in the range string is ignored.- Returns:
- a VersionRange parsed from the range string
- Throws:
IllegalArgumentException- Ifrangeis improperly formatted.
-
getFloor
Return the lowest version supported by this range. Version returned may be inclusive or exclusive.- Returns:
- lowest supported version
-
isFloorInclusive
public boolean isFloorInclusive()Return whether the lowest supported version is part of the range.- Returns:
- true iff lowest supported version is part of the range
-
getCeiling
Return the highest version supported by the range. Version returned may be inclusive or exclusive.- Returns:
- highest supported version
-
isCeilingInclusive
public boolean isCeilingInclusive()Return whether the highest supported version is part of the range.- Returns:
- true iff highest supported version is part of the range
-
isInRange
Return whether a given version is covered by this range.- Parameters:
version- the version to test- Returns:
- true iff the version is covered by this range
-
isExact
public boolean isExact()Returns whether this version range contains only a single version.- Returns:
trueif this version range contains only a single version;falseotherwise.
-
isEmpty
public boolean isEmpty()Returns whether this version range is empty. A version range is empty if the set of versions defined by the interval is empty.- Returns:
trueif this version range is empty;falseotherwise.
-
equals
-
hashCode
public int hashCode() -
toString
-