Package io.deephaven.base.verify
Class Require
java.lang.Object
io.deephaven.base.verify.Require
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 Summary
Modifier and TypeMethodDescriptionstatic <C extends Collection<T>,
T>
Cstatic <M extends Map<K,
V>, K, V>
McontainsKey
(M map, String mapName, K key, String keyName) static void
elementsNeqInf
(double[][] elements, String name) static void
elementsNeqInf
(double[] elements, String name) static void
elementsNeqNaN
(double[][] elements, String name) static void
elementsNeqNaN
(double[] elements, String name) static <T> T[]
elementsNeqNull
(T[] elements, String name) static void
static void
static void
static void
static void
static void
static void
static void
static void
static void
require (f0 == f1)static void
static void
static void
static void
static void
static void
static void
static void
static void
static void
static void
static void
require (o0 != null && o1 != null && o0.equals(o1))static void
require (o0 != null && o1 != null && o0.equals(o1))static void
static void
static void
static void
static void
static void
static void
static RequirementFailure
static RequirementFailure
exceptionNeverCaught
(String tryStatementDescription, Exception e) static byte
static byte
static char
static char
static double
static double
static float
static float
static int
static int
static long
static long
static short
static short
static byte
static double
static float
static int
static long
static short
static byte
static byte
static char
static char
static double
static double
static float
static float
static int
static int
static long
static long
static short
static short
static byte
static double
static float
static int
static long
static short
static double
static float
static int
require (offset >= 0 && offset < length)static int
require (offset >= start && offset < end)static long
require (offset >= 0 && offset < length)static long
require (offset >= start && offset < end)static void
static int[]
lengthEqual
(int[] a, String name, int length) static byte
static byte
static char
static char
static double
static double
static float
static float
static int
static int
static long
static long
static short
static short
static byte
static double
static float
static int
static long
static short
static byte
static byte
static char
static char
static double
static double
static float
static float
static int
static int
static long
static long
static short
static short
static byte
static double
static float
static int
static long
static short
static void
static void
static void
static void
static void
static void
static void
static void
static void
static void
static void
static int
static void
static void
static void
static void
static void
static void
static void
static double
static double
static <T> T
static void
static byte
static char
static double
static float
static int
static long
static short
static String
static <T> T[]
static double
normalized
(double d, String name) require d != {Infinity, -Infinity, NaN}.static <C extends Collection<T>,
T>
CnotContains
(C collection, String collectionName, T element, String elementName) static <M extends Map<K,
V>, K, V>
MnotContainsKey
(M map, String mapName, K key, String keyName) static <C extends Collection<T>,
T>
CnotContainsNull
(C collection, String collectionName) static void
require (o0 != null && o1 != null && !o0.equals(o1))static void
require (o0 != null && o1 != null && !o0.equals(o1))static void
requirement
(boolean condition, String conditionText) static void
requirement
(boolean condition, String conditionText, boolean b0, String name0) static void
requirement
(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1) static void
requirement
(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1, boolean b2, String name2) static void
requirement
(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1, boolean b2, String name2, boolean b3, String name3) static void
requirement
(boolean condition, String conditionText, boolean b0, String name0, double d1, String name1) static void
requirement
(boolean condition, String conditionText, int i0, String name0) static void
requirement
(boolean condition, String conditionText, int i0, String name0, int i1, String name1) static void
requirement
(boolean condition, String conditionText, long l0, String name0) static void
requirement
(boolean condition, String conditionText, long o0, String name0, long o1, String name1, long o2, String name2) static void
requirement
(boolean condition, String conditionText, Object o0, String name0) static void
requirement
(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1) static void
requirement
(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1, Object o2, String name2) static void
requirement
(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1, Object o2, String name2, Object o3, String name3) static void
requirement
(boolean condition, String conditionText, String detailMessage) static boolean
setOnFailureCallback
(Consumer<RequirementFailure> newCallback) static RequirementFailure
static RequirementFailure
statementNeverExecuted
(String statementDescription) static RequirementFailure
valueNeverOccurs
(boolean b, String name) static RequirementFailure
valueNeverOccurs
(byte b, String name) static RequirementFailure
valueNeverOccurs
(char c, String name) static RequirementFailure
valueNeverOccurs
(double d, String name) static RequirementFailure
valueNeverOccurs
(float f, String name) static RequirementFailure
valueNeverOccurs
(int i, String name) static RequirementFailure
valueNeverOccurs
(long l, String name) static RequirementFailure
valueNeverOccurs
(short s, String name) static RequirementFailure
valueNeverOccurs
(Object o, String name)
-
Method Details
-
setOnFailureCallback
-
requirement
-
requirement
-
requirement
-
requirement
-
requirement
-
requirement
-
requirement
-
requirement
-
requirement
-
requirement
-
requirement
-
requirement
-
requirement
-
requirement
-
requirement
-
statementNeverExecuted
-
statementNeverExecuted
-
exceptionNeverCaught
-
exceptionNeverCaught
-
valueNeverOccurs
-
valueNeverOccurs
-
valueNeverOccurs
-
valueNeverOccurs
-
valueNeverOccurs
-
valueNeverOccurs
-
valueNeverOccurs
-
valueNeverOccurs
-
valueNeverOccurs
-
eq
-
eq
-
eq
-
eq
-
eq
-
eq
-
eq
-
eq
-
eq
-
eq
-
eq
-
eq
-
eq
require (f0 == f1) -
eq
-
eq
-
eq
-
neq
-
neq
-
neq
-
neq
-
neq
-
neq
-
neq
-
neq
-
neq
-
neq
-
neq
-
neq
-
neq
-
neq
-
neq
-
neq
-
lt
-
lt
-
lt
-
lt
-
lt
-
lt
-
lt
-
lt
-
lt
-
lt
-
lt
-
lt
-
lt
-
lt
-
leq
-
leq
-
leq
-
leq
-
leq
-
leq
-
leq
-
leq
-
leq
-
leq
-
leq
-
leq
-
leq
-
leq
-
gt
-
gt
-
gt
-
gt
-
gt
-
gt
-
gt
-
gt
-
gt
-
gt
-
gt
-
gt
-
gt
-
gt
-
geq
-
geq
-
geq
-
geq
-
geq
-
geq
-
geq
-
geq
-
geq
-
geq
-
geq
-
geq
-
geq
-
geq
-
eqFalse
-
neqFalse
-
eqTrue
-
neqTrue
-
eqZero
-
eqZero
-
eqZero
-
eqZero
-
eqZero
-
eqZero
-
eqZero
-
neqZero
-
neqZero
-
neqZero
-
neqZero
-
neqZero
-
neqZero
-
neqZero
-
ltZero
-
ltZero
-
ltZero
-
ltZero
-
ltZero
-
ltZero
-
leqZero
-
leqZero
-
leqZero
-
leqZero
-
leqZero
-
leqZero
-
gtZero
-
gtZero
-
gtZero
-
gtZero
-
gtZero
-
gtZero
-
geqZero
-
geqZero
-
geqZero
-
geqZero
-
geqZero
-
geqZero
-
eq
-
eq
-
neq
-
neq
-
eqNull
-
neqNull
-
neqNaN
-
neqInf
-
equals
require (o0 != null && o1 != null && o0.equals(o1)) -
equals
require (o0 != null && o1 != null && o0.equals(o1)) -
notEquals
require (o0 != null && o1 != null && !o0.equals(o1)) -
notEquals
require (o0 != null && o1 != null && !o0.equals(o1)) -
nonempty
-
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
-
containsKey
-
notContainsKey
-
inRange
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
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
require d != {Infinity, -Infinity, NaN}. -
nonEmpty
-
lengthEqual
-
elementsNeqNull
-
elementsNeqNaN
-
elementsNeqNaN
-
elementsNeqInf
-
elementsNeqInf
-
isSquare
-
inRange
-
inRange
-