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