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


Java SelectorBuilder类代码示例

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


SelectorBuilder类属于de.linearbits.objectselector包,在下文中一共展示了SelectorBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test2

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的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

示例2: test3

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的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

示例3: test5

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的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

示例4: test6

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的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

示例5: test8

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的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

示例6: test9

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的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

示例7: test10

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的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

示例8: test11

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的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

示例9: test12

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的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

示例10: test13

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的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

示例11: test14

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的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

示例12: getSelectorBuilder

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的package包/类
/**
 * Returns a new selector builder
 * 
 * @param datatypes
 *            Data types for run data
 * @return
 */
public SelectorBuilder<String[]> getSelectorBuilder(DataType<?>[] datatypes) {
    
    List<String> labels = new ArrayList<String>();
    List<DataType<?>> types = new ArrayList<DataType<?>>();
    
    for (int i = 0; i < header1.length; i++) {
        
        // Run data
        if (header1[i].equals("")) {
            labels.add(header2[i]);
            if (datatypes != null) {
                types.add(datatypes[i]);
            } else {
                types.add(DataType.STRING);
            }
        }
        // Benchmark data
        else {
            labels.add(header1[i] + "." + header2[i]);
            types.add(DataType.NUMERIC);
        }
    }
    
    String[] aLabels = labels.toArray(new String[labels.size()]);
    DataType<?>[] aTypes = types.toArray(new DataType<?>[types.size()]);
    return new SelectorBuilder<String[]>(new ArrayAccessor<String>(aLabels, aTypes));
}
 
开发者ID:prasser,项目名称:subframe,代码行数:35,代码来源:CSVFile.java

示例13: test1

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的package包/类
@Test
public void test1() throws IllegalArgumentException, IOException, ParseException {

    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
    List<Integer> list1 = getSelected(selector, elements);

    // Create a selector by parsing a query string
    selector = new SelectorBuilder<Element>(new ElementAccessor(), 
                                            "('bool'='true' and 'integer'>='50') or 'numeric'<='30'")
                                            .build();
	
    // Select
    List<Integer> list2 = getSelected(selector, elements);
    
    // Test
    assertTrue(list1.equals(list2));
}
 
开发者ID:prasser,项目名称:object-selector,代码行数:31,代码来源:Tests.java

示例14: test4

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的package包/类
@Test
public void test4() throws IllegalArgumentException, IOException, ParseException {

    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
    List<Integer> list1 = getSelected(selector, elements);

    // Create a selector by parsing a query string
    selector = new SelectorBuilder<Element>(new ObjectAccessor<Element>(Element.class),
                                          "('bool'='true' and 'integer'>='50') or 'numeric'<='30'")
                                          .build();
	
    // Select
    List<Integer> list2 = getSelected(selector, elements);
    
    // Test
    assertTrue(list1.equals(list2));
}
 
开发者ID:prasser,项目名称:object-selector,代码行数:32,代码来源:Tests.java

示例15: test7

import de.linearbits.objectselector.SelectorBuilder; //导入依赖的package包/类
@Test
  public void test7() throws IllegalArgumentException, IOException, ParseException {

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
      List<Integer> list1 = getSelected(selector, elements);

// Create a selector by parsing a query string
selector = new SelectorBuilder<int[]>(accessor, 
                                      "'field1'<='20' and 'field2'<='20' and 'field3'<='20'")
                                      .build();

      // Select
      List<Integer> list2 = getSelected(selector, elements);
      
      // Test
      assertTrue(list1.equals(list2));
  }
 
开发者ID:prasser,项目名称:object-selector,代码行数:31,代码来源:Tests.java


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