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 Details

  • Method Details

    • isNull

      public static boolean isNull​(Boolean value)
      Returns if a value is null.
      Parameters:
      value - value.
      Returns:
      true if the value is null, and false otherwise.
    • nullToValue

      public static Boolean nullToValue​(Boolean value, boolean 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.
    • nullToValue

      public static Boolean[] nullToValue​(DbBooleanArray values, boolean defaultValue)
      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

      public static int count​(DbBooleanArray values)
      Counts the number of non-null values.
      Parameters:
      values - values.
      Returns:
      number of non-null values.
    • last

      public static Boolean last​(Boolean... values)
      Returns the last value from an array.
      Parameters:
      values - values.
      Returns:
      last value from the array.
    • last

      public static Boolean last​(boolean... values)
      Returns the last value from an array.
      Parameters:
      values - values.
      Returns:
      last value from the array.
    • first

      public static Boolean first​(Boolean... values)
      Returns the first value from an array.
      Parameters:
      values - values.
      Returns:
      first value from the array.
    • first

      public static Boolean first​(boolean... values)
      Returns the first value from an array.
      Parameters:
      values - values.
      Returns:
      first value from the array.
    • nth

      public static Boolean nth​(int index, DbBooleanArray 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.
    • nth

      public static Boolean nth​(int index, Boolean[] 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.
    • vec

      public static Boolean[] vec​(DbBooleanArray values)
      Converts a DB array to a primitive array.
      Parameters:
      values - DB array
      Returns:
      primitive array.
    • array

      public static DbBooleanArray array​(Boolean[] values)
      Converts a primitive array to a DB array.
      Parameters:
      values - primitive array
      Returns:
      DB array.
    • and

      public static Boolean and​(Boolean... values)
      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

      public static Boolean and​(boolean... values)
      Ands all of the values in the array together.
      Parameters:
      values - values.
      Returns:
      logical and of all the values in the array.
    • and

      public static Boolean and​(DbArray<Boolean> values)
      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

      public static Boolean and​(Boolean[] values, Boolean nullValue)
      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

      public static Boolean and​(DbArray<Boolean> values, Boolean nullValue)
      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

      public static Boolean sum​(Boolean... values)
      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

      public static Boolean sum​(boolean... values)
      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

      public static Boolean or​(Boolean... values)
      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

      public static Boolean or​(boolean... values)
      Ors all of the values in the array together.
      Parameters:
      values - values.
      Returns:
      logical or of all the values in the array.
    • or

      public static Boolean or​(Boolean[] values, Boolean nullValue)
      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

      public static Boolean[] not​(Boolean... values)
      Not of all values in an array.
      Parameters:
      values - values.
      Returns:
      logical not of all the values in the array.
    • not

      public static Boolean[] not​(boolean... values)
      Not of all values in an array.
      Parameters:
      values - values.
      Returns:
      logical not of all the values in the array.