當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。