本文整理匯總了Java中de.erichseifert.gral.data.Column類的典型用法代碼示例。如果您正苦於以下問題:Java Column類的具體用法?Java Column怎麽用?Java Column使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Column類屬於de.erichseifert.gral.data包,在下文中一共展示了Column類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: revalidateAxisExtrema
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
/**
* Rebuilds cached plot data.
*/
private void revalidateAxisExtrema() {
synchronized (this) {
for (Entry<DataSource, Map<Integer, String>> entryByDataSource : columnToAxisMappingByDataSource.entrySet()) {
DataSource dataSource = entryByDataSource.getKey();
Map<Integer, String> columnToAxisMapping = entryByDataSource.getValue();
for (Entry<Integer, String> entry : columnToAxisMapping.entrySet()) {
Integer colIndex = entry.getKey();
String axisName = entry.getValue();
Column<?> col = dataSource.getColumn(colIndex);
Double min = axisMin.get(axisName);
Double max = axisMax.get(axisName);
if (min == null || max == null) {
min = col.getStatistics(Statistics.MIN);
max = col.getStatistics(Statistics.MAX);
} else {
min = Math.min(min, col.getStatistics(Statistics.MIN));
max = Math.max(max, col.getStatistics(Statistics.MAX));
}
axisMin.put(axisName, min);
axisMax.put(axisName, max);
}
}
}
}
示例2: createSlices
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
/**
* Creates the slice objects with start and end information for a specified
* data source.
* @param source Data source.
*/
private void createSlices(DataSource source) {
if (!isVisible(source)) {
return;
}
final int colIndex = 0;
Column col = source.getColumn(colIndex);
List<Slice> dataSlices = new ArrayList<Slice>(col.size());
slices.put(source, dataSlices);
double start = 0.0;
for (Comparable<?> cell : col) {
Number numericCell = (Number) cell;
double value = 0.0;
if (MathUtils.isCalculatable(numericCell)) {
value = numericCell.doubleValue();
}
// abs() is required because negative values cause
// "empty" slices
double span = Math.abs(value);
Slice slice = new Slice(start, start + span);
dataSlices.add(slice);
start += span;
}
}
示例3: revalidateAxisExtrema
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
/**
* Rebuilds cached plot data.
*/
private void revalidateAxisExtrema() {
synchronized (this) {
for (Entry<Tuple, String> entry : mapping.entrySet()) {
Tuple mapKey = entry.getKey();
DataSource s = (DataSource) mapKey.get(0);
Column col = s.getColumn((Integer) mapKey.get(1));
String axisName = entry.getValue();
Double min = axisMin.get(axisName);
Double max = axisMax.get(axisName);
if (min == null || max == null) {
min = col.getStatistics(Statistics.MIN);
max = col.getStatistics(Statistics.MAX);
} else {
min = Math.min(min, col.getStatistics(Statistics.MIN));
max = Math.max(max, col.getStatistics(Statistics.MAX));
}
axisMin.put(axisName, min);
axisMax.put(axisName, max);
}
}
}
示例4: 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;
}
示例5: 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;
}
示例6: testCreatePieDataContainsPieSliceRanges
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
@Test
public void testCreatePieDataContainsPieSliceRanges() {
DataTable data = new DataTable(Integer.class);
data.add(1);
data.add(1);
data.add(1);
DataSource pieData = PiePlot.createPieData(data);
assertThat((Column<Double>) pieData.getColumn(0), CoreMatchers.hasItems(0.0, 1.0, 2.0));
assertThat((Column<Double>) pieData.getColumn(1), CoreMatchers.hasItems(1.0, 2.0, 3.0));
}
示例7: testCreatePieDatasBooleanColumnContainsFalseForEveryNegativeInputValue
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
@Test
public void testCreatePieDatasBooleanColumnContainsFalseForEveryNegativeInputValue() {
DataTable data = new DataTable(Integer.class);
data.add(2);
data.add(-5);
data.add(0);
DataSource pieData = PiePlot.createPieData(data);
Column<Boolean> visibilityColumn = (Column<Boolean>) pieData.getColumn(2);
assertThat(visibilityColumn.get(1), is(false));
}
示例8: testCreatePieDatasBooleanColumnContainsTrueForEveryPositiveInputValue
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
@Test
public void testCreatePieDatasBooleanColumnContainsTrueForEveryPositiveInputValue() {
DataTable data = new DataTable(Integer.class);
data.add(2);
data.add(-5);
data.add(0);
DataSource pieData = PiePlot.createPieData(data);
Column<Boolean> visibilityColumn = (Column<Boolean>) pieData.getColumn(2);
assertThat(visibilityColumn.get(0), is(true));
}
示例9: actionPerformed
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
public void actionPerformed(ActionEvent e) {
if (!component.isVisible()) {
return;
}
double time = System.currentTimeMillis();
// Physical system memory
long memSysTotal = 0L;
long memSysFree = 0L;
long memSysUsed = 0L;
// We can only display system memory if there are the corresponding
// methods
if ((getTotalPhysicalMemorySize != null) &&
(getFreePhysicalMemorySize != null)) {
OperatingSystemMXBean osBean =
ManagementFactory.getOperatingSystemMXBean();
try {
memSysTotal = (Long) getTotalPhysicalMemorySize.invoke(osBean);
memSysFree = (Long) getFreePhysicalMemorySize.invoke(osBean);
memSysUsed = memSysTotal - memSysFree;
} catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException ex) {
}
}
// JVM memory
long memVmTotal = Runtime.getRuntime().totalMemory();
long memVmFree = Runtime.getRuntime().freeMemory();
long memVmUsed = memVmTotal - memVmFree;
data.add(time, memSysUsed/1024L/1024L, memVmTotal/1024L/1024L, memVmUsed/1024L/1024L);
data.remove(0);
Column col1 = data.getColumn(0);
plot.getAxis(XYPlot.AXIS_X).setRange(
col1.getStatistics(Statistics.MIN),
col1.getStatistics(Statistics.MAX)
);
Column col3 = data.getColumn(2);
plot.getAxis(XYPlot.AXIS_Y).setRange(
0, Math.max(
memSysTotal/1024L/1024L,
col3.getStatistics(Statistics.MAX)
)
);
component.repaint();
}
示例10: mean
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
public static double mean(DataSource data, int col)
{
Column column = data.getColumn(col);
return column.getStatistics(de.erichseifert.gral.data.statistics.Statistics.MEAN);
}
示例11: max
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
public static double max(DataSource data, int col)
{
Column column = data.getColumn(col);
return column.getStatistics(de.erichseifert.gral.data.statistics.Statistics.MAX);
}
示例12: min
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
public static double min(DataSource data, int col)
{
Column column = data.getColumn(col);
return column.getStatistics(de.erichseifert.gral.data.statistics.Statistics.MIN);
}
示例13: variance
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
public static double variance(DataSource data, int col)
{
Column column = data.getColumn(col);
return column.getStatistics(de.erichseifert.gral.data.statistics.Statistics.VARIANCE);
}
示例14: population_variance
import de.erichseifert.gral.data.Column; //導入依賴的package包/類
public static double population_variance(DataSource data, int col)
{
Column column = data.getColumn(col);
return column.getStatistics(de.erichseifert.gral.data.statistics.Statistics.POPULATION_VARIANCE);
}