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


Java CSVLine类代码示例

本文整理汇总了Java中de.linearbits.subframe.io.CSVLine的典型用法代码示例。如果您正苦于以下问题:Java CSVLine类的具体用法?Java CSVLine怎么用?Java CSVLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CSVLine类属于de.linearbits.subframe.io包,在下文中一共展示了CSVLine类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
        }
    }
}
 
开发者ID:prasser,项目名称:subframe,代码行数:28,代码来源:Series3D.java

示例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));
        }
    }
}
 
开发者ID:prasser,项目名称:subframe,代码行数:25,代码来源:Series2D.java

示例3: SeriesBoxAndWhisker

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
 * @param interval
 * @param precision
 * @param omitEmptyBuckets
 * @throws IOException 
 */
public SeriesBoxAndWhisker(CSVFile file, 
                           Selector<String[]> selector, 
                           Field xField, 
                           Field yField,
                           double interval,
                           int precision,
                           boolean omitEmptyBuckets) {
    
    CSVFile input = file.getBucketizedFile(selector, xField.category, xField.measure, yField.category, yField.measure, interval, precision, omitEmptyBuckets);
    Iterator<CSVLine> iter = input.iterator();
    int id = 1;
    while (iter.hasNext()) {
        CSVLine csvline = iter.next();
        data.add(new PointBoxAndWhisker(String.valueOf(id++),
                                        csvline.get(yField.category, Analyzer.MINIMUM),
                                        csvline.get(yField.category, Analyzer.PERCENTILE(0.25d)),
                                        csvline.get(yField.category, Analyzer.MEDIAN),
                                        csvline.get(yField.category, Analyzer.PERCENTILE(0.75d)),
                                        csvline.get(yField.category, Analyzer.MAXIMUM),
                                        csvline.get(xField.category, Analyzer.VALUE)));
    }
}
 
开发者ID:prasser,项目名称:subframe,代码行数:35,代码来源:SeriesBoxAndWhisker.java

示例4: analyzeMean

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 analyzeMean(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
    double lightning = 1d;
    double datafly = 1d;
    double igreedy = 1d;
    for (Iterator<CSVLine> iter = file.iterator(); iter.hasNext(); ) {
        CSVLine line = iter.next();
        if (selector.isSelected(line.getData())) {
            lightning *= Double.valueOf(line.get("Lightning", Analyzer.VALUE)) + 1d;
            datafly *= Double.valueOf(line.get("DataFly", Analyzer.VALUE)) + 1d;
            igreedy *= Double.valueOf(line.get("IGreedy", Analyzer.VALUE)) + 1d; 
        }
    }
    
    lightning = Double.valueOf(format((Math.pow(lightning, 1d/5d) - 1d) * 100d));
    datafly = Double.valueOf(format((Math.pow(datafly, 1d/5d) - 1d) * 100d));
    igreedy = Double.valueOf(format((Math.pow(igreedy, 1d/5d) - 1d) * 100d));
    
    Object[] output = new String[]{criterion.toString(),
                                   format(lightning, lightning, datafly, igreedy),
                                   format(datafly, lightning, datafly, igreedy),
                                   format(igreedy, lightning, datafly, igreedy)};
    System.out.format("   - %-30s%-30s%-30s%-30s\n", output);
    
}
 
开发者ID:arx-deidentifier,项目名称:highdimensional-benchmark,代码行数:45,代码来源:BenchmarkAnalysis1.java

示例5: 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);
        }
    }
}
 
开发者ID:arx-deidentifier,项目名称:highdimensional-benchmark,代码行数:37,代码来源:BenchmarkAnalysis1.java

示例6: 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);
        }
    }
}
 
开发者ID:arx-deidentifier,项目名称:highdimensional-benchmark,代码行数:61,代码来源:BenchmarkAnalysis2.java

示例7: getValue

import de.linearbits.subframe.io.CSVLine; //导入依赖的package包/类
/**
 * Returns a field value multiplied with the given factor. Performs some rounding
 * @param line
 * @param field
 * @param factor
 * @return
 */
private static double getValue(CSVLine line, String field, double factor) {
    return Double.valueOf(format(Double.valueOf(line.get(field, Analyzer.VALUE)) * factor));
}
 
开发者ID:arx-deidentifier,项目名称:highdimensional-benchmark,代码行数:11,代码来源:BenchmarkAnalysis2.java


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