Class Require

java.lang.Object
io.deephaven.base.verify.Require

public final class Require extends Object
Requirement methods for simple runtime program verification. Failed requirements throw RequirementFailure.

Methods:

  • void requirement(boolean condition, String conditionText[, String detailMessage])
  • void requirement(boolean condition, String conditionText, value0, String name0, value1, String name1, ... )
  • void statementNeverExecuted()
  • void statementNeverExecuted(String statementDescription)
  • void exceptionNeverCaught(Exception caughtException)
  • void exceptionNeverCaught(String tryStatementDescription, Exception caughtException)
  • void valueNeverOccurs(value, String name)
  • void valuesNeverOccur(value0, name0, value1, name1, ... )
  • void eq/neq(boolean/char/byte/short/int/long/float/double, String name0, boolean/char/byte/short/int/long/float/double[, String name1])
  • void lt/leq/gt/geq(char/byte/short/int/long/float/double, String name0, char/byte/short/int/long/float/double[, String name1])
  • void eqFalse/neqFalse/eqTrue/neqTrue(boolean, String name)
  • void eqZero/neqZero(char/byte/short/int/long/float/double, String name)
  • void ltZero/leqZero/gtZero/geqZero(byte/short/int/long/float/double, String name)
  • void eq/neq(Object, name0, Object[, name1])
  • void eqNull/neqNull(Object, String name)
  • void equals(Object, String name0, Object, String name1)
  • void nonempty(String, String name)

Naming Rationale:

  • eq, neq, lt, leq, gt, get correspond to ==, !=, <, <=, >, >=, e.g.,
    • For Object a and b, Require.eq(a, "a", b, "b") corresponds to require (a == b)
    • For Object o, Require.neqNull(o, "o") corresponds to require (o != null)
    • for int x, Require.eqZero(x, "x") corresponds to require (x == 0)
  • equals corresponds to Object.equals (preceded by necessary null checks), e.g.,
    • For Object a and b, Require.equals(a, "a", b, "b") corresponds to require (a!= null && b != null && a.equals(b))
    • for String s, Require.nonempty(s, "s") corresponds to require (s != null && s.length() != 0)
  • Method Details

    • setOnFailureCallback

      public static boolean setOnFailureCallback(Consumer<RequirementFailure> newCallback)
    • requirement

      public static void requirement(boolean condition, String conditionText)
    • requirement

      public static void requirement(boolean condition, String conditionText, String detailMessage)
    • requirement

      public static void requirement(boolean condition, String conditionText, Object o0, String name0)
    • requirement

      public static void requirement(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1)
    • requirement

      public static void requirement(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1, Object o2, String name2)
    • requirement

      public static void requirement(boolean condition, String conditionText, long o0, String name0, long o1, String name1, long o2, String name2)
    • requirement

      public static void requirement(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1, Object o2, String name2, Object o3, String name3)
    • requirement

      public static void requirement(boolean condition, String conditionText, boolean b0, String name0)
    • requirement

      public static void requirement(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1)
    • requirement

      public static void requirement(boolean condition, String conditionText, boolean b0, String name0, double d1, String name1)
    • requirement

      public static void requirement(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1, boolean b2, String name2)
    • requirement

      public static void requirement(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1, boolean b2, String name2, boolean b3, String name3)
    • requirement

      public static void requirement(boolean condition, String conditionText, int i0, String name0)
    • requirement

      public static void requirement(boolean condition, String conditionText, int i0, String name0, int i1, String name1)
    • requirement

      public static void requirement(boolean condition, String conditionText, long l0, String name0)
    • statementNeverExecuted

      public static RequirementFailure statementNeverExecuted()
    • statementNeverExecuted

      public static RequirementFailure statementNeverExecuted(String statementDescription)
    • exceptionNeverCaught

      public static RequirementFailure exceptionNeverCaught(Exception e)
    • exceptionNeverCaught

      public static RequirementFailure exceptionNeverCaught(String tryStatementDescription, Exception e)
    • valueNeverOccurs

      public static RequirementFailure valueNeverOccurs(Object o, String name)
    • valueNeverOccurs

      public static RequirementFailure valueNeverOccurs(boolean b, String name)
    • valueNeverOccurs

      public static RequirementFailure valueNeverOccurs(char c, String name)
    • valueNeverOccurs

      public static RequirementFailure valueNeverOccurs(byte b, String name)
    • valueNeverOccurs

      public static RequirementFailure valueNeverOccurs(short s, String name)
    • valueNeverOccurs

      public static RequirementFailure valueNeverOccurs(int i, String name)
    • valueNeverOccurs

      public static RequirementFailure valueNeverOccurs(long l, String name)
    • valueNeverOccurs

      public static RequirementFailure valueNeverOccurs(float f, String name)
    • valueNeverOccurs

      public static RequirementFailure valueNeverOccurs(double d, String name)
    • eq

      public static void eq(boolean b0, String name0, boolean b1, String name1)
    • eq

      public static void eq(boolean b0, String name0, boolean b1)
    • eq

      public static void eq(char c0, String name0, char c1, String name1)
    • eq

      public static void eq(char c0, String name0, char c1)
    • eq

      public static void eq(byte b0, String name0, byte b1, String name1)
    • eq

      public static void eq(byte b0, String name0, byte b1)
    • eq

      public static void eq(short s0, String name0, short s1, String name1)
    • eq

      public static void eq(short s0, String name0, short s1)
    • eq

      public static void eq(int i0, String name0, int i1, String name1)
    • eq

      public static void eq(int i0, String name0, int i1)
    • eq

      public static void eq(long l0, String name0, long l1, String name1)
    • eq

      public static void eq(long l0, String name0, long l1)
    • eq

      public static void eq(float f0, String name0, float f1, String name1)
      require (f0 == f1)
    • eq

      public static void eq(float f0, String name0, float f1)
    • eq

      public static void eq(double d0, String name0, double d1, String name1)
    • eq

      public static void eq(double d0, String name0, double d1)
    • neq

      public static void neq(boolean b0, String name0, boolean b1, String name1)
    • neq

      public static void neq(boolean b0, String name0, boolean b1)
    • neq

      public static void neq(char c0, String name0, char c1, String name1)
    • neq

      public static void neq(char c0, String name0, char c1)
    • neq

      public static void neq(byte b0, String name0, byte b1, String name1)
    • neq

      public static void neq(byte b0, String name0, byte b1)
    • neq

      public static void neq(short s0, String name0, short s1, String name1)
    • neq

      public static void neq(short s0, String name0, short s1)
    • neq

      public static int neq(int i0, String name0, int i1, String name1)
    • neq

      public static void neq(int i0, String name0, int i1)
    • neq

      public static void neq(long l0, String name0, long l1, String name1)
    • neq

      public static void neq(long l0, String name0, long l1)
    • neq

      public static void neq(float f0, String name0, float f1, String name1)
    • neq

      public static void neq(float f0, String name0, float f1)
    • neq

      public static void neq(double d0, String name0, double d1, String name1)
    • neq

      public static void neq(double d0, String name0, double d1)
    • lt

      public static char lt(char c0, String name0, char c1, String name1)
    • lt

      public static char lt(char c0, String name0, char c1)
    • lt

      public static byte lt(byte b0, String name0, byte b1, String name1)
    • lt

      public static byte lt(byte b0, String name0, byte b1)
    • lt

      public static short lt(short s0, String name0, short s1, String name1)
    • lt

      public static short lt(short s0, String name0, short s1)
    • lt

      public static int lt(int i0, String name0, int i1, String name1)
    • lt

      public static int lt(int i0, String name0, int i1)
    • lt

      public static long lt(long l0, String name0, long l1, String name1)
    • lt

      public static long lt(long l0, String name0, long l1)
    • lt

      public static float lt(float f0, String name0, float f1, String name1)
    • lt

      public static float lt(float f0, String name0, float f1)
    • lt

      public static double lt(double d0, String name0, double d1, String name1)
    • lt

      public static double lt(double d0, String name0, double d1)
    • leq

      public static char leq(char c0, String name0, char c1, String name1)
    • leq

      public static char leq(char c0, String name0, char c1)
    • leq

      public static byte leq(byte b0, String name0, byte b1, String name1)
    • leq

      public static byte leq(byte b0, String name0, byte b1)
    • leq

      public static short leq(short s0, String name0, short s1, String name1)
    • leq

      public static short leq(short s0, String name0, short s1)
    • leq

      public static int leq(int i0, String name0, int i1, String name1)
    • leq

      public static int leq(int i0, String name0, int i1)
    • leq

      public static long leq(long l0, String name0, long l1, String name1)
    • leq

      public static long leq(long l0, String name0, long l1)
    • leq

      public static float leq(float f0, String name0, float f1, String name1)
    • leq

      public static float leq(float f0, String name0, float f1)
    • leq

      public static double leq(double d0, String name0, double d1, String name1)
    • leq

      public static double leq(double d0, String name0, double d1)
    • gt

      public static char gt(char c0, String name0, char c1, String name1)
    • gt

      public static char gt(char c0, String name0, char c1)
    • gt

      public static byte gt(byte b0, String name0, byte b1, String name1)
    • gt

      public static byte gt(byte b0, String name0, byte b1)
    • gt

      public static short gt(short s0, String name0, short s1, String name1)
    • gt

      public static short gt(short s0, String name0, short s1)
    • gt

      public static int gt(int i0, String name0, int i1, String name1)
    • gt

      public static int gt(int i0, String name0, int i1)
    • gt

      public static long gt(long l0, String name0, long l1, String name1)
    • gt

      public static long gt(long l0, String name0, long l1)
    • gt

      public static float gt(float f0, String name0, float f1, String name1)
    • gt

      public static float gt(float f0, String name0, float f1)
    • gt

      public static double gt(double d0, String name0, double d1, String name1)
    • gt

      public static double gt(double d0, String name0, double d1)
    • geq

      public static char geq(char c0, String name0, char c1, String name1)
    • geq

      public static char geq(char c0, String name0, char c1)
    • geq

      public static byte geq(byte b0, String name0, byte b1, String name1)
    • geq

      public static byte geq(byte b0, String name0, byte b1)
    • geq

      public static short geq(short s0, String name0, short s1, String name1)
    • geq

      public static short geq(short s0, String name0, short s1)
    • geq

      public static int geq(int i0, String name0, int i1, String name1)
    • geq

      public static int geq(int i0, String name0, int i1)
    • geq

      public static long geq(long l0, String name0, long l1, String name1)
    • geq

      public static long geq(long l0, String name0, long l1)
    • geq

      public static float geq(float f0, String name0, float f1, String name1)
    • geq

      public static float geq(float f0, String name0, float f1)
    • geq

      public static double geq(double d0, String name0, double d1, String name1)
    • geq

      public static double geq(double d0, String name0, double d1)
    • eqFalse

      public static void eqFalse(boolean b, String name)
    • neqFalse

      public static void neqFalse(boolean b, String name)
    • eqTrue

      public static void eqTrue(boolean b, String name)
    • neqTrue

      public static void neqTrue(boolean b, String name)
    • eqZero

      public static void eqZero(char c, String name)
    • eqZero

      public static void eqZero(byte b, String name)
    • eqZero

      public static void eqZero(short s, String name)
    • eqZero

      public static void eqZero(int i, String name)
    • eqZero

      public static void eqZero(long l, String name)
    • eqZero

      public static void eqZero(float f, String name)
    • eqZero

      public static void eqZero(double d, String name)
    • neqZero

      public static char neqZero(char c, String name)
    • neqZero

      public static byte neqZero(byte b, String name)
    • neqZero

      public static short neqZero(short s, String name)
    • neqZero

      public static int neqZero(int i, String name)
    • neqZero

      public static long neqZero(long l, String name)
    • neqZero

      public static float neqZero(float f, String name)
    • neqZero

      public static double neqZero(double d, String name)
    • ltZero

      public static byte ltZero(byte b, String name)
    • ltZero

      public static short ltZero(short s, String name)
    • ltZero

      public static int ltZero(int i, String name)
    • ltZero

      public static long ltZero(long l, String name)
    • ltZero

      public static float ltZero(float f, String name)
    • ltZero

      public static double ltZero(double d, String name)
    • leqZero

      public static byte leqZero(byte b, String name)
    • leqZero

      public static short leqZero(short s, String name)
    • leqZero

      public static int leqZero(int i, String name)
    • leqZero

      public static long leqZero(long l, String name)
    • leqZero

      public static float leqZero(float f, String name)
    • leqZero

      public static double leqZero(double d, String name)
    • gtZero

      public static byte gtZero(byte b, String name)
    • gtZero

      public static short gtZero(short s, String name)
    • gtZero

      public static int gtZero(int i, String name)
    • gtZero

      public static long gtZero(long l, String name)
    • gtZero

      public static float gtZero(float f, String name)
    • gtZero

      public static double gtZero(double d, String name)
    • geqZero

      public static byte geqZero(byte b, String name)
    • geqZero

      public static short geqZero(short s, String name)
    • geqZero

      public static int geqZero(int i, String name)
    • geqZero

      public static long geqZero(long l, String name)
    • geqZero

      public static float geqZero(float f, String name)
    • geqZero

      public static double geqZero(double d, String name)
    • eq

      public static void eq(Object o0, String name0, Object o1, String name1)
    • eq

      public static void eq(Object o0, String name0, Object o1)
    • neq

      public static void neq(Object o0, String name0, Object o1, String name1)
    • neq

      public static void neq(Object o0, String name0, Object o1)
    • eqNull

      public static void eqNull(Object o, String name)
    • neqNull

      @NotNull public static <T> T neqNull(T o, String name)
    • neqNaN

      public static double neqNaN(double o, String name)
    • neqInf

      public static double neqInf(double o, String name)
    • equals

      public static void equals(Object o0, String name0, Object o1, String name1)
      require (o0 != null && o1 != null && o0.equals(o1))
    • equals

      public static void equals(Object o0, String name0, Object o1)
      require (o0 != null && o1 != null && o0.equals(o1))
    • notEquals

      public static void notEquals(Object o0, String name0, Object o1, String name1)
      require (o0 != null && o1 != null && !o0.equals(o1))
    • notEquals

      public static void notEquals(Object o0, String name0, Object o1)
      require (o0 != null && o1 != null && !o0.equals(o1))
    • nonempty

      public static String nonempty(String s, String name)
    • contains

      public static <C extends Collection<T>, T> C contains(C collection, String collectionName, T element, String elementName)
    • notContains

      public static <C extends Collection<T>, T> C notContains(C collection, String collectionName, T element, String elementName)
    • notContainsNull

      public static <C extends Collection<T>, T> C notContainsNull(C collection, String collectionName)
    • containsKey

      public static <M extends Map<K, V>, K, V> M containsKey(M map, String mapName, K key, String keyName)
    • notContainsKey

      public static <M extends Map<K, V>, K, V> M notContainsKey(M map, String mapName, K key, String keyName)
    • inRange

      public static int inRange(int offset, String offsetName, int length, String lengthName)
      require (offset >= 0 && offset < length)
    • inRange

      public static int inRange(int offset, String offsetName, int start, String startName, int end, String endName)
      require (offset >= start && offset < end)
    • inRange

      public static long inRange(long offset, String offsetName, long length, String lengthName)
      require (offset >= 0 && offset < length)
    • inRange

      public static long inRange(long offset, String offsetName, long start, String startName, long end, String endName)
      require (offset >= start && offset < end)
    • normalized

      public static double normalized(double d, String name)
      require d != {Infinity, -Infinity, NaN}.
    • nonEmpty

      public static <T> T[] nonEmpty(T[] a, String name)
    • lengthEqual

      public static int[] lengthEqual(int[] a, String name, int length)
    • elementsNeqNull

      public static <T> T[] elementsNeqNull(T[] elements, String name)
    • elementsNeqNaN

      public static void elementsNeqNaN(double[] elements, String name)
    • elementsNeqNaN

      public static void elementsNeqNaN(double[][] elements, String name)
    • elementsNeqInf

      public static void elementsNeqInf(double[] elements, String name)
    • elementsNeqInf

      public static void elementsNeqInf(double[][] elements, String name)
    • isSquare

      public static void isSquare(double[][] m, String name)
    • inRange

      public static double inRange(double trialValue, double endPointA, double endPointB, String name)
    • inRange

      public static float inRange(float trialValue, float endPointA, float endPointB, String name)