Package io.deephaven.plot.util
Class ArgumentValidations
java.lang.Object
io.deephaven.plot.util.ArgumentValidations
Utilities for validating that plotting arguments are acceptable.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertColumnsInTable
(TableDefinition t, PlotInfo plotInfo, String... cols) Requires all columns incols
be columns in the table.static void
assertColumnsInTable
(Table t, PlotInfo plotInfo, String... cols) Requires all columns incols
be columns in the table.static void
assertColumnsInTable
(SelectableDataSet sds, PlotInfo plotInfo, String... cols) Requires all columns incols
be columns in the selectable dataset.static void
assertColumnsInTable
(TableHandle t, PlotInfo plotInfo, String... cols) Requires all columns incols
be columns in the table held by the handle.static void
assertGreaterThan0
(double d, String name, PlotInfo plotInfo) Requires the input objecto
to be non-null.static void
assertInstance
(TableDefinition t, String column, Class c, String message, PlotInfo plotInfo) static void
static void
assertInstance
(SelectableDataSet sds, String column, Class c, String message, PlotInfo plotInfo) static void
assertInstance
(Class c1, Class c2, String message, PlotInfo plotInfo) static void
assertIsBoxedNumeric
(Table t, String column, PlotInfo plotInfo) Requires the column's data type to be an instance ofNumber
as defined inNumericTypeUtils.isBoxedNumeric(Class)
static void
assertIsBoxedNumeric
(Table t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be an instance ofNumber
as defined inNumericTypeUtils.isBoxedNumeric(Class)
static void
assertIsNumeric
(TableDefinition t, String column, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inNumericTypeUtils.isNumeric(Class)
static void
assertIsNumeric
(TableDefinition t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inNumericTypeUtils.isNumeric(Class)
static void
assertIsNumeric
(Table t, String column, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inNumericTypeUtils.isNumeric(Class)
static void
assertIsNumeric
(Table t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inNumericTypeUtils.isNumeric(Class)
static void
assertIsNumeric
(SelectableDataSet sds, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inNumericTypeUtils.isNumeric(Class)
static void
assertIsNumericOrTime
(TableDefinition t, String column, PlotInfo plotInfo) Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
static void
assertIsNumericOrTime
(TableDefinition t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
static void
assertIsNumericOrTime
(Table t, String column, PlotInfo plotInfo) Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
static void
assertIsNumericOrTime
(Table t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
static void
assertIsNumericOrTime
(SelectableDataSet sds, String column, PlotInfo plotInfo) Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
static void
assertIsNumericOrTime
(SelectableDataSet sds, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
static void
assertIsNumericOrTimeOrCharOrComparableInstance
(TableDefinition t, String column, PlotInfo plotInfo) static void
assertIsNumericOrTimeOrCharOrComparableInstance
(TableDefinition t, String column, String message, PlotInfo plotInfo) static void
assertIsNumericOrTimeOrCharOrComparableInstance
(Table t, String column, PlotInfo plotInfo) static void
assertIsNumericOrTimeOrCharOrComparableInstance
(Table t, String column, String message, PlotInfo plotInfo) static void
assertIsPrimitiveNumeric
(Table t, String column, PlotInfo plotInfo) Requires the column's data type to be a numeric primitive as defined inNumericTypeUtils.isPrimitiveNumeric(Class)
static void
assertIsPrimitiveNumeric
(Table t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric primitive as defined inNumericTypeUtils.isPrimitiveNumeric(Class)
static void
assertIsTime
(TableDefinition t, String column, PlotInfo plotInfo) Requires the column's data type to be a time instance as defined inisTime(Class, PlotInfo)
static void
assertIsTime
(TableDefinition t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a time instance as defined inisTime(Class, PlotInfo)
static void
assertIsTime
(Table t, String column, PlotInfo plotInfo) Requires the column's data type to be a time instance as defined inisTime(Class, PlotInfo)
static void
assertIsTime
(Table t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a time instance as defined inisTime(Class, PlotInfo)
static void
assertNotNull
(Object o, String message, PlotInfo plotInfo) Requires the input objecto
to be non-null.static <T> void
assertNotNullAndNotEmpty
(T[] o, String message, PlotInfo plotInfo) Requires the input objecto
to be non-null.static void
assertNull
(Object o, String message, PlotInfo plotInfo) static void
assertSameSize
(IndexableNumericData[] data, String[] dataNames, PlotInfo plotInfo) Requiresdata
anddataNames
1.static Class
getColumnType
(TableDefinition t, String column, PlotInfo plotInfo) Gets the data type of thecolumn
.static Class
getColumnType
(Table t, String column, PlotInfo plotInfo) Gets the data type of thecolumn
.static Class
getColumnType
(SelectableDataSet sds, String column, PlotInfo plotInfo) Gets the data type of thecolumn
.static boolean
isBoxedNumeric
(Table t, String column, PlotInfo plotInfo) Whether the column's data typeNumericTypeUtils.isBoxedNumeric(Class)
.static boolean
isNumeric
(TableDefinition t, String column, PlotInfo plotInfo) Whether the column's data typeNumericTypeUtils.isNumeric(Class)
.static boolean
Whether the column's data typeNumericTypeUtils.isNumeric(Class)
.static boolean
isNumeric
(SelectableDataSet sds, String column, PlotInfo plotInfo) Whether the column's data typeNumericTypeUtils.isNumeric(Class)
.static boolean
isNumericOrTime
(TableDefinition t, String column, PlotInfo plotInfo) Whether the column's data typeisNumericOrTime(Class, PlotInfo)
.static boolean
isNumericOrTime
(Table t, String column, PlotInfo plotInfo) Whether the column's data typeisNumericOrTime(Class, PlotInfo)
.static boolean
isNumericOrTime
(SelectableDataSet sds, String column, PlotInfo plotInfo) Whether the column's data typeisNumericOrTime(Class, PlotInfo)
.static boolean
Whether the class isNumericTypeUtils.isNumeric(Class)
orisTime(Class, PlotInfo)
static boolean
isNumericOrTime
(Class c, PlotInfo plotInfo) Whether the class isNumericTypeUtils.isNumeric(Class)
orisTime(Class, PlotInfo)
static boolean
isPrimitiveNumeric
(Table t, String column, PlotInfo plotInfo) Whether the column's data typeNumericTypeUtils.isPrimitiveNumeric(Class)
.static boolean
isTime
(TableDefinition t, String column, PlotInfo plotInfo) Whether the column's data type equals Date.class or Instant.classstatic boolean
Whether the column's data type equals Date.class or Instant.classstatic boolean
isTime
(SelectableDataSet sds, String column, PlotInfo plotInfo) Whether the column's data type equals Date.class or Instant.classstatic boolean
Whether the class is equal to Date.class or Instant.classstatic boolean
nanSafeEquals
(double x, double x1)
-
Constructor Details
-
ArgumentValidations
public ArgumentValidations()
-
-
Method Details
-
assertGreaterThan0
Requires the input objecto
to be non-null.- Parameters:
d
- valuename
- variable nameplotInfo
- source of the exception- Throws:
IllegalArgumentException
-o
is null
-
assertNotNull
Requires the input objecto
to be non-null.- Parameters:
o
- objectmessage
- error messageplotInfo
- source of the exception- Throws:
IllegalArgumentException
-o
is null
-
assertNotNullAndNotEmpty
Requires the input objecto
to be non-null.- Parameters:
o
- objectmessage
- error messageplotInfo
- source of the exception- Throws:
IllegalArgumentException
-o
is null
-
assertNull
-
assertInstance
- Parameters:
c1
- classc2
- classmessage
- error messageplotInfo
- source of the exception- Throws:
NullPointerException
-c1
andc2
must not be nullPlotRuntimeException
-c1
is not assignable toc2
IllegalArgumentException
-o
is null
-
assertInstance
public static void assertInstance(Table t, String column, Class c, String message, PlotInfo plotInfo) - Parameters:
t
- tablecolumn
- columnc
- classmessage
- error messageplotInfo
- source of the exception- Throws:
NullPointerException
-t
andc
must not be nullPlotRuntimeException
-column
is not a column oft
, orcolumn
does not have data typec
-
assertInstance
public static void assertInstance(TableDefinition t, String column, Class c, String message, PlotInfo plotInfo) - Parameters:
t
- tablecolumn
- columnc
- classmessage
- error messageplotInfo
- source of the exception- Throws:
NullPointerException
-t
andc
must not be nullPlotRuntimeException
-column
is not a column oft
, orcolumn
does not have data typec
-
assertInstance
public static void assertInstance(SelectableDataSet sds, String column, Class c, String message, PlotInfo plotInfo) - Parameters:
sds
- swappable data setcolumn
- columnc
- classmessage
- error messageplotInfo
- source of the exception- Throws:
NullPointerException
-sds
andc
must not be nullPlotRuntimeException
-column
is not a column oft
, orcolumn
does not have data typec
-
assertIsNumericOrTimeOrCharOrComparableInstance
public static void assertIsNumericOrTimeOrCharOrComparableInstance(Table t, String column, PlotInfo plotInfo) - Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Throws:
NullPointerException
-t
must not be nullPlotRuntimeException
-column
is not a column oft
, orcolumn
does not have the correct data type
-
assertIsNumericOrTimeOrCharOrComparableInstance
public static void assertIsNumericOrTimeOrCharOrComparableInstance(TableDefinition t, String column, PlotInfo plotInfo) - Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Throws:
NullPointerException
-t
must not be nullPlotRuntimeException
-column
is not a column oft
, orcolumn
does not have the correct data type
-
assertIsNumericOrTimeOrCharOrComparableInstance
public static void assertIsNumericOrTimeOrCharOrComparableInstance(Table t, String column, String message, PlotInfo plotInfo) - Parameters:
t
- tablecolumn
- columnmessage
- error messageplotInfo
- source of the exception- Throws:
NullPointerException
-t
must not be nullPlotRuntimeException
-column
is not a column oft
, orcolumn
does not have the correct data type
-
assertIsNumericOrTimeOrCharOrComparableInstance
public static void assertIsNumericOrTimeOrCharOrComparableInstance(TableDefinition t, String column, String message, PlotInfo plotInfo) - Parameters:
t
- tablecolumn
- columnmessage
- error messageplotInfo
- source of the exception- Throws:
NullPointerException
-t
must not be nullPlotRuntimeException
-column
is not a column oft
, orcolumn
does not have the correct data type
-
assertSameSize
public static void assertSameSize(IndexableNumericData[] data, String[] dataNames, PlotInfo plotInfo) Requiresdata
anddataNames
1. contain the same number of members. 2. contain no null members All members ofdata
must be the same size.- Parameters:
data
- array ofIndexableNumericData
dataNames
- names for eachIndexableNumericData
plotInfo
- source of the exception- Throws:
PlotIllegalStateException
-data
anddataNames
are not the same sizePlotIllegalArgumentException
- a member ofdata
ordataNames
is null 2+ members ofdata
are not the same size
-
getColumnType
Gets the data type of thecolumn
.- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Returns:
- data type of
column
- Throws:
PlotRuntimeException
-column
not in the table
-
getColumnType
Gets the data type of thecolumn
.- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Returns:
- data type of
column
- Throws:
PlotRuntimeException
-column
not in the table
-
getColumnType
Gets the data type of thecolumn
.- Parameters:
sds
- selectable datasetcolumn
- columnplotInfo
- source of the exception- Returns:
- data type of
column
- Throws:
PlotRuntimeException
-column
not in the table
-
isTime
Whether the class is equal to Date.class or Instant.class- Parameters:
c
- classplotInfo
- source of the exception- Returns:
- true if
c
equals Date.class or Instant.class, false otherwise
-
isNumericOrTime
Whether the class isNumericTypeUtils.isNumeric(Class)
orisTime(Class, PlotInfo)
- Parameters:
c
- class- Returns:
- true if
c
is a numeric or time class, false otherwise
-
isNumericOrTime
Whether the class isNumericTypeUtils.isNumeric(Class)
orisTime(Class, PlotInfo)
- Parameters:
c
- classplotInfo
- source of the exception- Returns:
- true if
c
is a numeric or time class, false otherwise
-
isTime
Whether the column's data type equals Date.class or Instant.class- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Returns:
- true if the column's data type equals Date.class or Instant.class, false otherwise
-
isTime
Whether the column's data type equals Date.class or Instant.class- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Returns:
- true if the column's data type equals Date.class or Instant.class, false otherwise
-
isTime
Whether the column's data type equals Date.class or Instant.class- Parameters:
sds
- selectable datasetcolumn
- columnplotInfo
- source of the exception- Returns:
- true if the column's data type equals Date.class or Instant.class, false otherwise
-
isPrimitiveNumeric
Whether the column's data typeNumericTypeUtils.isPrimitiveNumeric(Class)
.- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Returns:
- true if the column's data type is a numeric primitive, false otherwise
-
isBoxedNumeric
Whether the column's data typeNumericTypeUtils.isBoxedNumeric(Class)
.- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Returns:
- true if the column's data type is a boxed numeric, false otherwise
-
isNumeric
Whether the column's data typeNumericTypeUtils.isNumeric(Class)
.- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Returns:
- true if the column's data type is numeric, false otherwise
-
isNumeric
Whether the column's data typeNumericTypeUtils.isNumeric(Class)
.- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Returns:
- true if the column's data type is numeric, false otherwise
-
isNumeric
Whether the column's data typeNumericTypeUtils.isNumeric(Class)
.- Parameters:
sds
- selectable datasetcolumn
- columnplotInfo
- source of the exception- Returns:
- true if the column's data type is numeric, false otherwise
-
isNumericOrTime
Whether the column's data typeisNumericOrTime(Class, PlotInfo)
.- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Returns:
- true if the column's data type is a numeric or time instance, false otherwise
-
isNumericOrTime
Whether the column's data typeisNumericOrTime(Class, PlotInfo)
.- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Returns:
- true if the column's data type is a numeric or time instance, false otherwise
-
isNumericOrTime
Whether the column's data typeisNumericOrTime(Class, PlotInfo)
.- Parameters:
sds
- selectable datasetcolumn
- columnplotInfo
- source of the exception- Returns:
- true if the column's data type is a numeric or time instance, false otherwise
-
assertIsTime
Requires the column's data type to be a time instance as defined inisTime(Class, PlotInfo)
- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Throws:
RuntimeException
- if the column's data type isn't a time instance
-
assertIsTime
Requires the column's data type to be a time instance as defined inisTime(Class, PlotInfo)
- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Throws:
RuntimeException
- if the column's data type isn't a time instance
-
assertIsTime
Requires the column's data type to be a time instance as defined inisTime(Class, PlotInfo)
- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exceptionmessage
- error message- Throws:
RuntimeException
- if the column's data type isn't a time instance
-
assertIsTime
public static void assertIsTime(TableDefinition t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a time instance as defined inisTime(Class, PlotInfo)
- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exceptionmessage
- error message- Throws:
RuntimeException
- if the column's data type isn't a time instance
-
assertIsPrimitiveNumeric
Requires the column's data type to be a numeric primitive as defined inNumericTypeUtils.isPrimitiveNumeric(Class)
- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Throws:
RuntimeException
- if the column's data type isn't a numeric primitive
-
assertIsPrimitiveNumeric
public static void assertIsPrimitiveNumeric(Table t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric primitive as defined inNumericTypeUtils.isPrimitiveNumeric(Class)
- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exceptionmessage
- error message- Throws:
RuntimeException
- if the column's data type isn't a numeric primitive
-
assertIsBoxedNumeric
Requires the column's data type to be an instance ofNumber
as defined inNumericTypeUtils.isBoxedNumeric(Class)
- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Throws:
RuntimeException
- if the column's data type isn't an instance ofNumber
-
assertIsBoxedNumeric
Requires the column's data type to be an instance ofNumber
as defined inNumericTypeUtils.isBoxedNumeric(Class)
- Parameters:
t
- tablecolumn
- columnmessage
- error messageplotInfo
- source of the exception- Throws:
RuntimeException
- if the column's data type isn't an instance ofNumber
-
assertIsNumeric
Requires the column's data type to be a numeric instance as defined inNumericTypeUtils.isNumeric(Class)
- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Throws:
PlotRuntimeException
- if the column's data type isn't a numeric instance
-
assertIsNumeric
Requires the column's data type to be a numeric instance as defined inNumericTypeUtils.isNumeric(Class)
- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Throws:
PlotRuntimeException
- if the column's data type isn't a numeric instance
-
assertIsNumeric
Requires the column's data type to be a numeric instance as defined inNumericTypeUtils.isNumeric(Class)
- Parameters:
t
- tablecolumn
- columnmessage
- error messageplotInfo
- source of the exception- Throws:
PlotRuntimeException
- if the column's data type isn't a numeric instance
-
assertIsNumeric
public static void assertIsNumeric(TableDefinition t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inNumericTypeUtils.isNumeric(Class)
- Parameters:
t
- tablecolumn
- columnmessage
- error messageplotInfo
- source of the exception- Throws:
PlotRuntimeException
- if the column's data type isn't a numeric instance
-
assertIsNumeric
public static void assertIsNumeric(SelectableDataSet sds, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inNumericTypeUtils.isNumeric(Class)
- Parameters:
sds
- selectable datasetcolumn
- columnmessage
- error messageplotInfo
- source of the exception- Throws:
PlotRuntimeException
- if the column's data type isn't a numeric instance
-
assertIsNumericOrTime
Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Throws:
PlotRuntimeException
- if the column's data type isn't a numeric or time instance
-
assertIsNumericOrTime
Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
- Parameters:
t
- tablecolumn
- columnplotInfo
- source of the exception- Throws:
PlotRuntimeException
- if the column's data type isn't a numeric or time instance
-
assertIsNumericOrTime
Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
- Parameters:
sds
- selectable datasetcolumn
- columnplotInfo
- source of the exception- Throws:
PlotRuntimeException
- if the column's data type isn't a numeric or time instance
-
assertIsNumericOrTime
Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
- Parameters:
t
- tablecolumn
- columnmessage
- error messageplotInfo
- source of the exception- Throws:
PlotRuntimeException
- if the column's data type isn't a numeric or time instance
-
assertIsNumericOrTime
public static void assertIsNumericOrTime(TableDefinition t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
- Parameters:
t
- tablecolumn
- columnmessage
- error messageplotInfo
- source of the exception- Throws:
PlotRuntimeException
- if the column's data type isn't a numeric or time instance
-
assertIsNumericOrTime
public static void assertIsNumericOrTime(SelectableDataSet sds, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric or time instance as defined inisNumericOrTime(Class, PlotInfo)
- Parameters:
sds
- selectable datasetcolumn
- columnmessage
- error messageplotInfo
- source of the exception- Throws:
PlotRuntimeException
- if the column's data type isn't a numeric or time instance
-
assertColumnsInTable
Requires all columns incols
be columns in the table.- Parameters:
t
- tableplotInfo
- source of the exceptioncols
- column names- Throws:
IllegalArgumentException
- if the table does not contain all columns
-
assertColumnsInTable
Requires all columns incols
be columns in the table.- Parameters:
t
- tableplotInfo
- source of the exceptioncols
- column names- Throws:
IllegalArgumentException
- if the table does not contain all columns
-
assertColumnsInTable
Requires all columns incols
be columns in the selectable dataset.- Parameters:
sds
- selectable datasetplotInfo
- source of the exceptioncols
- column names- Throws:
IllegalArgumentException
- if the table does not contain all columns
-
assertColumnsInTable
Requires all columns incols
be columns in the table held by the handle.- Parameters:
t
- table handleplotInfo
- source of the exceptioncols
- column names- Throws:
IllegalArgumentException
- if the underlying table does not contain all columns
-
nanSafeEquals
public static boolean nanSafeEquals(double x, double x1)
-