public class IDRange
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_INSTANCE_ID
Maximal valid value of an instance ID.
|
static int |
MAX_OBJECT_ID
Maximal valid value of an object ID.
|
static int |
MAX_PROJECT_ID
Maximal valid value of a project ID.
|
static int |
MIN_INSTANCE_ID
Minimal valid value of an instance ID.
|
static int |
MIN_OBJECT_ID
Minimal valid value of an object ID.
|
static int |
MIN_PROJECT_ID
Minimal valid value of a project ID.
|
Constructor and Description |
---|
IDRange(PDRType type,
int instance,
int project,
int lowerBound,
int upperBound)
Range of identifiers.
|
Modifier and Type | Method and Description |
---|---|
static java.util.List<IDRange> |
applyLimitsToRanges(java.util.List<IDRange> ranges,
int lowerBound,
int upperBound)
Returns a subset of ranges which fit the provided bounds.
|
int |
count()
Returns the number of objects in the range.
|
int |
getInstance()
Returns the instance ID of the range.
|
int |
getLowerBound()
Returns the lower limit of the range.
|
int |
getProject()
Returns the project ID of the range.
|
PDRType |
getType()
Returns the type of objects in the range.
|
int |
getUpperBound()
Returns the upper limit of the range.
|
static int |
safeLongToInt(long value)
Casts the provided Integer to Long, if possible.
|
java.lang.String |
toString() |
public static final int MIN_INSTANCE_ID
public static final int MAX_INSTANCE_ID
public static final int MIN_PROJECT_ID
public static final int MAX_PROJECT_ID
public static final int MIN_OBJECT_ID
public static final int MAX_OBJECT_ID
public IDRange(PDRType type, int instance, int project, int lowerBound, int upperBound) throws ValidationException
type
- Type.instance
- Instance ID.project
- Project ID.lowerBound
- Lower bound.upperBound
- Upper bound.ValidationException
- Invalid bounds.public final PDRType getType()
public final int getInstance()
public final int getProject()
public final int getLowerBound()
public final int getUpperBound()
public final int count()
public final java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public static int safeLongToInt(long value)
value
- Integer to be cast.public static java.util.List<IDRange> applyLimitsToRanges(java.util.List<IDRange> ranges, int lowerBound, int upperBound) throws ValidationException
ranges
- Starting list of ranges.lowerBound
- Lower bound.upperBound
- Upper bound.ValidationException
- Invalid resulting bounds.