Package org.identityconnectors.common
Class VersionRange
- java.lang.Object
-
- org.identityconnectors.common.VersionRange
-
public class VersionRange extends java.lang.ObjectA version range is an interval describing a set ofversions.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).
VersionRangeobjects are immutable.- Since:
- 1.4
-
-
Field Summary
Fields Modifier and Type Field Description static charLEFT_CLOSEDThe left endpoint is closed and is included in the range.static charLEFT_OPENThe left endpoint is open and is excluded from the range.static charRIGHT_CLOSEDThe right endpoint is closed and is included in the range.static charRIGHT_OPENThe right endpoint is open and is excluded from the range.
-
Constructor Summary
Constructors Constructor Description VersionRange(Version low, boolean isLowInclusive, Version high, boolean isHighInclusive)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)VersiongetCeiling()VersiongetFloor()inthashCode()booleanisCeilingInclusive()booleanisEmpty()Returns whether this version range is empty.booleanisExact()Returns whether this version range contains only a single version.booleanisFloorInclusive()booleanisInRange(Version version)static VersionRangeparse(java.lang.String range)Creates a version range from the specified string.java.lang.StringtoString()
-
-
-
Field Detail
-
LEFT_OPEN
public static final char LEFT_OPEN
The left endpoint is open and is excluded from the range.The value of
LEFT_OPENis'('.- See Also:
- Constant Field Values
-
LEFT_CLOSED
public static final char LEFT_CLOSED
The left endpoint is closed and is included in the range.The value of
LEFT_CLOSEDis'['.- See Also:
- Constant Field Values
-
RIGHT_OPEN
public static final char RIGHT_OPEN
The right endpoint is open and is excluded from the range.The value of
RIGHT_OPENis')'.- See Also:
- Constant Field Values
-
RIGHT_CLOSED
public static final char RIGHT_CLOSED
The right endpoint is closed and is included in the range.The value of
RIGHT_CLOSEDis']'.- See Also:
- Constant Field Values
-
-
Method Detail
-
parse
public static VersionRange parse(java.lang.String range)
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.- Throws:
java.lang.IllegalArgumentException- Ifrangeis improperly formatted.
-
getFloor
public Version getFloor()
-
isFloorInclusive
public boolean isFloorInclusive()
-
getCeiling
public Version getCeiling()
-
isCeilingInclusive
public boolean isCeilingInclusive()
-
isInRange
public boolean isInRange(Version version)
-
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
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-