当前位置: 首页>>代码示例>>Java>>正文


Java DataTable.isDateTime方法代码示例

本文整理汇总了Java中com.rapidminer.datatable.DataTable.isDateTime方法的典型用法代码示例。如果您正苦于以下问题:Java DataTable.isDateTime方法的具体用法?Java DataTable.isDateTime怎么用?Java DataTable.isDateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.rapidminer.datatable.DataTable的用法示例。


在下文中一共展示了DataTable.isDateTime方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawSimpleDateLegend

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
public void drawSimpleDateLegend(Graphics graphics, int x, int y, DataTable table, int legendColumn, double min,
		double max) {
	String minColorString = null;
	String maxColorString = null;
	if (table.isDate(legendColumn)) {
		minColorString = Tools.createDateAndFormat(min);
		maxColorString = Tools.createDateAndFormat(max);
	} else if (table.isTime(legendColumn)) {
		minColorString = Tools.createTimeAndFormat(min);
		maxColorString = Tools.createTimeAndFormat(max);
	} else if (table.isDateTime(legendColumn)) {
		minColorString = Tools.createDateTimeAndFormat(min);
		maxColorString = Tools.createDateTimeAndFormat(max);
	} else {
		minColorString = Tools.formatNumber(min);
		maxColorString = Tools.formatNumber(max);
	}

	drawSimpleNumericalLegend(graphics, x, y, table.getColumnName(legendColumn), minColorString, maxColorString);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:PlotterAdapter.java

示例2: SingleValueValueRange

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
/**
 * Instantiates a new {@link SingleValueValueRange}.
 * 
 * The string representation is created based on the data type of a column in a data table.
 * 
 * @param value
 *            the value of the value range
 * @param dataTable
 *            a data table, from which the data type of the value is extracted
 * @param columnIdx
 *            the column index in data table which is used to extract the data type of the value
 * @throws IllegalArgumentException
 *             if the specified column has an unknown data type (i.e. neither numerical, nominal
 *             nor date).
 */
public SingleValueValueRange(double value, DataTable dataTable, int columnIdx) {
	this.value = value;
	this.columnIdx = columnIdx;
	if (columnIdx >= 0) {
		if (Double.isNaN(value)) {
			valueString = I18N.getGUILabel("plotter.unknown_value_label");
		} else if (dataTable.isNumerical(columnIdx)) {
			valueString = Double.toString(value);
		} else if (dataTable.isNominal(columnIdx)) {
			valueString = dataTable.mapIndex(columnIdx, (int) value);
		} else if (dataTable.isDateTime(columnIdx)) {
			valueString = Tools.formatDateTime(new Date((long) value));
		} else {
			throw new IllegalArgumentException("unknown data type in data table - this should not happen");
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:33,代码来源:SingleValueValueRange.java

示例3: DataTableColumn

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
/**
 * @brief Creates a new {@link DataTableColumn}.
 * 
 *        name and value type are automatically initialized from the specified column in
 *        dataTable. The DataTableColumn does not keep a reference to dataTable.
 */
public DataTableColumn(DataTable dataTable, int columnIdx) {
	if (columnIdx >= 0 && columnIdx < dataTable.getColumnNumber()) {
		this.columnName = dataTable.getColumnName(columnIdx);
		if (dataTable.isDateTime(columnIdx)) {
			this.valueType = ValueType.DATE_TIME;
		} else if (dataTable.isNominal(columnIdx)) {
			this.valueType = ValueType.NOMINAL;
		} else if (dataTable.isNumerical(columnIdx)) {
			this.valueType = ValueType.NUMERICAL;
		} else {
			this.valueType = ValueType.INVALID;
		}
	} else {
		this.columnName = null;
		this.valueType = ValueType.INVALID;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:24,代码来源:DataTableColumn.java

示例4: addPoint

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
private void addPoint(DataTable dataTable, Map<String, List<double[]>> dataCollection, double x, double y, double z,
		double color) {
	List<double[]> dataList = null;
	if (Double.isNaN(color)) {
		dataList = dataCollection.get("All");
		if (dataList == null) {
			dataList = new LinkedList<>();
			dataCollection.put("All", dataList);
		}
	} else {
		String name = color + "";
		if (dataTable.isNominal(colorColumn)) {
			name = dataTable.mapIndex(colorColumn, (int) color);
		} else if (dataTable.isDate(colorColumn)) {
			name = Tools.createDateAndFormat(color);
		} else if (dataTable.isTime(colorColumn)) {
			name = Tools.createTimeAndFormat(color);
		} else if (dataTable.isDateTime(colorColumn)) {
			name = Tools.createDateTimeAndFormat(color);
		}
		dataList = dataCollection.get(name);
		if (dataList == null) {
			dataList = new LinkedList<>();
			dataCollection.put(name, dataList);
		}
	}

	this.bubbleSizeMin = MathFunctions.robustMin(this.bubbleSizeMin, z);
	this.bubbleSizeMax = MathFunctions.robustMax(this.bubbleSizeMax, z);
	this.xAxisMin = MathFunctions.robustMin(this.xAxisMin, x);
	this.yAxisMin = MathFunctions.robustMin(this.yAxisMin, y);
	this.xAxisMax = MathFunctions.robustMax(this.xAxisMax, x);
	this.yAxisMax = MathFunctions.robustMax(this.yAxisMax, y);
	this.minColor = MathFunctions.robustMin(this.minColor, color);
	this.maxColor = MathFunctions.robustMax(this.maxColor, color);

	dataList.add(new double[] { x, y, z });
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:39,代码来源:BubbleChartPlotter.java

示例5: drawLegend

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
/** This method can be used to draw a legend on the given graphics context. */
protected void drawLegend(Graphics graphics, DataTable table, int legendColumn, int xOffset, int alpha) {
	if (legendColumn < 0 || legendColumn > table.getNumberOfColumns() - 1) {
		return;
	}
	if (table.isNominal(legendColumn)) {
		String maxNominalValuesString = ParameterService
				.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_LEGEND_CLASSLIMIT);
		int maxNumberOfNominalValues = 10;
		try {
			if (maxNominalValuesString != null) {
				maxNumberOfNominalValues = Integer.parseInt(maxNominalValuesString);
			}
		} catch (NumberFormatException e) {
			// LogService.getGlobal().logWarning("Plotter: cannot parse maximal number of nominal values for legend ("
			// + maxNominalValuesString +
			// ")! Using 10...");
			LogService.getRoot().log(Level.WARNING,
					"com.rapidminer.gui.plotter.PlotterAdapter.parsing_maximal_number_of_nominal_values_error",
					maxNominalValuesString);
		}
		if (maxNumberOfNominalValues == -1 || table.getNumberOfValues(legendColumn) <= maxNumberOfNominalValues) {
			drawNominalLegend(graphics, table, legendColumn, xOffset, alpha);
		} else {
			// LogService.getGlobal().logWarning("Plotter: cannot draw nominal legend since number of different values is too high (more than "
			// +
			// maxNominalValuesString + ")! Using numerical legend instead.");
			LogService.getRoot().log(Level.WARNING,
					"com.rapidminer.gui.plotter.PlotterAdapter.drawing_nominal_legend_error", maxNominalValuesString);
			drawNumericalLegend(graphics, table, legendColumn, alpha);
		}
	} else if (table.isDate(legendColumn) || table.isTime(legendColumn) || table.isDateTime(legendColumn)) {
		drawDateLegend(graphics, table, legendColumn, alpha);
	} else {
		drawNumericalLegend(graphics, table, legendColumn, alpha);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:38,代码来源:PlotterAdapter.java

示例6: drawDateLegend

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
private void drawDateLegend(Graphics graphics, DataTable table, int legendColumn, int alpha) {
	double min = Double.POSITIVE_INFINITY;
	double max = Double.NEGATIVE_INFINITY;
	synchronized (table) {
		Iterator<DataTableRow> i = table.iterator();
		while (i.hasNext()) {
			DataTableRow row = i.next();
			double colorValue = row.getValue(legendColumn);
			min = MathFunctions.robustMin(min, colorValue);
			max = MathFunctions.robustMax(max, colorValue);
		}
	}
	String minColorString = null;
	String maxColorString = null;
	if (table.isDate(legendColumn)) {
		minColorString = Tools.createDateAndFormat(min);
		maxColorString = Tools.createDateAndFormat(max);
	} else if (table.isTime(legendColumn)) {
		minColorString = Tools.createTimeAndFormat(min);
		maxColorString = Tools.createTimeAndFormat(max);
	} else if (table.isDateTime(legendColumn)) {
		minColorString = Tools.createDateTimeAndFormat(min);
		maxColorString = Tools.createDateTimeAndFormat(max);
	} else {
		minColorString = Tools.formatNumber(min);
		maxColorString = Tools.formatNumber(max);
	}

	drawNumericalLegend(graphics, getWidth(), minColorString, maxColorString, table.getColumnName(legendColumn), alpha);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:31,代码来源:PlotterAdapter.java

示例7: getColumnIndex

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
/**
 * Finds the column index for the column named columnName in dataTable, checks if that column in
 * the data table is compatible with to settings valueType, and updates this.columnIdx.
 * 
 * If the column does not exist or is not compatible, the columnIdx is set to -1.
 */
public static int getColumnIndex(DataTable dataTable, String columnName, ValueType valueType) {
	int columnIdx = dataTable.getColumnIndex(columnName);
	if (columnIdx >= 0) {
		// check value type
		switch (valueType) {
			case NOMINAL:
				if (!dataTable.isNominal(columnIdx)) {
					columnIdx = -1;
				}
				break;
			case NUMERICAL:
				if (!dataTable.isNumerical(columnIdx)) {
					columnIdx = -1;
				}
				break;
			case DATE_TIME:
				if (!dataTable.isDateTime(columnIdx)) {
					columnIdx = -1;
				}
				break;
			case INVALID:
				// do nothing
				break;
		}
	}
	return columnIdx;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:34,代码来源:DataTableColumn.java

示例8: doWork

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
@Override
public void doWork() throws OperatorException {
	DataTable table = null;
	if (isParameterSet(PARAMETER_LOG_NAME)) {
		String dataTableName = getParameterAsString(PARAMETER_LOG_NAME);
		table = getProcess().getDataTable(dataTableName);
	} else {
		if (getProcess().getDataTables().size() > 0) {
			table = getProcess().getDataTables().iterator().next();
			logNote("No log name was specified, using first data table found...");
		}
	}

	// check
	if (table == null) {
		throw new UserError(this, 939);
	}

	// create attributes
	List<Attribute> attributes = new ArrayList<Attribute>();
	for (int i = 0; i < table.getNumberOfColumns(); i++) {
		String name = table.getColumnName(i);
		if (table.isDate(i)) {
			attributes.add(AttributeFactory.createAttribute(name, Ontology.DATE));
		} else if (table.isDateTime(i)) {
			attributes.add(AttributeFactory.createAttribute(name, Ontology.DATE_TIME));
		} else if (table.isNumerical(i)) {
			attributes.add(AttributeFactory.createAttribute(name, Ontology.REAL));
		} else {
			attributes.add(AttributeFactory.createAttribute(name, Ontology.NOMINAL));
		}
	}

	// create table
	MemoryExampleTable exampleTable = new MemoryExampleTable(attributes);
	for (int r = 0; r < table.getNumberOfRows(); r++) {
		DataTableRow row = table.getRow(r);
		double[] data = new double[attributes.size()];
		for (int i = 0; i < table.getNumberOfColumns(); i++) {
			if (table.isDate(i)) {
				data[i] = row.getValue(i);
			} else if (table.isDateTime(i)) {
				data[i] = row.getValue(i);
			} else if (table.isNumerical(i)) {
				data[i] = row.getValue(i);
			} else {
				Attribute attribute = attributes.get(i);
				String value = table.getValueAsString(row, i);
				data[i] = attribute.getMapping().mapString(value);
			}
		}
		exampleTable.addDataRow(new DoubleArrayDataRow(data));
	}

	// create and return example set
	exampleSetOutput.deliver(exampleTable.createExampleSet());
	dummyPorts.passDataThrough();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:59,代码来源:ProcessLog2ExampleSet.java

示例9: populateCategoryMap

import com.rapidminer.datatable.DataTable; //导入方法依赖的package包/类
private void populateCategoryMap(DataTable dataTable) {
	this.categoryToColumnListMap.put(HeuristicPlotterConfigurator.NUMERICAL, new ArrayList<String>());
	this.categoryToColumnListMap.put(HeuristicPlotterConfigurator.LABEL, new ArrayList<String>());
	this.categoryToColumnListMap.put(HeuristicPlotterConfigurator.NOMINAL, new ArrayList<String>());
	this.categoryToColumnListMap.put(HeuristicPlotterConfigurator.DATE, new ArrayList<String>());

	for (int i = 0; i < dataTable.getNumberOfColumns(); i++) {
		if (dataTable.isNumerical(i)) {
			this.categoryToColumnListMap.get(HeuristicPlotterConfigurator.NUMERICAL).add(dataTable.getColumnName(i));
		}
		if (dataTable.isNominal(i)) {
			if (dataTable.getNumberOfValues(i) <= MAX_NOMINAL_VALUES) {
				this.categoryToColumnListMap.get(HeuristicPlotterConfigurator.NOMINAL).add(dataTable.getColumnName(i));
			}
		}
		if (dataTable.isDateTime(i)) {
			this.categoryToColumnListMap.get(HeuristicPlotterConfigurator.DATE).add(dataTable.getColumnName(i));
		}
	}

	if (dataTable instanceof DataTableExampleSetAdapter) {
		DataTableExampleSetAdapter mine = (DataTableExampleSetAdapter) dataTable;

		String labelName = mine.getLabelName();
		if (labelName != null) {

			if (mine.isLabelNominal()) {
				// only add nominal labels with less than MAX_NOMINAL_VALUES different values
				if (mine.getNumberOfValues(mine.getColumnIndex(labelName)) <= MAX_NOMINAL_VALUES) {
					this.categoryToColumnListMap.get(HeuristicPlotterConfigurator.NOMINAL).add(labelName);
					this.categoryToColumnListMap.get(HeuristicPlotterConfigurator.LABEL).add(labelName);
				}
			} else {
				this.categoryToColumnListMap.get(HeuristicPlotterConfigurator.LABEL).add(labelName);
			}
			// remove Label from the numerical attribute list
			if (this.categoryToColumnListMap.get(HeuristicPlotterConfigurator.NUMERICAL).contains(labelName)) {
				this.categoryToColumnListMap.get(HeuristicPlotterConfigurator.NUMERICAL).remove(labelName);
			}
		}
		// if there is a cluster attribute it can be handled as an additional label for axis
		// selection:
		if (mine.getClusterName() != null) {
			this.categoryToColumnListMap.get(HeuristicPlotterConfigurator.LABEL).add(mine.getClusterName());
		}

	} else { // set empty values unless Label and Nominal are already set
		if (categoryToColumnListMap.get(HeuristicPlotterConfigurator.LABEL).equals("")) {
			this.categoryToColumnListMap.put(HeuristicPlotterConfigurator.LABEL, new ArrayList<String>());
		}
		if (categoryToColumnListMap.get(HeuristicPlotterConfigurator.NOMINAL).equals("")) {
			this.categoryToColumnListMap.put(HeuristicPlotterConfigurator.NOMINAL, new ArrayList<String>());
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:56,代码来源:HeuristicPlotterConfigurator.java


注:本文中的com.rapidminer.datatable.DataTable.isDateTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。