本文整理汇总了Java中de.linearbits.subframe.io.CSVLine.get方法的典型用法代码示例。如果您正苦于以下问题:Java CSVLine.get方法的具体用法?Java CSVLine.get怎么用?Java CSVLine.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.linearbits.subframe.io.CSVLine
的用法示例。
在下文中一共展示了CSVLine.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Series3D
import de.linearbits.subframe.io.CSVLine; //导入方法依赖的package包/类
/**
* Creates a series by selecting rows and taking three values
*
* @param file
* @param selector
* @param xField
* @param yField
* @param zField
*/
public Series3D(CSVFile file,
Selector<String[]> selector,
Field xField,
Field yField,
Field zField){
Iterator<CSVLine> iter = file.iterator();
while (iter.hasNext()) {
CSVLine csvline = iter.next();
String[] line = csvline.getData();
if (selector.isSelected(line)) {
String x = csvline.get(xField.category, xField.measure);
String y = csvline.get(yField.category, yField.measure);
String z = csvline.get(zField.category, zField.measure);
data.add(new Point3D(x, y, z));
}
}
}
示例2: Series2D
import de.linearbits.subframe.io.CSVLine; //导入方法依赖的package包/类
/**
* Creates a series by selecting rows and taking two values
*
* @param file
* @param selector
* @param xField
* @param yField
*/
public Series2D(CSVFile file,
Selector<String[]> selector,
Field xField,
Field yField){
Iterator<CSVLine> iter = file.iterator();
while (iter.hasNext()) {
CSVLine csvline = iter.next();
String[] line = csvline.getData();
if (selector.isSelected(line)) {
String x = csvline.get(xField.category, xField.measure);
String y = csvline.get(yField.category, yField.measure);
data.add(new Point2D(x, y));
}
}
}
示例3: analyze
import de.linearbits.subframe.io.CSVLine; //导入方法依赖的package包/类
/**
* Analyzes the results from one experiment
* @param file
* @param measure
* @param suppression
* @param criterion
* @throws ParseException
*/
private static void analyze(CSVFile file,
BenchmarkQualityMeasure measure,
double suppression,
BenchmarkPrivacyModel criterion) throws ParseException {
// Select
Selector<String[]> selector = file.getSelectorBuilder()
.field("Suppression limit").equals(String.valueOf(suppression)).and()
.field("Quality measure").equals(measure.toString()).and()
.field("Privacy model").equals(criterion.toString())
.build();
// Iterate
for (Iterator<CSVLine> iter = file.iterator(); iter.hasNext(); ) {
CSVLine line = iter.next();
if (selector.isSelected(line.getData())) {
double own = Double.valueOf(format(Double.valueOf(line.get("Lightning", Analyzer.VALUE)) * 100d));
double datafly = Double.valueOf(format(Double.valueOf(line.get("DataFly", Analyzer.VALUE)) * 100d));
double igreedy = Double.valueOf(format(Double.valueOf(line.get("IGreedy", Analyzer.VALUE)) * 100d));
Object[] output = new String[]{criterion.toString(),
line.get("", "Dataset"),
format(own, own, datafly, igreedy),
format(datafly, own, datafly, igreedy),
format(igreedy, own, datafly, igreedy)};
System.out.format(" - %-30s%-30s%-30s%-30s%-30s\n", output);
}
}
}
示例4: analyze
import de.linearbits.subframe.io.CSVLine; //导入方法依赖的package包/类
/**
* Analyzes the results from one experiment
* @param file
* @param measure
* @param suppression
* @param criterion
* @throws ParseException
*/
private static void analyze(CSVFile file,
BenchmarkQualityMeasure measure,
double suppression,
BenchmarkPrivacyModel criterion) throws ParseException {
// Select
Selector<String[]> selector = file.getSelectorBuilder()
.field("Suppression limit").equals(String.valueOf(suppression)).and()
.field("Quality measure").equals(measure.toString()).and()
.field("Privacy model").equals(criterion.toString())
.build();
// Iterate
for (Iterator<CSVLine> iter = file.iterator(); iter.hasNext(); ) {
CSVLine line = iter.next();
if (selector.isSelected(line.getData())) {
// Read values
double _flash = getValue(line, "Flash", 1d / 1000d);
double _lightning = getValue(line, "Lightning", 1d / 1000d);
double _utility = getValue(line, "Quality", 100d);
// Convert to strings
String discovery = "--";
String utility = "--";
String flash = null;
String lightning = null;
if (_utility != -100d) {
utility = format(100d - _utility);
discovery = format(getValue(line, "Discovery", 1d / 1000d));
}
flash = format(_flash);
lightning = format(_lightning);
// Discovery and total time of lightning are potentially measured in different benchmark runs.
// Due to fluctuations in the JVM execution times, discovery can thus be
// a bit larger than total time, when they are actually identical.
// We handle this special case here.
if (!discovery.equals("--") && Double.valueOf(discovery) > Double.valueOf(_lightning)) {
discovery = format(_lightning);
}
// Print
Object[] output = new String[]{line.get("", "Dataset"),
flash,
lightning,
discovery,
utility};
System.out.format("%-30s%-30s%-30s%-30s%-30s\n", output);
}
}
}