jal.LONG
Class Range
java.lang.Object
|
+--jal.LONG.Range
- public final class Range
- extends Object
A range of values within an array, consisting of the array, the index of
the first element in the range, and an index one past the range. The
notation is [first, last)
, indicating that
array[first]
is part of the range but
array[last]
is not. The range [n, n)
is a
valid range that contains zero elements, while
the range [n, n-1)
is invalid.
Note that operations on a Range object do not actually change any
array elements. A Range is simply a way of describing a set of values.
Copyright © 1996
Silicon Graphics, Inc.
Permission to use, copy, modify, distribute and sell this software
and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear
in supporting documentation. Silicon Graphics makes no
representations about the suitability of this software for any
purpose. It is provided "as is" without express or
implied warranty.
Field Summary |
long[] |
array
Array containing the range. |
int |
first
Index of the first element in the range. |
int |
last
Index that is one past the last element in the range. |
Constructor Summary |
Range(long[] array)
Constructs a Range that represents an entire array. |
Range(long[] array,
int first,
int last)
Constructs a Range. |
Method Summary |
String |
toString()
Creates a string representation of this Range. |
array
public long[] array
- Array containing the range.
first
public int first
- Index of the first element in the range.
last
public int last
- Index that is one past the last element in the range.
Range
public Range(long[] array,
int first,
int last)
- Constructs a Range.
- Parameters:
array
- Array containing the rangefirst
- Index of the first element in the rangelast
- Index that is one past the last element in the range
Range
public Range(long[] array)
- Constructs a Range that represents an entire array. Equivalent
to
Range(array, 0, array.length)
.
- Parameters:
array
- Array containing the range
toString
public String toString()
- Creates a string representation of this Range.
- Overrides:
toString
in class Object
- Returns:
- A string of the form "
[first, last)
".
Submit a bug or feature. Check the Colt home page for the latest news.