Oracle Coherence for C++ API
Release 3.7.1.0

E22845-01

Arrays Class Reference

#include <coherence/util/Arrays.hpp>

List of all members.


Detailed Description

This class contains various methods for manipulating arrays (such as sorting and searching).

Author:
tb 2008.04.04
 

Static Public Member Functions

static void copy (ObjectArray::Handle haoSrc, size32_t iSrcStart, ObjectArray::Handle haoDest, size32_t iDestStart, size32_t cElements)
 Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array.
static void sort (ObjectArray::Handle hao, Comparator::Handle hComparator=NULL)
 Sorts the specified array of objects according to the order induced by the specified comparator.
static int32_t binarySearch (ObjectArray::View vaoSorted, Object::View vo, Comparator::View vComparator=NULL)
 Performs a binary search for the specified element in the specified sorted array using the Comparator to compare elements.
static int32_t binarySearch (ObjectArray::View vaoSorted, size32_t iStart, size32_t iEnd, Object::View vo, Comparator::View vComparator=NULL)
 Performs a binary search for the specified element in a part of the specified sorted array using the Comparator to compare elements.

Member Function Documentation

static void copy ( ObjectArray::Handle  haoSrc,
    size32_t  iSrcStart,
    ObjectArray::Handle  haoDest,
    size32_t  iDestStart,
    size32_t  cElements 
  )    [static]

Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array.

Parameters:
 haoSrc the source array
 iSrcStart starting position in the source array
 haoDest the destination array
 iDestStart starting position in the destination data
 cElements the number of array elements to be copied
Exceptions:
 IndexOutOfBoundsException if copying would cause access of data outside array bounds

static void sort ( ObjectArray::Handle  hao,
    Comparator::Handle  hComparator = NULL 
  )    [static]

Sorts the specified array of objects according to the order induced by the specified comparator.

All elements in the array must be mutually comparable by the specified comparator.

This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.

Parameters:
 hao the array to be sorted
 hComparator the comparator to determine the order of the array. A null value indicates that the elements' natural ordering should be used
Exceptions:
 ClassCastException if the array contains elements that are not mutually comparable

static int32_t binarySearch ( ObjectArray::View  vaoSorted,
    Object::View  vo,
    Comparator::View  vComparator = NULL 
  )    [static]

Performs a binary search for the specified element in the specified sorted array using the Comparator to compare elements.

Parameters:
 vaoSorted the sorted Object array to search
 vo the value element to find
 vComparator the Comparator (optional)
Returns:
the non-negative index of the element, or a negative index which is the -index - 1 where the element would be inserted

static int32_t binarySearch ( ObjectArray::View  vaoSorted,
    size32_t  iStart,
    size32_t  iEnd,
    Object::View  vo,
    Comparator::View  vComparator = NULL 
  )    [static]

Performs a binary search for the specified element in a part of the specified sorted array using the Comparator to compare elements.

Parameters:
 vaoSorted the sorted Object array to search
 iStart the inclusive start index
 iEnd the exclusive end index
 vo the value element to find
 vComparator the Comparator (optional)
Returns:
the non-negative index of the element, or a negative index which is the -index - 1 where the element would be inserted


The documentation for this class was generated from the following file:
Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.