當前位置: 首頁>>代碼示例>>Java>>正文


Java Column類代碼示例

本文整理匯總了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);
			}
		}
	}
}
 
開發者ID:eseifert,項目名稱:gral,代碼行數:29,代碼來源:AbstractPlot.java

示例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;
       }
}
 
開發者ID:charles-cooper,項目名稱:idylfin,代碼行數:30,代碼來源:PiePlot.java

示例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);
		}
	}
}
 
開發者ID:charles-cooper,項目名稱:idylfin,代碼行數:26,代碼來源:AbstractPlot.java

示例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;
}
 
開發者ID:eseifert,項目名稱:gral,代碼行數:37,代碼來源:BoxPlot.java

示例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;
}
 
開發者ID:eseifert,項目名稱:gral,代碼行數:15,代碼來源:PiePlot.java

示例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));
}
 
開發者ID:eseifert,項目名稱:gral,代碼行數:13,代碼來源:PiePlotTest.java

示例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));
}
 
開發者ID:eseifert,項目名稱:gral,代碼行數:13,代碼來源:PiePlotTest.java

示例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));
}
 
開發者ID:eseifert,項目名稱:gral,代碼行數:13,代碼來源:PiePlotTest.java

示例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();
}
 
開發者ID:eseifert,項目名稱:gral,代碼行數:50,代碼來源:MemoryUsage.java

示例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);
}
 
開發者ID:charles-cooper,項目名稱:idylfin,代碼行數:6,代碼來源:Statistics.java

示例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);
}
 
開發者ID:charles-cooper,項目名稱:idylfin,代碼行數:6,代碼來源:Statistics.java

示例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);
}
 
開發者ID:charles-cooper,項目名稱:idylfin,代碼行數:6,代碼來源:Statistics.java

示例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);
}
 
開發者ID:charles-cooper,項目名稱:idylfin,代碼行數:6,代碼來源:Statistics.java

示例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);
}
 
開發者ID:charles-cooper,項目名稱:idylfin,代碼行數:6,代碼來源:Statistics.java


注:本文中的de.erichseifert.gral.data.Column類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。