本文整理匯總了Java中de.erichseifert.gral.data.Column.isNumeric方法的典型用法代碼示例。如果您正苦於以下問題:Java Column.isNumeric方法的具體用法?Java Column.isNumeric怎麽用?Java Column.isNumeric使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類de.erichseifert.gral.data.Column
的用法示例。
在下文中一共展示了Column.isNumeric方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createBoxData
import de.erichseifert.gral.data.Column; //導入方法依賴的package包/類
/**
* Extracts statistics from the columns of an data source that are commonly
* used for box-and-whisker plots. The result is a new data source
* containing <i>column index</i>, <i>median</i>, <i>mininum</i>, <i>first
* quartile</i>, <i>third quartile</i>, and <i>maximum</i> for each column.
* @param data Original data source
* @return New data source with (columnIndex, median, min, quartile1,
* quartile3, max)
*/
@SuppressWarnings("unchecked")
public static DataSource createBoxData(DataSource data) {
if (data == null) {
throw new NullPointerException(
"Cannot extract statistics from null data source.");
}
DataTable stats = new DataTable(Integer.class, Double.class,
Double.class, Double.class, Double.class, Double.class);
// Generate statistical values for each column
for (int c = 0; c < data.getColumnCount(); c++) {
Column col = data.getColumn(c);
if (!col.isNumeric()) {
continue;
}
stats.add(
c + 1,
col.getStatistics(Statistics.MEDIAN),
col.getStatistics(Statistics.MIN),
col.getStatistics(Statistics.QUARTILE_1),
col.getStatistics(Statistics.QUARTILE_3),
col.getStatistics(Statistics.MAX)
);
}
return stats;
}
示例2: getColumnTypesFor
import de.erichseifert.gral.data.Column; //導入方法依賴的package包/類
private List<Class<? extends Comparable<?>>> getColumnTypesFor(DataSource data) {
List<Class<? extends Comparable<?>>> columnTypes = new LinkedList<>();
for (int colIndex = 0; colIndex < data.getColumnCount(); colIndex++) {
Column<?> column = data.getColumn(colIndex);
if (column.isNumeric()) {
columnTypes.add(Double.class);
columnTypes.add(Double.class);
columnTypes.add(Boolean.class);
} else {
columnTypes.add(column.getType());
}
}
return columnTypes;
}