本文整理汇总了Java中de.linearbits.objectselector.Selector类的典型用法代码示例。如果您正苦于以下问题:Java Selector类的具体用法?Java Selector怎么用?Java Selector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Selector类属于de.linearbits.objectselector包,在下文中一共展示了Selector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSeries
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
/**
* Returns a series
*
* @param file
* @param algorithm
* @param focus
* @return
* @throws ParseException
*/
private static Series3D getSeries(CSVFile file,
String algorithm,
String variable,
String focus) throws ParseException {
// Select data for the given algorithm
Selector<String[]> selector = file.getSelectorBuilder()
.field("Algorithm").equals(algorithm)
.build();
// Create series
Series3D series = new Series3D(file, selector,
new Field(focus),
new Field("Algorithm"),
new Field(variable, Analyzer.ARITHMETIC_MEAN),
new BufferedGeometricMeanAnalyzer());
return series;
}
开发者ID:arx-deidentifier,项目名称:anonbench,代码行数:29,代码来源:BenchmarkAnalysis.java
示例2: Series3D
import de.linearbits.objectselector.Selector; //导入依赖的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
示例3: Series2D
import de.linearbits.objectselector.Selector; //导入依赖的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
示例4: SeriesBoxAndWhisker
import de.linearbits.objectselector.Selector; //导入依赖的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
示例5: test2
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
@Test
public void test2() {
try {
List<Element> elements = getElements();
// Create a selector by parsing a query string
Selector<Element> selector = new SelectorBuilder<Element>(new ElementAccessor(),
"('bool'='true' and 'integer'>='50') or 'numeric'<='30'")
.build();
// Select
result = getSelected(selector, elements);
} catch (Exception e) {
fail(e.getMessage());
}
}
开发者ID:prasser,项目名称:object-selector,代码行数:19,代码来源:Tests.java
示例6: test3
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
@Test
public void test3() {
try {
List<Element> elements = getElements();
// Create a selector with the builder pattern
Selector<Element> selector = new SelectorBuilder<Element>(new ElementAccessor())
.begin()
.field("bool").equals(true)
.and()
.field("integer").geq(50)
.end()
.or()
.field("numeric").leq(30d)
.build();
// Select
result = getSelected(selector, elements);
} catch (Exception e) {
fail(e.getMessage());
}
}
开发者ID:prasser,项目名称:object-selector,代码行数:25,代码来源:Tests.java
示例7: test5
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
@Test
public void test5() {
try {
List<Element> elements = getElements();
// Create a selector with the builder pattern
Selector<Element> selector = new SelectorBuilder<Element>(new ObjectAccessor<Element>(Element.class))
.begin()
.field("bool").equals(true)
.and()
.field("integer").geq(50)
.end()
.or()
.field("numeric").leq(30d)
.build();
// Select
result = getSelected(selector, elements);
} catch (Exception e) {
fail(e.getMessage());
}
}
开发者ID:prasser,项目名称:object-selector,代码行数:25,代码来源:Tests.java
示例8: test6
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
@Test
public void test6() {
try {
List<Element> elements = getElements();
// Create a selector by parsing a query string
Selector<Element> selector = new SelectorBuilder<Element>(new ObjectAccessor<Element>(Element.class),
"('bool'='true' and 'integer'>='50') or 'numeric'<='30'")
.build();
// Select
result = getSelected(selector, elements);
} catch (Exception e) {
fail(e.getMessage());
}
}
开发者ID:prasser,项目名称:object-selector,代码行数:18,代码来源:Tests.java
示例9: test8
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
@Test
public void test8() {
try {
List<int[]> elements = getIntArrays();
// Create header
IntArrayAccessor accessor = new IntArrayAccessor(new String[]{"field1", "field2", "field3"});
// Create a selector with the builder pattern
Selector<int[]> selector = new SelectorBuilder<int[]>(accessor).field("field1").leq(20)
.and()
.field("field2").leq(20)
.and()
.field("field3").leq(20)
.build();
// Select
result = getSelected(selector, elements);
} catch (Exception e) {
fail(e.getMessage());
}
}
开发者ID:prasser,项目名称:object-selector,代码行数:24,代码来源:Tests.java
示例10: test9
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
@Test
public void test9() {
try {
List<int[]> elements = getIntArrays();
// Create header
IntArrayAccessor accessor = new IntArrayAccessor(new String[]{"field1", "field2", "field3"});
// Create a selector by parsing a query string
Selector<int[]> selector = new SelectorBuilder<int[]>(accessor,
"'field1'<='20' and 'field2'<='20' and 'field3'<='20'")
.build();
// Select
result = getSelected(selector, elements);
} catch (Exception e) {
fail(e.getMessage());
}
}
开发者ID:prasser,项目名称:object-selector,代码行数:21,代码来源:Tests.java
示例11: test10
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
@Test
public void test10() {
try {
List<int[]> elements = getIntArrays();
// Create header
IntArrayAccessor accessor = new IntArrayAccessor(new String[]{"field1", "field2", "field3"});
// Create a selector by parsing a query string
Selector<int[]> selector = new SelectorBuilder<int[]>(accessor,
"'field1'<>'20' and 'field2'<>'20' and 'field3'<>'20'")
.build();
// Select
result = getSelected(selector, elements);
} catch (Exception e) {
fail(e.getMessage());
}
}
开发者ID:prasser,项目名称:object-selector,代码行数:21,代码来源:Tests.java
示例12: test11
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
@Test
public void test11() {
try {
List<int[]> elements = getIntArrays();
// Create header
IntArrayAccessor accessor = new IntArrayAccessor(new String[]{"field1", "field2", "field3"});
// Create a selector by parsing a query string
Selector<int[]> selector = new SelectorBuilder<int[]>(accessor,
"'field1'<>'20'<>'field1'")
.build();
// Select
result = getSelected(selector, elements);
fail("This string must not compile");
} catch (Exception e) {
// Expected behavior
}
}
开发者ID:prasser,项目名称:object-selector,代码行数:22,代码来源:Tests.java
示例13: test12
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
@Test
public void test12() {
try {
List<int[]> elements = getIntArrays();
// Create header
IntArrayAccessor accessor = new IntArrayAccessor(new String[]{"field1", "field2", "field3"});
// Create a selector by parsing a query string
Selector<int[]> selector = new SelectorBuilder<int[]>(accessor,
"'field1' <> '20' '20'")
.build();
// Select
result = getSelected(selector, elements);
fail("This string must not compile");
} catch (Exception e) {
// Expected behavior
}
}
开发者ID:prasser,项目名称:object-selector,代码行数:22,代码来源:Tests.java
示例14: test13
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
@Test
public void test13() {
try {
List<int[]> elements = getIntArrays();
// Create header
IntArrayAccessor accessor = new IntArrayAccessor(new String[]{"field1", "field2", "field3"});
// Create a selector by parsing a query string
Selector<int[]> selector = new SelectorBuilder<int[]>(accessor,
"'field1'<>'20'<>'20'")
.build();
// Select
result = getSelected(selector, elements);
fail("This string must not compile");
} catch (Exception e) {
// Expected behavior
}
}
开发者ID:prasser,项目名称:object-selector,代码行数:22,代码来源:Tests.java
示例15: test14
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
@Test
public void test14() {
try {
List<int[]> elements = getIntArrays();
// Create header
IntArrayAccessor accessor = new IntArrayAccessor(new String[]{"field1", "field2", "field3"});
// Create a selector by parsing a query string
Selector<int[]> selector = new SelectorBuilder<int[]>(accessor,
"'field1'<>'20'<>")
.build();
// Select
result = getSelected(selector, elements);
fail("This string must not compile");
} catch (Exception e) {
// Expected behavior
}
}
开发者ID:prasser,项目名称:object-selector,代码行数:22,代码来源:Tests.java
示例16: analyze
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
/**
* Performs the analysis
* @param file
* @return
* @throws ParseException
*/
private static PlotGroup analyze(CSVFile file) throws ParseException{
// Selects all rows
Selector<String[]> selector = file.getSelectorBuilder().field("Polygamma").equals("true").or().equals("false").build();
Series3D series = new Series3D(file, selector,
new Field("Dataset"),
new Field("Polygamma"),
new Field("Check", Analyzer.VALUE));
series.transform(new Function<Point3D>(){
@Override
public Point3D apply(Point3D arg0) {
return new Point3D(arg0.x,
arg0.y.equals("true") ? "With polygamma" : "Without polygamma",
arg0.z);
}
});
List<Plot<?>> plots = new ArrayList<Plot<?>>();
plots.add(new PlotHistogramClustered("",
new Labels("Dataset", "Time per check [ms]"),
series));
GnuPlotParams params = new GnuPlotParams();
params.rotateXTicks = 0;
params.keypos = KeyPos.TOP_LEFT;
params.size = 1.0d;
params.ratio = 0.5d;
return new PlotGroup("Comparison of execution times of using the Pitman model with and without the polygamma optimization", plots, params, 1.0d);
}
开发者ID:arx-deidentifier,项目名称:risk-benchmark,代码行数:38,代码来源:BenchmarkAnalysis2.java
示例17: analyze
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
/**
* Performs the analysis
* @param file
* @return
* @throws ParseException
*/
private static PlotGroup analyze(CSVFile file) throws ParseException{
// Selects all rows
Selector<String[]> selector = file.getSelectorBuilder().field("Binary").equals("true").or().equals("false").build();
Series3D series = new Series3D(file, selector,
new Field("Dataset"),
new Field("Binary"),
new Field("Check", Analyzer.VALUE));
series.transform(new Function<Point3D>(){
@Override
public Point3D apply(Point3D arg0) {
return new Point3D(arg0.x,
arg0.y.equals("true") ? "With binary search" : "Without binary search",
arg0.z);
}
});
List<Plot<?>> plots = new ArrayList<Plot<?>>();
plots.add(new PlotHistogramClustered("",
new Labels("Dataset", "Time per check [ms]"),
series));
GnuPlotParams params = new GnuPlotParams();
params.rotateXTicks = 0;
params.keypos = KeyPos.TOP_LEFT;
params.size = 1.0d;
params.ratio = 0.5d;
return new PlotGroup("Comparison of execution times of using the Pitman model with and without the binary search optimization", plots, params, 1.0d);
}
开发者ID:arx-deidentifier,项目名称:risk-benchmark,代码行数:38,代码来源:BenchmarkAnalysis5.java
示例18: getSeriesForLinesPlot
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
/**
* Returns a series that can be clustered by size
* @param file
* @param method
* @return
* @throws ParseException
*/
private static Series3D getSeriesForLinesPlot(CSVFile file, BenchmarkDataset dataset, String generalization) throws ParseException {
Selector<String[]> selector = file.getSelectorBuilder()
.field("Dataset").equals(dataset.toString()).and()
.field("Generalization").equals(generalization)
.build();
if (generalization.equals("0.0")) {
generalization = "None";
} else if (generalization.equals("0.25")) {
generalization = "Low";
} else if (generalization.equals("0.5")) {
generalization = "Medium";
} else if (generalization.equals("0.75")) {
generalization = "High";
} else if (generalization.equals("1.0")) {
generalization = "Full";
}
Series3D series = new Series3D(file, selector,
new Field("Suppression"),
"Entropy-"+generalization,
new Field("Entropy", Analyzer.VALUE));
series.append(new Series3D(file, selector,
new Field("Suppression"),
"EntropyWithBound-"+generalization,
new Field("EntropyWithBound", Analyzer.VALUE)));
return series;
}
开发者ID:arx-deidentifier,项目名称:risk-benchmark,代码行数:39,代码来源:BenchmarkAnalysis4.java
示例19: getSeriesForLinesPlot
import de.linearbits.objectselector.Selector; //导入依赖的package包/类
/**
* Returns a series that can be clustered by size
* @param file
* @param measure
* @param method
* @return
* @throws ParseException
*/
private static Series3D getSeriesForLinesPlot(CSVFile file, BenchmarkDataset dataset, BenchmarkUtilityMeasure measure) throws ParseException {
Selector<String[]> selector = file.getSelectorBuilder()
.field("Dataset").equals(dataset.toString()).and()
.field("Utility measure").equals(measure.toString())
.build();
Series3D series = new Series3D(file, selector,
new Field("Uniqueness"),
new Field("Privacy model"),
new Field("Utility", Analyzer.VALUE));
return series;
}
开发者ID:arx-deidentifier,项目名称:risk-benchmark,代码行数:23,代码来源:BenchmarkAnalysis7.java
示例20: analyzeMean
import de.linearbits.objectselector.Selector; //导入依赖的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
注:本文中的de.linearbits.objectselector.Selector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论