本文整理汇总了Java中com.rapidminer.datatable.DataTable.isDate方法的典型用法代码示例。如果您正苦于以下问题:Java DataTable.isDate方法的具体用法?Java DataTable.isDate怎么用?Java DataTable.isDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rapidminer.datatable.DataTable
的用法示例。
在下文中一共展示了DataTable.isDate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: 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 });
}
示例3: 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);
}
}
示例4: 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);
}
示例5: 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();
}