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


Java LastElementView类代码示例

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


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

示例1: testInstantiateChain

import com.espertech.esper.view.std.LastElementView; //导入依赖的package包/类
public void testInstantiateChain() throws Exception {
    SupportBeanClassView topView = new SupportBeanClassView(TEST_CLASS);
    List<ViewFactory> viewFactories = SupportViewSpecFactory.makeFactoryListOne(topView.getEventType());
    AgentInstanceViewFactoryChainContext context = SupportStatementContextFactory.makeAgentInstanceViewFactoryContext();

    // Check correct views created
    List<View> views = ViewServiceHelper.instantiateChain(topView, viewFactories, context);

    assertEquals(3, views.size());
    assertEquals(LengthWindowView.class, views.get(0).getClass());
    assertEquals(UnivariateStatisticsView.class, views.get(1).getClass());
    assertEquals(LastElementView.class, views.get(2).getClass());

    // Check that the context is set
    viewFactories = SupportViewSpecFactory.makeFactoryListFive(topView.getEventType());
    views = ViewServiceHelper.instantiateChain(topView, viewFactories, context);
    TimeWindowView timeWindow = (TimeWindowView) views.get(0);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:19,代码来源:TestViewServiceHelper.java

示例2: testInstantiateChain

import com.espertech.esper.view.std.LastElementView; //导入依赖的package包/类
public void testInstantiateChain() throws Exception
{
    SupportBeanClassView topView = new SupportBeanClassView(TEST_CLASS);
    List<ViewFactory> viewFactories = SupportViewSpecFactory.makeFactoryListOne(topView.getEventType());
    AgentInstanceViewFactoryChainContext context = SupportStatementContextFactory.makeAgentInstanceViewFactoryContext();

    // Check correct views created
    List<View> views = ViewServiceHelper.instantiateChain(topView, viewFactories, context);

    assertEquals(3, views.size());
    assertEquals(LengthWindowView.class, views.get(0).getClass());
    assertEquals(UnivariateStatisticsView.class, views.get(1).getClass());
    assertEquals(LastElementView.class, views.get(2).getClass());

    // Check that the context is set
    viewFactories = SupportViewSpecFactory.makeFactoryListFive(topView.getEventType());
    views = ViewServiceHelper.instantiateChain(topView, viewFactories, context);
    TimeWindowView timeWindow = (TimeWindowView) views.get(0);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:20,代码来源:TestViewServiceHelper.java

示例3: testMatch

import com.espertech.esper.view.std.LastElementView; //导入依赖的package包/类
public void testMatch() throws Exception {
    SupportStreamImpl stream = new SupportStreamImpl(TEST_CLASS, 10);
    List<ViewFactory> viewFactories = SupportViewSpecFactory.makeFactoryListOne(stream.getEventType());
    AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.makeAgentInstanceContext();

    // No views under stream, no matches
    Pair<Viewable, List<View>> result = ViewServiceHelper.matchExistingViews(stream, viewFactories, agentInstanceContext);
    assertEquals(stream, result.getFirst());
    assertEquals(3, viewFactories.size());
    assertEquals(0, result.getSecond().size());

    // One top view under the stream that doesn't match
    SupportBeanClassView testView = new SupportBeanClassView(TEST_CLASS);
    stream.addView(new FirstElementView(null));
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories, agentInstanceContext);

    assertEquals(stream, result.getFirst());
    assertEquals(3, viewFactories.size());
    assertEquals(0, result.getSecond().size());

    // Another top view under the stream that doesn't matche again
    testView = new SupportBeanClassView(TEST_CLASS);
    stream.addView(new LengthWindowView(SupportStatementContextFactory.makeAgentInstanceViewFactoryContext(), null, 999, null));
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories, agentInstanceContext);

    assertEquals(stream, result.getFirst());
    assertEquals(3, viewFactories.size());
    assertEquals(0, result.getSecond().size());

    // One top view under the stream that does actually match
    LengthWindowView myLengthWindowView = new LengthWindowView(SupportStatementContextFactory.makeAgentInstanceViewFactoryContext(), null, 1000, null);
    stream.addView(myLengthWindowView);
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories, agentInstanceContext);

    assertEquals(myLengthWindowView, result.getFirst());
    assertEquals(2, viewFactories.size());
    assertEquals(1, result.getSecond().size());
    assertEquals(myLengthWindowView, result.getSecond().get(0));

    // One child view under the top view that does not match
    testView = new SupportBeanClassView(TEST_CLASS);
    viewFactories = SupportViewSpecFactory.makeFactoryListOne(stream.getEventType());
    EventType type = UnivariateStatisticsView.createEventType(SupportStatementContextFactory.makeContext(), null, 1);
    UnivariateStatisticsViewFactory factory = new UnivariateStatisticsViewFactory();
    factory.setEventType(type);
    factory.setFieldExpression(SupportExprNodeFactory.makeIdentNodeBean("longBoxed"));
    myLengthWindowView.addView(new UnivariateStatisticsView(factory, SupportStatementContextFactory.makeAgentInstanceViewFactoryContext()));
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories, agentInstanceContext);
    assertEquals(1, result.getSecond().size());
    assertEquals(myLengthWindowView, result.getSecond().get(0));
    assertEquals(myLengthWindowView, result.getFirst());
    assertEquals(2, viewFactories.size());

    // Add child view under the top view that does match
    viewFactories = SupportViewSpecFactory.makeFactoryListOne(stream.getEventType());
    UnivariateStatisticsViewFactory factoryTwo = new UnivariateStatisticsViewFactory();
    factoryTwo.setEventType(type);
    factoryTwo.setFieldExpression(SupportExprNodeFactory.makeIdentNodeBean("intPrimitive"));
    UnivariateStatisticsView myUnivarView = new UnivariateStatisticsView(factoryTwo, SupportStatementContextFactory.makeAgentInstanceViewFactoryContext());
    myLengthWindowView.addView(myUnivarView);
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories, agentInstanceContext);

    assertEquals(myUnivarView, result.getFirst());
    assertEquals(1, viewFactories.size());

    // Add ultimate child view under the child view that does match
    viewFactories = SupportViewSpecFactory.makeFactoryListOne(stream.getEventType());
    LastElementView lastElementView = new LastElementView(null);
    myUnivarView.addView(lastElementView);
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories, agentInstanceContext);

    assertEquals(lastElementView, result.getFirst());
    assertEquals(0, viewFactories.size());
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:75,代码来源:TestViewServiceHelper.java

示例4: testMatch

import com.espertech.esper.view.std.LastElementView; //导入依赖的package包/类
public void testMatch() throws Exception
{
    SupportStreamImpl stream = new SupportStreamImpl(TEST_CLASS, 10);
    List<ViewFactory> viewFactories = SupportViewSpecFactory.makeFactoryListOne(stream.getEventType());

    // No views under stream, no matches
    Pair<Viewable, List<View>> result = ViewServiceHelper.matchExistingViews(stream, viewFactories);
    assertEquals(stream, result.getFirst());
    assertEquals(3, viewFactories.size());
    assertEquals(0, result.getSecond().size());

    // One top view under the stream that doesn't match
    SupportBeanClassView testView = new SupportBeanClassView(TEST_CLASS);
    stream.addView(new FirstElementView());
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories);

    assertEquals(stream, result.getFirst());
    assertEquals(3, viewFactories.size());
    assertEquals(0, result.getSecond().size());

    // Another top view under the stream that doesn't matche again
    testView = new SupportBeanClassView(TEST_CLASS);
    stream.addView(new LengthWindowView(SupportStatementContextFactory.makeAgentInstanceViewFactoryContext(), null, 999, null));
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories);

    assertEquals(stream, result.getFirst());
    assertEquals(3, viewFactories.size());
    assertEquals(0, result.getSecond().size());

    // One top view under the stream that does actually match
    LengthWindowView myLengthWindowView = new LengthWindowView(SupportStatementContextFactory.makeAgentInstanceViewFactoryContext(), null, 1000, null);
    stream.addView(myLengthWindowView);
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories);

    assertEquals(myLengthWindowView, result.getFirst());
    assertEquals(2, viewFactories.size());
    assertEquals(1, result.getSecond().size());
    assertEquals(myLengthWindowView, result.getSecond().get(0));

    // One child view under the top view that does not match
    testView = new SupportBeanClassView(TEST_CLASS);
    viewFactories = SupportViewSpecFactory.makeFactoryListOne(stream.getEventType());
    EventType type = UnivariateStatisticsView.createEventType(SupportStatementContextFactory.makeContext(), null, 1);
    myLengthWindowView.addView(new UnivariateStatisticsView(SupportStatementContextFactory.makeAgentInstanceContext(), SupportExprNodeFactory.makeIdentNodeBean("longBoxed"), type, null));
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories);
    assertEquals(1, result.getSecond().size());
    assertEquals(myLengthWindowView, result.getSecond().get(0));
    assertEquals(myLengthWindowView, result.getFirst());
    assertEquals(2, viewFactories.size());

    // Add child view under the top view that does match
    viewFactories = SupportViewSpecFactory.makeFactoryListOne(stream.getEventType());
    UnivariateStatisticsView myUnivarView = new UnivariateStatisticsView(SupportStatementContextFactory.makeAgentInstanceContext(), SupportExprNodeFactory.makeIdentNodeBean("intPrimitive"), type, null);
    myLengthWindowView.addView(myUnivarView);
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories);

    assertEquals(myUnivarView, result.getFirst());
    assertEquals(1, viewFactories.size());

    // Add ultimate child view under the child view that does match
    viewFactories = SupportViewSpecFactory.makeFactoryListOne(stream.getEventType());
    LastElementView lastElementView = new LastElementView();
    myUnivarView.addView(lastElementView);
    result = ViewServiceHelper.matchExistingViews(stream, viewFactories);

    assertEquals(lastElementView, result.getFirst());
    assertEquals(0, viewFactories.size());
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:69,代码来源:TestViewServiceHelper.java


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