Package com.illumon.iris.db.plot.util
Class ArgumentValidations
java.lang.Object
com.illumon.iris.db.plot.util.ArgumentValidations
Utilities for validating that plotting arguments are acceptable.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertColumnsInTable(SelectableDataSet sds, PlotInfo plotInfo, String... cols) Requires all columns incolsbe columns in the selectable dataset.static voidassertColumnsInTable(TableHandle t, PlotInfo plotInfo, String... cols) Requires all columns incolsbe columns in the table held by the handle.static voidassertColumnsInTable(TableDefinition t, PlotInfo plotInfo, String... cols) Requires all columns incolsbe columns in the table.static voidassertColumnsInTable(Table t, PlotInfo plotInfo, String... cols) Requires all columns incolsbe columns in the table.static voidassertGreaterThan0(double d, String name, PlotInfo plotInfo) Requires the input objectoto be non-null.static voidassertInstance(SelectableDataSet sds, String column, Class c, String message, PlotInfo plotInfo) static voidassertInstance(TableDefinition t, String column, Class c, String message, PlotInfo plotInfo) static voidstatic voidassertInstance(Class c1, Class c2, String message, PlotInfo plotInfo) static voidassertIsBoxedNumeric(Table t, String column, PlotInfo plotInfo) Requires the column's data type to be an instance ofNumberas defined inTypeUtils.isBoxedNumeric(Class)static voidassertIsBoxedNumeric(Table t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be an instance ofNumberas defined inTypeUtils.isBoxedNumeric(Class)static voidassertIsNumeric(SelectableDataSet sds, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inTypeUtils.isNumeric(Class)static voidassertIsNumeric(TableDefinition t, String column, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inTypeUtils.isNumeric(Class)static voidassertIsNumeric(TableDefinition t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inTypeUtils.isNumeric(Class)static voidassertIsNumeric(Table t, String column, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inTypeUtils.isNumeric(Class)static voidassertIsNumeric(Table t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric instance as defined inTypeUtils.isNumeric(Class)static voidassertIsNumericOrTime(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 voidassertIsNumericOrTime(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 voidassertIsNumericOrTime(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 voidassertIsNumericOrTime(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 voidassertIsNumericOrTime(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 voidassertIsNumericOrTime(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 voidassertIsNumericOrTimeOrCharOrComparableInstance(TableDefinition t, String column, PlotInfo plotInfo) static voidassertIsNumericOrTimeOrCharOrComparableInstance(TableDefinition t, String column, String message, PlotInfo plotInfo) static voidassertIsNumericOrTimeOrCharOrComparableInstance(Table t, String column, PlotInfo plotInfo) static voidassertIsNumericOrTimeOrCharOrComparableInstance(Table t, String column, String message, PlotInfo plotInfo) static voidassertIsPrimitiveNumeric(Table t, String column, PlotInfo plotInfo) Requires the column's data type to be a numeric primitive as defined inTypeUtils.isPrimitiveNumeric(Class)static voidassertIsPrimitiveNumeric(Table t, String column, String message, PlotInfo plotInfo) Requires the column's data type to be a numeric primitive as defined inTypeUtils.isPrimitiveNumeric(Class)static voidassertIsTime(TableDefinition t, String column, PlotInfo plotInfo) Requires the column's data type to be a time instance as defined inisTime(Class, PlotInfo)static voidassertIsTime(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 voidassertIsTime(Table t, String column, PlotInfo plotInfo) Requires the column's data type to be a time instance as defined inisTime(Class, PlotInfo)static voidassertIsTime(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 voidassertNotNull(Object o, String message, PlotInfo plotInfo) Requires the input objectoto be non-null.static <T> voidassertNotNullAndNotEmpty(T[] o, String message, PlotInfo plotInfo) Requires the input objectoto be non-null.static voidassertNull(Object o, String message, PlotInfo plotInfo) static voidAssert that the X, Y and Z ranges of a dataseries do not contain infinite boundaries.static voidassertSameSize(IndexableNumericData[] data, String[] dataNames, PlotInfo plotInfo) RequiresdataanddataNames1.static voidstatic voidassertXValuesAreSame(String prefix, AbstractXYDataSetCollection dataset) Requires allXYDataSeriesInternalindatasetto have the same x-values.static voidassertXValuesAreSame(String prefix, XYDataSeriesInternal series0, XYDataSeriesInternal series) Requires theseriesto have the same x-values as the firstXYDataSeriesInternalin the collection.static ClassgetColumnType(SelectableDataSet sds, String column, PlotInfo plotInfo) Gets the data type of thecolumn.static ClassgetColumnType(TableDefinition t, String column, PlotInfo plotInfo) Gets the data type of thecolumn.static ClassgetColumnType(Table t, String column, PlotInfo plotInfo) Gets the data type of thecolumn.static booleanisBoxedNumeric(Table t, String column, PlotInfo plotInfo) Whether the column's data typeTypeUtils.isBoxedNumeric(Class).static booleanisNumeric(SelectableDataSet sds, String column, PlotInfo plotInfo) Whether the column's data typeTypeUtils.isNumeric(Class).static booleanisNumeric(TableDefinition t, String column, PlotInfo plotInfo) Whether the column's data typeTypeUtils.isNumeric(Class).static booleanWhether the column's data typeTypeUtils.isNumeric(Class).static booleanisNumericOrTime(SelectableDataSet sds, String column, PlotInfo plotInfo) Whether the column's data typeisNumericOrTime(Class, PlotInfo).static booleanisNumericOrTime(TableDefinition t, String column, PlotInfo plotInfo) Whether the column's data typeisNumericOrTime(Class, PlotInfo).static booleanisNumericOrTime(Table t, String column, PlotInfo plotInfo) Whether the column's data typeisNumericOrTime(Class, PlotInfo).static booleanWhether the class isTypeUtils.isNumeric(Class)orisTime(Class, PlotInfo)static booleanisNumericOrTime(Class c, PlotInfo plotInfo) Whether the class isTypeUtils.isNumeric(Class)orisTime(Class, PlotInfo)static booleanisPrimitiveNumeric(Table t, String column, PlotInfo plotInfo) Whether the column's data typeTypeUtils.isPrimitiveNumeric(Class).static booleanisTime(SelectableDataSet sds, String column, PlotInfo plotInfo) Whether the column's data type equals Date.class or DBDateTime.classstatic booleanisTime(TableDefinition t, String column, PlotInfo plotInfo) Whether the column's data type equals Date.class or DBDateTime.classstatic booleanWhether the column's data type equals Date.class or DBDateTime.classstatic booleanWhether the class is equal to Date.class or DBDateTime.classstatic booleannanSafeEquals(double x, double x1)
-
Constructor Details
-
ArgumentValidations
public ArgumentValidations()
-
-
Method Details
-
assertGreaterThan0
Requires the input objectoto be non-null.- Parameters:
d- valuename- variable nameplotInfo- source of the exception- Throws:
IllegalArgumentException-ois null
-
assertNotNull
Requires the input objectoto be non-null.- Parameters:
o- objectmessage- error messageplotInfo- source of the exception- Throws:
IllegalArgumentException-ois null
-
assertNotNullAndNotEmpty
Requires the input objectoto be non-null.- Parameters:
o- objectmessage- error messageplotInfo- source of the exception- Throws:
IllegalArgumentException-ois null
-
assertNull
-
assertInstance
- Parameters:
c1- classc2- classmessage- error messageplotInfo- source of the exception- Throws:
NullPointerException-c1andc2must not be nullPlotRuntimeException-c1is not assignable toc2IllegalArgumentException-ois 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-tandcmust not be nullPlotRuntimeException-columnis not a column oft, orcolumndoes 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-tandcmust not be nullPlotRuntimeException-columnis not a column oft, orcolumndoes 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-sdsandcmust not be nullPlotRuntimeException-columnis not a column oft, orcolumndoes 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-tmust not be nullPlotRuntimeException-columnis not a column oft, orcolumndoes 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-tmust not be nullPlotRuntimeException-columnis not a column oft, orcolumndoes 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-tmust not be nullPlotRuntimeException-columnis not a column oft, orcolumndoes 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-tmust not be nullPlotRuntimeException-columnis not a column oft, orcolumndoes not have the correct data type
-
assertSameSize
public static void assertSameSize(IndexableNumericData[] data, String[] dataNames, PlotInfo plotInfo) RequiresdataanddataNames1. contain the same number of members. 2. contain no null members All members ofdatamust be the same size.- Parameters:
data- array ofIndexableNumericDatadataNames- names for eachIndexableNumericDataplotInfo- source of the exception- Throws:
PlotIllegalStateException-dataanddataNamesare not the same sizePlotIllegalArgumentException- a member ofdataordataNamesis null 2+ members ofdataare 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-columnnot 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-columnnot 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-columnnot in the table
-
isTime
Whether the class is equal to Date.class or DBDateTime.class- Parameters:
c- classplotInfo- source of the exception- Returns:
- true if
cequals Date.class or DBDateTime.class, false otherwise
-
isNumericOrTime
Whether the class isTypeUtils.isNumeric(Class)orisTime(Class, PlotInfo)- Parameters:
c- class- Returns:
- true if
cis a numeric or time class, false otherwise
-
isNumericOrTime
Whether the class isTypeUtils.isNumeric(Class)orisTime(Class, PlotInfo)- Parameters:
c- classplotInfo- source of the exception- Returns:
- true if
cis a numeric or time class, false otherwise
-
isTime
Whether the column's data type equals Date.class or DBDateTime.class- Parameters:
t- tablecolumn- columnplotInfo- source of the exception- Returns:
- true if the column's data type equals Date.class or DBDateTime.class, false otherwise
-
isTime
Whether the column's data type equals Date.class or DBDateTime.class- Parameters:
t- tablecolumn- columnplotInfo- source of the exception- Returns:
- true if the column's data type equals Date.class or DBDateTime.class, false otherwise
-
isTime
Whether the column's data type equals Date.class or DBDateTime.class- Parameters:
sds- selectable datasetcolumn- columnplotInfo- source of the exception- Returns:
- true if the column's data type equals Date.class or DBDateTime.class, false otherwise
-
isPrimitiveNumeric
Whether the column's data typeTypeUtils.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 typeTypeUtils.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 typeTypeUtils.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 typeTypeUtils.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 typeTypeUtils.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 inTypeUtils.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 inTypeUtils.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 ofNumberas defined inTypeUtils.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 ofNumberas defined inTypeUtils.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 inTypeUtils.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 inTypeUtils.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 inTypeUtils.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 inTypeUtils.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 inTypeUtils.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 incolsbe 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 incolsbe 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 incolsbe 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 incolsbe 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
-
assertXValuesAreSame
-
assertXValuesAreSame
public static void assertXValuesAreSame(String prefix, AbstractXYDataSetCollection dataset) throws PlotIllegalStateException Requires allXYDataSeriesInternalindatasetto have the same x-values.- Parameters:
dataset- data collection- Throws:
PlotIllegalStateException- if not all series indatasetto have the same x-values.
-
assertXValuesAreSame
public static void assertXValuesAreSame(String prefix, XYDataSeriesInternal series0, XYDataSeriesInternal series) throws PlotIllegalStateException Requires theseriesto have the same x-values as the firstXYDataSeriesInternalin the collection.- Parameters:
series0- first series in the collectionseries- next series to check- Throws:
PlotIllegalStateException- ifseriesdoes not have the same x-values as the firstXYDataSeriesInternalin the collection.
-
nanSafeEquals
public static boolean nanSafeEquals(double x, double x1) -
assertRangeNotInfinite
public static void assertRangeNotInfinite(XYDataSeriesInternal series) throws PlotIllegalStateException Assert that the X, Y and Z ranges of a dataseries do not contain infinite boundaries.- Parameters:
series- The series to check- Throws:
PlotIllegalStateException- if any of the ranges contain an infinite boundary
-