ArrayHelper

com.netflix.atlas.core.util.ArrayHelper
object ArrayHelper

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

class Merger[T]

Helper for merging sorted arrays and lists.

Helper for merging sorted arrays and lists.

Attributes

Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def fill(size: Int, value: Double): Array[Double]
def fill(size: Int, value: Float): Array[Float]
def fill(size: Int, value: Int): Array[Int]
def merge[T](comparator: Comparator[T], aggrF: (T, T) => T, vs1: Array[T], vs1size: Int, vs2: Array[T], vs2size: Int, dst: Array[T]): Int

Merge two source arrays into a specified destination array.

Merge two source arrays into a specified destination array.

Value parameters

aggrF

Aggregation function to use if duplicate values are encountered. The user should ensure that the aggregation function does not influence the order of the elements.

comparator

Comparator to use for determining the order of elements.

dst

Destination array that will receive the merged data.

vs1

First source array, may be modified. The first position will be set to null if the contents of this array have been fully merged into the destination.

vs1size

Number of valid elements in the first source array.

vs2

Second source array, may be modified. The first position will be set to null if the contents of this array have been fully merged into the destination.

vs2size

Number of valid elements in the second source array.

Attributes

Returns

Number of valid elements in the merged array.

def merger[T <: Comparable[LazyRef(...)] : ClassTag](limit: Int): Merger[T]

Creates a merger object that can be used to efficiently merge together sorted arrays of comparable objects.

Creates a merger object that can be used to efficiently merge together sorted arrays of comparable objects.

Value parameters

limit

The maximum number of items allowed in the result list. The merge operations will be stopped as soon as the limit is reached.

Attributes

Returns

Object that can be used to merge the arrays.

def merger[T : ClassTag](limit: Int, comparator: Comparator[T]): Merger[T]

Creates a merger object that can be used to efficiently merge together sorted arrays of comparable objects.

Creates a merger object that can be used to efficiently merge together sorted arrays of comparable objects.

Value parameters

comparator

Comparator to use for determining the order of elements.

limit

The maximum number of items allowed in the result list. The merge operations will be stopped as soon as the limit is reached.

Attributes

Returns

Object that can be used to merge the arrays.

def merger[T : ClassTag](limit: Int, comparator: Comparator[T], aggrF: (T, T) => T): Merger[T]

Creates a merger object that can be used to efficiently merge together sorted arrays of comparable objects.

Creates a merger object that can be used to efficiently merge together sorted arrays of comparable objects.

Value parameters

aggrF

Aggregation function to use if duplicate values are encountered. The user should ensure that the aggregation function does not influence the order of the elements.

comparator

Comparator to use for determining the order of elements.

limit

The maximum number of items allowed in the result list. The merge operations will be stopped as soon as the limit is reached.

Attributes

Returns

Object that can be used to merge the arrays.

def newInstance[T](n: Int): Array[T]
def sortAndDedup[T <: Comparable[LazyRef(...)]](data: Array[T]): Int

Sort array and remove duplicate values from the array. The operations will be done in place and modify the array.

Sort array and remove duplicate values from the array. The operations will be done in place and modify the array.

Value parameters

data

Input data to sort. The array should be full.

Attributes

Returns

Length of the valid data in the array after removing duplicates.

def sortAndDedup[T](comparator: Comparator[T], aggrF: (T, T) => T, data: Array[T], length: Int): Int

Sort array and remove duplicate values from the array. The operations will be done in place and modify the array.

Sort array and remove duplicate values from the array. The operations will be done in place and modify the array.

Value parameters

aggrF

Aggregation function to use if duplicate values are encountered. The user should ensure that the aggregation function does not influence the order of the elements.

comparator

Comparator to use for determining the order of elements.

data

Input data to sort.

length

Amount of data in the array to consider for the sort.

Attributes

Returns

Length of the valid data in the array after removing duplicates.

def sortPairs[T <: Comparable[LazyRef(...)]](data: Array[T]): Unit

Sort a string array that consists of tag key/value pairs by key. The array will be sorted in-place. The pair arrays are supposed to be fairly small, typically less than 20 tags. With the small size a simple insertion sort works well.

Sort a string array that consists of tag key/value pairs by key. The array will be sorted in-place. The pair arrays are supposed to be fairly small, typically less than 20 tags. With the small size a simple insertion sort works well.

Attributes

def sortPairs[T <: Comparable[LazyRef(...)]](data: Array[T], length: Int): Unit

Sort a string array that consists of tag key/value pairs by key. The array will be sorted in-place. The pair arrays are supposed to be fairly small, typically less than 20 tags. With the small size a simple insertion sort works well.

Sort a string array that consists of tag key/value pairs by key. The array will be sorted in-place. The pair arrays are supposed to be fairly small, typically less than 20 tags. With the small size a simple insertion sort works well.

Attributes