Package com.illumon.iris.libs.primitives
Class FloatPrimitives
java.lang.Object
com.illumon.iris.libs.primitives.FloatPrimitives
public class FloatPrimitives extends Object
A set of commonly used functions that can be applied to Float types.
- 
Constructor SummaryConstructors Constructor Description FloatPrimitives()
- 
Method SummaryModifier and Type Method Description static DbFloatArrayarray(float[] values)Converts a primitive array to a DB array.static float[]concat(float[]... values)Returns the concatenation of multiple arrays into a single array.static float[]concat(DbFloatArray... values)Returns the concatenation of multiple arrays into a single array.static intcount(float[] values)Counts the number of non-null values.static intcount(DbFloatArray values)Counts the number of non-null values.static intcount(Float[] values)Counts the number of non-null values.static longcountDistinct(float[] values)Counts the number of distinct elements in the array.static longcountDistinct(float[] values, boolean countNull)Counts the number of distinct elements in the array.static longcountDistinct(DbFloatArray values)Counts the number of distinct elements in the array.static longcountDistinct(DbFloatArray values, boolean countNull)Counts the number of distinct elements in the array.static float[]distinct(float[] values)Returns an array containing only the distinct values from the input.static float[]distinct(float[] values, boolean includeNull, boolean sort)Returns an array containing only the distinct values from the input.static DbFloatArraydistinct(DbFloatArray values)Returns an array containing only the distinct values from the input.static DbFloatArraydistinct(DbFloatArray values, boolean includeNull, boolean sort)Returns an array containing only the distinct values from the input.static float[]enlist(float... values)Returns a list containing its arguments.static floatfirst(float[] values)Returns the first value from an array.static floatfirst(DbFloatArray values)Returns the first value from an array.static float[]forwardFill(float[] values)static booleanin(float testedValues, float... possibleValues)Checks if a value is within a discrete set of possible values.static booleaninRange(float testedValue, float lowInclusiveValue, float highInclusiveValue)Checks if a value is within a range.static booleanisNull(float value)Determines if a value is null.static floatlast(float[] values)Returns the last value from an array.static floatlast(DbFloatArray values)Returns the last value from an array.static floatnth(int index, float[] values)Returns the nth value from an array.static floatnth(int index, DbFloatArray values)Returns the nth value from an array.static float[]nullToValue(float[] values, float defaultValue)Replaces null values with a default value.static floatnullToValue(float value, float defaultValue)Replaces null values with a default value.static float[]nullToValue(DbFloatArray values, float defaultValue)Replaces null values with a default value.static float[]repeat(float value, int size)Returns an array with a value repeated.static float[]reverse(float... values)Returns an array with the values reversed.static float[]reverse(DbFloatArray values)Returns an array with the values reversed.static float[]unbox(Float... values)Unboxes a array of values.static floatuniqueValue(DbFloatArray arr, boolean countNull)Get the single unique value in the array, or null if there are none, or there are more than 1 distinct values.static float[]vec(DbFloatArray values)Converts a DB array to a primitive array.
- 
Constructor Details- 
FloatPrimitivespublic FloatPrimitives()
 
- 
- 
Method Details- 
unboxUnboxes a array of values.- Parameters:
- values- values.
- Returns:
- unboxed array of values.
 
- 
isNullpublic static boolean isNull(float value)Determines if a value is null.- Parameters:
- value- value.
- Returns:
- true if the value is null, and false otherwise.
 
- 
nullToValuepublic static float nullToValue(float value, float defaultValue)Replaces null values with a default value.- Parameters:
- value- value.
- defaultValue- default value to return for null values.
- Returns:
- value, if value is not null, and defaultValue if value is null.
 
- 
nullToValuepublic static float[] nullToValue(float[] values, float defaultValue)Replaces null values with a default value.- Parameters:
- values- values.
- defaultValue- default value to return for null values.
- Returns:
- values with nulls replaced by defaultValue.
 
- 
nullToValueReplaces null values with a default value.- Parameters:
- values- values.
- defaultValue- default value to return for null values.
- Returns:
- values with nulls replaced by defaultValue.
 
- 
countCounts the number of non-null values.- Parameters:
- values- values.
- Returns:
- number of non-null values.
 
- 
countpublic static int count(float[] values)Counts the number of non-null values.- Parameters:
- values- values.
- Returns:
- number of non-null values.
 
- 
countCounts the number of non-null values.- Parameters:
- values- values.
- Returns:
- number of non-null values.
 
- 
lastReturns the last value from an array.- Parameters:
- values- values.
- Returns:
- last value from the array.
 
- 
lastpublic static float last(float[] values)Returns the last value from an array.- Parameters:
- values- values.
- Returns:
- last value from the array.
 
- 
firstReturns the first value from an array.- Parameters:
- values- values.
- Returns:
- first value from the array.
 
- 
firstpublic static float first(float[] values)Returns the first value from an array.- Parameters:
- values- values.
- Returns:
- first value from the array.
 
- 
nthReturns the nth value from an array.- Parameters:
- index- index of the value to return.
- values- values.
- Returns:
- nth value from the array or null, if the index is outside of the array's index range.
 
- 
nthpublic static float nth(int index, float[] values)Returns the nth value from an array.- Parameters:
- index- index of the value to return.
- values- values.
- Returns:
- nth value from the array or null, if the index is outside of the array's index range.
 
- 
vecConverts a DB array to a primitive array.- Parameters:
- values- DB array
- Returns:
- primitive array.
 
- 
arrayConverts a primitive array to a DB array.- Parameters:
- values- primitive array
- Returns:
- DB array.
 
- 
inRangepublic static boolean inRange(float testedValue, float lowInclusiveValue, float highInclusiveValue)Checks if a value is within a range.- Parameters:
- testedValue- tested value.
- lowInclusiveValue- lower inclusive bound of the range.
- highInclusiveValue- upper inclusive bound of the range.
- Returns:
- true if the tested value is within the range, and false if the tested value is not in the range or is null.
 
- 
inpublic static boolean in(float testedValues, float... possibleValues)Checks if a value is within a discrete set of possible values.- Parameters:
- testedValues- tested value.
- possibleValues- possible values.
- Returns:
- true if the tested value is contained in the possible values, and false otherwise.
 
- 
countDistinctpublic static long countDistinct(float[] values)Counts the number of distinct elements in the array.- Parameters:
- values- values.
- Returns:
- number of distinct non-null values.
 
- 
countDistinctCounts the number of distinct elements in the array.- Parameters:
- values- values.
- Returns:
- number of distinct non-null values.
 
- 
countDistinctpublic static long countDistinct(float[] values, boolean countNull)Counts the number of distinct elements in the array.- Parameters:
- values- values.
- countNull- true to count null values, and false to exclude null values.
- Returns:
- number of distinct values.
 
- 
countDistinctCounts the number of distinct elements in the array.- Parameters:
- values- values.
- countNull- true to count null values, and false to exclude null values.
- Returns:
- number of distinct values.
 
- 
uniqueValueGet the single unique value in the array, or null if there are none, or there are more than 1 distinct values.- Parameters:
- arr- the array
- countNull- if nulls should count as values
- Returns:
- the single unique value in the array, or null.
 
- 
distinctpublic static float[] distinct(float[] values)Returns an array containing only the distinct values from the input.- Parameters:
- values- values.
- Returns:
- unsorted array containing only distinct non-null items from arr.
 
- 
distinctReturns an array containing only the distinct values from the input.- Parameters:
- values- values.
- Returns:
- unsorted array containing only distinct non-null items from arr.
 
- 
distinctpublic static float[] distinct(float[] values, boolean includeNull, boolean sort)Returns an array containing only the distinct values from the input.- Parameters:
- values- values.
- includeNull- true to include null values, and false to exclude null values.
- sort- true to sort the resultant array
- Returns:
- array containing only distinct items from arr.
 
- 
distinctReturns an array containing only the distinct values from the input.- Parameters:
- values- values.
- includeNull- true to include null values, and false to exclude null values.
- sort- true to sort the resultant array
- Returns:
- array containing only distinct items from arr.
 
- 
repeatpublic static float[] repeat(float value, int size)Returns an array with a value repeated.- Parameters:
- value- value.
- size- number of times to repeat the value.
- Returns:
- array of repeated values.  If sizeis less than zero, an empty array is returned.
 
- 
enlistpublic static float[] enlist(float... values)Returns a list containing its arguments.- Parameters:
- values- values.
- Returns:
- list containing values.
 
- 
concatpublic static float[] concat(float[]... values)Returns the concatenation of multiple arrays into a single array.- Parameters:
- values- values.
- Returns:
- concatenation of multiple arrays into a single array.
 
- 
concatReturns the concatenation of multiple arrays into a single array.- Parameters:
- values- values.
- Returns:
- concatenation of multiple arrays into a single array.
 
- 
reversepublic static float[] reverse(float... values)Returns an array with the values reversed.- Parameters:
- values- values.
- Returns:
- array with the values reversed.
 
- 
reverseReturns an array with the values reversed.- Parameters:
- values- values.
- Returns:
- array with the values reversed.
 
- 
forwardFillpublic static float[] forwardFill(float[] values)
 
-