Package com.illumon.iris.libs.primitives
Class BooleanPrimitives
java.lang.Object
com.illumon.iris.libs.primitives.BooleanPrimitives
public class BooleanPrimitives extends Object
A set of commonly used functions that can be applied to Boolean types.
-
Constructor Summary
Constructors Constructor Description BooleanPrimitives()
-
Method Summary
Modifier and Type Method Description static Boolean
and(boolean... values)
Ands all of the values in the array together.static Boolean
and(DbArray<Boolean> values)
Ands all of the values in the array together.static Boolean
and(DbArray<Boolean> values, Boolean nullValue)
Ands all of the values in the array together.static Boolean
and(Boolean... values)
Ands all of the values in the array together.static Boolean
and(Boolean[] values, Boolean nullValue)
Ands all of the values in the array together.static DbBooleanArray
array(Boolean[] values)
Converts a primitive array to a DB array.static int
count(DbBooleanArray values)
Counts the number of non-null values.static Boolean
first(boolean... values)
Returns the first value from an array.static Boolean
first(Boolean... values)
Returns the first value from an array.static boolean
isNull(Boolean value)
Returns if a value is null.static Boolean
last(boolean... values)
Returns the last value from an array.static Boolean
last(Boolean... values)
Returns the last value from an array.static Boolean[]
not(boolean... values)
Not of all values in an array.static Boolean[]
not(Boolean... values)
Not of all values in an array.static Boolean
nth(int index, DbBooleanArray values)
Returns the nth value from an array.static Boolean
nth(int index, Boolean[] values)
Returns the nth value from an array.static Boolean[]
nullToValue(DbBooleanArray values, boolean defaultValue)
Replaces null values with a default value.static Boolean
nullToValue(Boolean value, boolean defaultValue)
Replaces null values with a default value.static Boolean
or(boolean... values)
Ors all of the values in the array together.static Boolean
or(Boolean... values)
Ors all of the values in the array together.static Boolean
or(Boolean[] values, Boolean nullValue)
Ors all of the values in the array together.static Boolean
sum(boolean... values)
Returns the sum of the values in an array.static Boolean
sum(Boolean... values)
Returns the sum of the values in an array.static Boolean[]
vec(DbBooleanArray values)
Converts a DB array to a primitive array.
-
Constructor Details
-
BooleanPrimitives
public BooleanPrimitives()
-
-
Method Details
-
isNull
Returns if a value is null.- Parameters:
value
- value.- Returns:
- true if the value is null, and false otherwise.
-
nullToValue
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.
-
nullToValue
Replaces null values with a default value.- Parameters:
values
- values.defaultValue
- default value to return for null values.- Returns:
- value, if value is not null, and defaultValue if value is null.
-
count
Counts the number of non-null values.- Parameters:
values
- values.- Returns:
- number of non-null values.
-
last
Returns the last value from an array.- Parameters:
values
- values.- Returns:
- last value from the array.
-
last
Returns the last value from an array.- Parameters:
values
- values.- Returns:
- last value from the array.
-
first
Returns the first value from an array.- Parameters:
values
- values.- Returns:
- first value from the array.
-
first
Returns the first value from an array.- Parameters:
values
- values.- Returns:
- first value from the array.
-
nth
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.
-
nth
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.
-
vec
Converts a DB array to a primitive array.- Parameters:
values
- DB array- Returns:
- primitive array.
-
array
Converts a primitive array to a DB array.- Parameters:
values
- primitive array- Returns:
- DB array.
-
and
Ands all of the values in the array together. Null values are ignored.- Parameters:
values
- values.- Returns:
- logical and of all the values in the array.
-
and
Ands all of the values in the array together.- Parameters:
values
- values.- Returns:
- logical and of all the values in the array.
-
and
Ands all of the values in the array together. Null values are ignored.- Parameters:
values
- values.- Returns:
- logical and of all the values in the array.
-
and
Ands all of the values in the array together.- Parameters:
values
- values.nullValue
- value to use in place of null values.- Returns:
- logical and of all the values in the array.
-
and
Ands all of the values in the array together.- Parameters:
values
- values.nullValue
- value to use in place of null values.- Returns:
- logical and of all the values in the array.
-
sum
Returns the sum of the values in an array. For booleans, this is equivalent to "or". Null values are ignored.- Parameters:
values
- values.- Returns:
- sum of the values. This is equivalent to "or".
-
sum
Returns the sum of the values in an array. For booleans, this is equivalent to "or".- Parameters:
values
- values.- Returns:
- sum of the values. This is equivalent to "or".
-
or
Ors all of the values in the array together. Null values are ignored.- Parameters:
values
- values.- Returns:
- logical or of all the values in the array.
-
or
Ors all of the values in the array together.- Parameters:
values
- values.- Returns:
- logical or of all the values in the array.
-
or
Ors all of the values in the array together.- Parameters:
values
- values.nullValue
- value to use in place of null values.- Returns:
- logical or of all the values in the array.
-
not
Not of all values in an array.- Parameters:
values
- values.- Returns:
- logical not of all the values in the array.
-
not
Not of all values in an array.- Parameters:
values
- values.- Returns:
- logical not of all the values in the array.
-