Spec-Zone .ru
спецификации, руководства, описания, API
|
public final class IndexRange
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
VALUE_DELIMITER
Index range value delimiter.
|
Constructor and Description |
---|
IndexRange(IndexRange range)
Creates an instance of IndexRange by copying the values from the
given IndexRange object.
|
IndexRange(int start,
int end)
Creates an instance of IndexRange representing the range between
start and end . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object)
Indicates whether some other object is "equal to" this one.
|
int |
getEnd()
Returns the end position of the range (exclusive).
|
int |
getLength()
Returns the length of the range.
|
int |
getStart()
Returns the start position of the range.
|
int |
hashCode()
Returns a hash code for this
Range object. |
static IndexRange |
normalize(int v1,
int v2)
Convenience method to create an IndexRange instance that has the smaller
value as the start index, and the larger value as the end index.
|
java.lang.String |
toString()
Returns a string representation of this
Range object. |
static IndexRange |
valueOf(java.lang.String value)
Convenience method to parse in a String of the form '2,6', which will
create an IndexRange instance with a start value of 2, and an end value
of 6.
|
public static final java.lang.String VALUE_DELIMITER
public IndexRange(int start, int end)
start
and end
.start
- The start position of the range.end
- The end position of the range.public IndexRange(IndexRange range)
range
- The IndexRange instance from which to copy the start and end
values.public int getStart()
public int getEnd()
public int getLength()
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- the reference object with which to compare.true
if this object is equal to the object
argument; false
otherwise.public int hashCode()
Range
object.hashCode
in class java.lang.Object
Range
object.public java.lang.String toString()
Range
object.toString
in class java.lang.Object
Range
object.public static IndexRange normalize(int v1, int v2)
v1
- The first value to use in the range.v2
- The second value to use in the range.public static IndexRange valueOf(java.lang.String value)
value
- The string to be parsed, and converted to an IndexRange.Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. Use is subject to