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


Java Attribute类代码示例

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


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

示例1: visitDefinitionTable

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * <p/>
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public Object visitDefinitionTable(@NotNull SiddhiQLGrammarParser.DefinitionTableContext ctx) {
    TableDefinition tableDefinition = QueryFactory.createTableDefinition();
    tableDefinition.name(ctx.source().getText());

    List<Attribute> attributeList = (List<Attribute>) visitDefinition(ctx.definition());
    if (attributeList != null) {
        for (Attribute attribute : attributeList) {
            tableDefinition.attribute(attribute.getName(), attribute.getType());
        }
    } else {
        throw new SiddhiParserException("Operation not supported :fromSource and likeSource");
    }

    for (int i = 0; i < ctx.parameterName().size(); i++) {
        tableDefinition.fromParameter((String) visit(ctx.parameterName(i)), (String) visit(ctx.parameterValue(i)));
    }
    return tableDefinition;
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:28,代码来源:SiddhiQLGrammarBasedVisitorImpl.java

示例2: testFilterQuery68

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
@Test
public void testFilterQuery68() throws InterruptedException {
    log.info("Filter test68");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.DOUBLE).attribute("volume", Attribute.Type.LONG));

    String queryReference = siddhiManager.addQuery("from cseEventStream[price <= 100f] select symbol,price insert into outputStream;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50d, 60l});
    inputHandler.send(new Object[]{"WSO2", 70d, 40l});
    inputHandler.send(new Object[]{"WSO2", 44d, 200l});
    Thread.sleep(100);
    Assert.assertEquals(3, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例3: testFilterQuery102

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
@Test
public void testFilterQuery102() throws InterruptedException {
    log.info("Filter test102");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.DOUBLE));

    String queryReference = siddhiManager.addQuery("from cseEventStream[price >= 55f] select symbol,price;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60d});
    inputHandler.send(new Object[]{"WSO2", 70f, 40d});
    inputHandler.send(new Object[]{"WSO2", 44f, 200d});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例4: testFilterQuery81

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
@Test
public void testFilterQuery81() throws InterruptedException {
    log.info("Filter test81");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.DOUBLE));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume < 70f] select symbol,price;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60d});
    inputHandler.send(new Object[]{"WSO2", 70f, 40d});
    inputHandler.send(new Object[]{"WSO2", 44f, 200d});
    Thread.sleep(100);
    Assert.assertEquals(2, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例5: testFilterQuery50

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
@Test
public void testFilterQuery50() throws InterruptedException {
    log.info("Filter test50");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.DOUBLE));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume == 60d ] select symbol,price insert into outputStream ;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60d});
    inputHandler.send(new Object[]{"WSO2", 70f, 40d});
    inputHandler.send(new Object[]{"WSO2", 44f, 200d});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例6: getTupleTypeInformation

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
public static <T extends Tuple> TypeInformation<T> getTupleTypeInformation(AbstractDefinition definition) {
    int tupleSize = definition.getAttributeList().size();
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append("Tuple").append(tupleSize);
    stringBuilder.append("<");
    List<String> attributeTypes = new ArrayList<>();
    for (Attribute attribute : definition.getAttributeList()) {
        attributeTypes.add(getJavaType(attribute.getType()).getName());
    }
    stringBuilder.append(StringUtils.join(attributeTypes, ","));
    stringBuilder.append(">");
    try {
        return TypeInfoParser.parse(stringBuilder.toString());
    } catch (IllegalArgumentException ex) {
        throw new IllegalArgumentException("Unable to parse " + stringBuilder.toString(), ex);
    }
}
 
开发者ID:apache,项目名称:bahir-flink,代码行数:18,代码来源:SiddhiTypeFactory.java

示例7: createAvgAggregator

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
public static OutputAttributeAggregator createAvgAggregator(Attribute.Type[] types) {
    if (types.length > 1) {
        throw new QueryCreationException("Avg can only have one parameter");
    }
    Attribute.Type type = types[0];
    switch (type) {
        case STRING:
            throw new OperationNotSupportedException("Avg not supported for string");
        case INT:
            return new AvgOutputAttributeAggregatorInt();
        case LONG:
            return new AvgOutputAttributeAggregatorLong();
        case FLOAT:
            return new AvgOutputAttributeAggregatorFloat();
        case DOUBLE:
            return new AvgOutputAttributeAggregatorDouble();
        case BOOL:
            throw new OperationNotSupportedException("Avg not supported for bool");
    }
    throw new OperationNotSupportedException("Avg not supported for " + type);
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:22,代码来源:OutputAttributeHandlerParser.java

示例8: createMaxAggregator

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
public static OutputAttributeAggregator createMaxAggregator(Attribute.Type[] types) {
    if (types.length > 1) {
        throw new QueryCreationException("Max can only have one parameter");
    }
    Attribute.Type type = types[0];
    switch (type) {
        case STRING:
            throw new OperationNotSupportedException("Max not supported for string");
        case INT:
            return new MaxOutputAttributeAggregatorInt();
        case LONG:
            return new MaxOutputAttributeAggregatorLong();
        case FLOAT:
            return new MaxOutputAttributeAggregatorFloat();
        case DOUBLE:
            return new MaxOutputAttributeAggregatorDouble();
        case BOOL:
            throw new OperationNotSupportedException("Max not supported for bool");
    }
    throw new OperationNotSupportedException("Max not supported for " + type);
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:22,代码来源:OutputAttributeHandlerParser.java

示例9: createMinAggregator

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
public static OutputAttributeAggregator createMinAggregator(Attribute.Type[] types) {
    if (types.length > 1) {
        throw new QueryCreationException("Min can only have one parameter");
    }
    Attribute.Type type = types[0];
    switch (type) {
        case STRING:
            throw new OperationNotSupportedException("Min not supported for string");
        case INT:
            return new MinOutputAttributeAggregatorInt();
        case LONG:
            return new MinOutputAttributeAggregatorLong();
        case FLOAT:
            return new MinOutputAttributeAggregatorFloat();
        case DOUBLE:
            return new MinOutputAttributeAggregatorDouble();
        case BOOL:
            throw new OperationNotSupportedException("Min not supported for bool");
    }
    throw new OperationNotSupportedException("Min not supported for " + type);
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:22,代码来源:OutputAttributeHandlerParser.java

示例10: testFilterQuery105

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
@Test
public void testFilterQuery105() throws InterruptedException {
    log.info("Filter test105");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.DOUBLE).attribute("quantity", Attribute.Type.INT));

    String queryReference = siddhiManager.addQuery("from cseEventStream[quantity >= 15] select symbol,price,quantity;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60d, 6});
    inputHandler.send(new Object[]{"WSO2", 70f, 40d, 10});
    inputHandler.send(new Object[]{"WSO2", 44f, 200d, 56});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例11: testFilterQuery91

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
@Test
public void testFilterQuery91() throws InterruptedException {
    log.info("Filter test91");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.DOUBLE).attribute("quantity", Attribute.Type.INT));

    String queryReference = siddhiManager.addQuery("from cseEventStream[quantity < 15] select symbol,price,quantity;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60d, 6});
    inputHandler.send(new Object[]{"WSO2", 70f, 40d, 10});
    inputHandler.send(new Object[]{"WSO2", 44f, 200d, 56});
    Thread.sleep(100);
    Assert.assertEquals(2, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例12: testFunctionQuery9

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
@Test
public void testFunctionQuery9() throws InterruptedException {
    log.info("Function test9");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price1", Attribute.Type.FLOAT).attribute("price2", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.LONG).attribute("quantity", Attribute.Type.INT));

    String queryReference = siddhiManager.addQuery("from cseEventStream" +
            " select symbol, concat(price1,price2) as price,quantity;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            Assert.assertEquals("50.060.0", inEvents[0].getData1());
            eventCount++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60f, 60l, 6});
    Thread.sleep(100);
    junit.framework.Assert.assertEquals(1, eventCount);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FunctionTestCase.java

示例13: testFilterQuery49

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
@Test
public void testFilterQuery49() throws InterruptedException {
    log.info("Filter test49");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));


    String queryReference = siddhiManager.addQuery("from cseEventStream[volume > 50d] select symbol,price insert into outputStream ;");
    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60});
    inputHandler.send(new Object[]{"WSO2", 70f, 40});
    inputHandler.send(new Object[]{"WSO2", 44f, 200});
    Thread.sleep(100);
    Assert.assertEquals(2, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例14: testFilterQuery94

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
@Test
public void testFilterQuery94() throws InterruptedException {
    log.info("Filter test94");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.DOUBLE));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume >= 50d] select symbol,price;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60d});
    inputHandler.send(new Object[]{"WSO2", 70f, 40d});
    inputHandler.send(new Object[]{"WSO2", 44f, 200d});
    Thread.sleep(100);
    Assert.assertEquals(2, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例15: testFilterQuery113

import org.wso2.siddhi.query.api.definition.Attribute; //导入依赖的package包/类
@Test(expected = SourceNotExistException.class)
public void testFilterQuery113() throws InterruptedException {
    log.info("Filter test113");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream1").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.LONG).attribute("quantity", Attribute.Type.INT));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume >= 100f] select symbol,price,quantity;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60l, 6});
    inputHandler.send(new Object[]{"WSO2", 70f, 40l, 10});
    inputHandler.send(new Object[]{"WSO2", 44f, 200l, 56});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java


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