|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjal.longs.Inspection
A class that encapsulates non-mutating sequence algorithms on one and two arrays. All methods are static and all variables are static and final, so this class has no constructors.
Most methods operate on a range of elements. A range is described
by the index of its first element and an index that is
one past its last element. So, for example,
[n, n+1)
is a range that contains one element,
[n, n)
is a range that contains zero elements,
and [n, n-1)
is not a valid range.
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.
Modification
,
Sorting
,
Numeric
Method Summary | |
static int |
adjacent_find(long[] array,
int first,
int last)
Finds the first adjacent pair of equal elements in a range. |
static int |
adjacent_find(long[] array,
int first,
int last,
BinaryPredicate p)
Finds the first adjacent pair of elements in a range that satisfy some condition. |
static int |
count_if_not(long[] array,
int first,
int last,
Predicate p)
Counts the number of elements in a range that do not satisfy a condition. |
static int |
count_if(long[] array,
int first,
int last,
Predicate p)
Counts the number of elements in a range that satisfy a condition. |
static boolean |
equal(long[] array1,
long[] array2,
int first1,
int last1,
int first2)
Tests whether two ranges are pairwise equal. |
static boolean |
equal(long[] array1,
long[] array2,
int first1,
int last1,
int first2,
BinaryPredicate p)
Tests whether two ranges satisfiy a condition pairwise. |
static int |
find_if_not(long[] array,
int first,
int last,
Predicate p)
Finds the first element in a range that does not satisfy some condition. |
static int |
find_if(long[] array,
int first,
int last,
Predicate p)
Finds the first element in a range that satisfies a condition. |
static int |
find_not(long[] array,
int first,
int last,
long x)
Finds the first element in a range that is not equal to a specified value. |
static int |
find(long[] array,
int first,
int last,
long x)
Finds the first element in a range that is equal to a specified value. |
static void |
for_each(long[] array,
int first,
int last,
VoidFunction f)
Applies a function to every element of a range. |
static int |
mismatch(long[] array1,
long[] array2,
int first1,
int last1,
int first2)
Finds the first location at which two ranges differ. |
static int |
mismatch(long[] array1,
long[] array2,
int first1,
int last1,
int first2,
BinaryPredicate p)
Finds the first location at which two ranges fail to satisfy a condition. |
static int |
search(long[] array1,
long[] array2,
int first1,
int last1,
int first2,
int last2)
Searches, within one range, for a sequence of elements equal to the elements in a second range. |
static int |
search(long[] array1,
long[] array2,
int first1,
int last1,
int first2,
int last2,
BinaryPredicate p)
Searches, within one range, for a sequence of elements that match the elements in a second range. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void for_each(long[] array, int first, int last, VoidFunction f)
array
- Array containing the range.first
- Beginning of the range.last
- One past the end of the range.f
- Function to be applied.public static int adjacent_find(long[] array, int first, int last)
array
- Array containing the range.first
- Beginning of the range.last
- One past the end of the range.
i
in the range
[first, last-1)
such that
array[i] == array[i+1]
. Returns
last
if no such iterator exists.public static int adjacent_find(long[] array, int first, int last, BinaryPredicate p)
array
- Array containing the range.first
- Beginning of the range.last
- One past the end of the range.p
- Condition that must be satisfied.
i
in the range
[first, last-1)
such that
p.apply(array[i], array[i+1])
is
true
. Returns
last
if no such iterator exists.public static int find(long[] array, int first, int last, long x)
array
- Array containing the range.first
- Beginning of the range.last
- One past the end of the range.x
- Value to be searched for.
E
such that
E == x
, or last
if no such
element exists.public static int find_not(long[] array, int first, int last, long x)
array
- Array containing the range.first
- Beginning of the range.last
- One past the end of the range.x
- Value to be searched for.
E
such that
E != x
, or last
if no such
element exists.public static int find_if(long[] array, int first, int last, Predicate p)
array
- Array containing the range.first
- Beginning of the range.last
- One past the end of the range.p
- Condition to search for.
E
such that
E == x
, or last
if no such
element exists.public static int find_if_not(long[] array, int first, int last, Predicate p)
array
- Array containing the rangefirst
- Beginning of the rangelast
- One past the end of the rangep
- Condition being tested
E
such that
p.apply(E)
is false
, or
last
if no such element exists.public static int count_if(long[] array, int first, int last, Predicate p)
array
- Array containing the rangefirst
- Beginning of the rangelast
- One past the end of the rangep
- Condition being tested
E
such that
p.apply(E)
is true
.public static int count_if_not(long[] array, int first, int last, Predicate p)
array
- Array containing the rangefirst
- Beginning of the rangelast
- One past the end of the rangep
- Condition being tested
E
such that
p.apply(E)
is false
.public static int mismatch(long[] array1, long[] array2, int first1, int last1, int first2)
array1
- Array containing the first range.array2
- Array containing the first range.first1
- Beginning of the first rangelast1
- One past the end of the first rangefirst2
- Beginning of the second range
i
such that
array1[i] != array2[first2 + (i-first1)]
,
or last1
if no such index in the range
[first1,last1)
exists.public static int mismatch(long[] array1, long[] array2, int first1, int last1, int first2, BinaryPredicate p)
array1
- Array containing the first range.array2
- Array containing the first range.first1
- Beginning of the first rangelast1
- One past the end of the first rangefirst2
- Beginning of the second rangep
- Condition to be tested
i
such that
p.apply(array1[i], array2[first2 + (i-first1)])
is false
, or last1
if no such
index in the range [first1,last1)
exists.public static boolean equal(long[] array1, long[] array2, int first1, int last1, int first2)
array1
- Array containing the first range.array2
- Array containing the first range.first1
- Beginning of the first rangelast1
- One past the end of the first rangefirst2
- Beginning of the second range
true
if, for every index i
in the range [first1,last1)
,
array1[i] == array2[first2 + (i-first1)]
,
otherwise returns false
.public static boolean equal(long[] array1, long[] array2, int first1, int last1, int first2, BinaryPredicate p)
array1
- Array containing the first range.array2
- Array containing the first range.first1
- Beginning of the first range.last1
- One past the end of the first range.first2
- Beginning of the second range.p
- Condition to be tested
true
if, for every index i
in the range [first1,last1)
,
p.apply(array1[i], array2[first2 + (i-first1)])
is true
, otherwise returns false
.public static int search(long[] array1, long[] array2, int first1, int last1, int first2, int last2)
array1
- Array containing the first range.array2
- Array containing the first range.first1
- Beginning of the first range.last1
- One past the end of the first range.first2
- Beginning of the second range.last2
- One past the end of the second range.
[first1, last1-len)
such that
for every non-negative i<len
(where len = last2-first2
), the
condition
array1[first1+n] == array2[first1+n]
is satisfied, or last1
if no such
index exists.public static int search(long[] array1, long[] array2, int first1, int last1, int first2, int last2, BinaryPredicate p)
array1
- Array containing the first range.array2
- Array containing the first range.first1
- Beginning of the first range.last1
- One past the end of the first range.first2
- Beginning of the second range.last2
- One past the end of the second range.p
- Condition to be tested pairwise.
[first1, last1-len)
such that
for every non-negative i<len
(where len = last2-first2
), the
condition
p.apply(array1[first1+n],array2[first1+n])
is satisfied, or last1
if no such
index exists.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |