Package com.illumon.iris.libs.primitives
Class BooleanPrimitives
java.lang.Object
com.illumon.iris.libs.primitives.BooleanPrimitives
A set of commonly used functions that can be applied to Boolean types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Booleanand(boolean... values) Ands all of the values in the array together.static BooleanAnds all of the values in the array together.static BooleanAnds all of the values in the array together.static BooleanAnds all of the values in the array together.static BooleanAnds all of the values in the array together.static DbBooleanArrayConverts a primitive array to a DB array.static intcount(DbBooleanArray values) Counts the number of non-null values.static Booleanfirst(boolean... values) Returns the first value from an array.static BooleanReturns the first value from an array.static booleanReturns if a value is null.static Booleanlast(boolean... values) Returns the last value from an array.static BooleanReturns the last value from an array.static Boolean[]not(boolean... values) Not of all values in an array.static Boolean[]Not of all values in an array.static Booleannth(int index, DbBooleanArray values) Returns the nth value from an array.static BooleanReturns the nth value from an array.static Boolean[]nullToValue(DbBooleanArray values, boolean defaultValue) Replaces null values with a default value.static BooleannullToValue(Boolean value, boolean defaultValue) Replaces null values with a default value.static Booleanor(boolean... values) Ors all of the values in the array together.static BooleanOrs all of the values in the array together.static BooleanOrs all of the values in the array together.static Booleansum(boolean... values) Returns the sum of the values in an array.static BooleanReturns 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.
-