|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.node.viz.histogram.util.BinningUtil
public final class BinningUtil
This class provides methods to create the bins of numerical bars.
Method Summary | |
---|---|
static int |
addDataRow2Bin(boolean binNominal,
List<? extends BinDataModel> bins,
BinDataModel missingValueBin,
int startBin,
DataCell xCell,
Color rowColor,
RowKey id,
Collection<ColorColumn> aggrColumns,
DataCell... aggrCells)
Adds the given row either to the missing value bin if the x value is missing or to the corresponding bin. |
static boolean |
binNominal(DataColumnSpec colSpec,
int noOfBins)
|
static int |
calculateIntegerMaxNoOfBins(int noOfBins,
DataColumnSpec xColSpec)
Calculates the maximum number of bins for the given column spec if it is an integer column or returns the given number of bins. |
static boolean |
checkDomainRange(DataCell cell,
DataColumnSpec spec)
Checks if the given cell is in the domain range of the given DataColumnSpec . |
static String |
createBarName(boolean firstBar,
double leftBoundary,
double rightBoundary)
Creates the name of the bin depending on the given boundaries. |
static double |
createBinInterval(double maxVal,
double minVal,
int noOfBins,
boolean isInteger)
|
static double |
createBinStart(double minVal,
double binInterval,
boolean isInteger)
Called to calculate the left start value of the binning. |
static List<InteractiveBinDataModel> |
createInteractiveIntervalBins(DataColumnSpec colSpec,
int numberOfBins)
Creates the given number of interval bins for the given column specification. |
static List<InteractiveBinDataModel> |
createInteractiveNominalBins(DataColumnSpec colSpec)
Creates interactive nominal bins for the given column specification. |
static List<BinDataModel> |
createIntervalBins(DataColumnSpec colSpec,
int numberOfBins)
Creates the given number of interval bins for the given column specification. |
static List<BinDataModel> |
createNominalBins(DataColumnSpec colSpec)
Creates interactive nominal bins for the given column specification. |
static double |
getNumericValue(DataCell cell)
Checks if the given DataCell is a numeric cell and returns
the numeric value. |
static double |
myRoundedBorders(double doubleVal,
double increment,
int noOfDigits)
Returns the rounded value which contains the given number of decimal places after the last 0 in the given increment. |
static double |
smallValueRounder(double doubleVal,
int noOfDigits,
boolean isInteger,
boolean roundUp)
Returns the rounded value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static double createBinInterval(double maxVal, double minVal, int noOfBins, boolean isInteger)
maxVal
- the maximum possible valueminVal
- the minimum possible valuenoOfBins
- the number of barsisInteger
- true
if the value should be an integer
public static double createBinStart(double minVal, double binInterval, boolean isInteger)
minVal
- the minimum value to roundbinInterval
- the bin interval to check if we can start with 0isInteger
- true
if the x column is an integer
public static double getNumericValue(DataCell cell)
DataCell
is a numeric cell and returns
the numeric value. If it's not a numeric cell it throws an
IllegalArgumentException
.
cell
- the cell to convert
public static String createBarName(boolean firstBar, double leftBoundary, double rightBoundary)
firstBar
- indicates if this is the first barleftBoundary
- the left boundary of the binrightBoundary
- the right boundary of the bin
public static double myRoundedBorders(double doubleVal, double increment, int noOfDigits)
doubleVal
- the value to roundincrement
- the increment which defines the start index of the digit
counternoOfDigits
- the number of decimal places to display
public static double smallValueRounder(double doubleVal, int noOfDigits, boolean isInteger, boolean roundUp)
bigValueRounder(double, boolean)
method otherwise it returns the rounded value which contains the
given number of decimal places after the last 0.
doubleVal
- the value to roundnoOfDigits
- the number of
decimal places we want for less then 1 valuesisInteger
- true
if the given number is an integerroundUp
- if the value should be rounded up
public static List<InteractiveBinDataModel> createInteractiveNominalBins(DataColumnSpec colSpec)
colSpec
- the column specification
public static List<BinDataModel> createNominalBins(DataColumnSpec colSpec)
colSpec
- the column specification
public static List<InteractiveBinDataModel> createInteractiveIntervalBins(DataColumnSpec colSpec, int numberOfBins)
colSpec
- the column specificationnumberOfBins
- the number of bins to create
public static List<BinDataModel> createIntervalBins(DataColumnSpec colSpec, int numberOfBins)
colSpec
- the column specificationnumberOfBins
- the number of bins to create
public static int addDataRow2Bin(boolean binNominal, List<? extends BinDataModel> bins, BinDataModel missingValueBin, int startBin, DataCell xCell, Color rowColor, RowKey id, Collection<ColorColumn> aggrColumns, DataCell... aggrCells) throws IllegalArgumentException
binNominal
- if true
the bins should be nominal
bins where the x value has to match exactly. If false
the bins should be interval bins and the x value has fit into the lower
and upper bound of the bin.bins
- the BinDataModel
listmissingValueBin
- the bin for the missing x value rowsstartBin
- the index of the bin to start with to speed up the
process if the data rows are sorted by the x valuexCell
- the x cellrowColor
- the color of the rowid
- the row idaggrColumns
- the aggregation columns as ColorColumn
objects in the same order like the aggregation cellsaggrCells
- the aggregation DataCell
objects which
contain the value
IllegalArgumentException
- if the given row doesn't fit in any binpublic static boolean binNominal(DataColumnSpec colSpec, int noOfBins)
colSpec
- the DataColumnSpec
of the column to binnoOfBins
- the number of bins
true
if the bins should be nominalpublic static boolean checkDomainRange(DataCell cell, DataColumnSpec spec)
DataColumnSpec
. If the cell is missing the method returns
true
.
cell
- the cell to checkspec
- the DataColumnSpec
with the domain
true
if the cell is missing or the value is between
the upper and lower bound specified by the domain of the given column
specificationpublic static int calculateIntegerMaxNoOfBins(int noOfBins, DataColumnSpec xColSpec)
noOfBins
- the current number of binsxColSpec
- to calculate the range for
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |