當前位置: 首頁>>代碼示例>>Java>>正文


Java Node類代碼示例

本文整理匯總了Java中com.espertech.esper.epl.join.rep.Node的典型用法代碼示例。如果您正苦於以下問題:Java Node類的具體用法?Java Node怎麽用?Java Node使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Node類屬於com.espertech.esper.epl.join.rep包,在下文中一共展示了Node類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
public void init(List<Node>[] result) {
    if (subStreamsNumsPerChild == null) {
        if (childNodes.size() < 2) {
            throw new IllegalStateException("Expecting at least 2 child nodes");
        }
        subStreamsNumsPerChild = new int[childNodes.size()][];
        for (int i = 0; i < childNodes.size(); i++) {
            subStreamsNumsPerChild[i] = childNodes.get(i).getSubstreams();
        }

        combinedSubStreams = computeCombined(subStreamsNumsPerChild);
    }

    haveChildResults = false;
    for (int i = 0; i < rowsPerStream.length; i++) {
        rowsPerStream[i] = null;
    }
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:19,代碼來源:RootCartProdAssemblyNode.java

示例2: postCartesian

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
private void postCartesian(List<EventBean[]>[] rowsPerStream, Node node, Collection<EventBean[]> resultFinalRows, EventBean resultRootEvent) {
    List<EventBean[]> result = new LinkedList<EventBean[]>();
    CartesianUtil.computeCartesian(
            rowsPerStream[0], subStreamsNumsPerChild[0],
            rowsPerStream[1], subStreamsNumsPerChild[1],
            result);

    if (rowsPerStream.length > 2) {
        for (int i = 0; i < subStreamsNumsPerChild.length - 2; i++) {
            List<EventBean[]> product = new LinkedList<EventBean[]>();
            CartesianUtil.computeCartesian(
                    result, combinedSubStreams[i],
                    rowsPerStream[i + 2], subStreamsNumsPerChild[i + 2],
                    product);
            result = product;
        }
    }

    for (EventBean[] row : result) {
        parentNode.result(row, streamNum, node.getParentEvent(), node.getParent(), resultFinalRows, resultRootEvent);
    }
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:23,代碼來源:CartesianProdAssemblyNode.java

示例3: init

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
public void init(List<Node>[] result) {
    resultsForStream = result[streamNum];
    singleResultNode = null;
    singleResultEvent = null;
    haveChildResults = false;

    if (resultsForStream != null) {
        int numNodes = resultsForStream.size();
        if (numNodes == 1) {
            Node node = resultsForStream.get(0);
            Set<EventBean> nodeEvents = node.getEvents();

            // If there is a single result event (typical case)
            if (nodeEvents.size() == 1) {
                singleResultNode = node;
                singleResultEvent = nodeEvents.iterator().next();
            }
        }

        if (singleResultNode == null) {
            completedEvents = new HashSet<EventBean>();
        }
    }
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:25,代碼來源:BranchOptionalAssemblyNode.java

示例4: testProcessMultipleEvents

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
public void testProcessMultipleEvents() {
    List<EventBean[]> resultFinalRows = new ArrayList<EventBean[]>();
    optAssemblyNode.init(resultMultipleEvents);

    // generate an event row originating from a child for 1 of the 2 events in the result
    EventBean[] childRow = new EventBean[4];
    Node nodeOne = resultMultipleEvents[1].get(0);
    EventBean eventOne = nodeOne.getEvents().iterator().next();
    optAssemblyNode.result(childRow, 3, eventOne, nodeOne, resultFinalRows, null);

    // test that the node indeed manufactures event rows for any event not received from a child
    parentNode.getRowsList().clear();
    optAssemblyNode.process(resultMultipleEvents, resultFinalRows, null);

    // check generated row
    assertEquals(1, parentNode.getRowsList().size());
    EventBean[] row = parentNode.getRowsList().get(0);
    assertEquals(4, row.length);
    Node nodeTwo = resultMultipleEvents[1].get(1);
    assertEquals(nodeTwo.getEvents().iterator().next(), row[1]);
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:22,代碼來源:TestSingleOptionalAssemblyNode.java

示例5: testChildResult

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
protected static void testChildResult(BaseAssemblyNode nodeUnderTest, SupportJoinProcNode mockParentNode) {
    EventBean[] childRow = new EventBean[4];
    childRow[3] = SupportJoinResultNodeFactory.makeEvent();

    EventBean myEvent = SupportJoinResultNodeFactory.makeEvent();
    Node myNode = SupportJoinResultNodeFactory.makeNode(3, 1);

    // indicate child result
    List<EventBean[]> resultFinalRows = new ArrayList<EventBean[]>();
    nodeUnderTest.result(childRow, 3, myEvent, myNode, resultFinalRows, null);

    // assert parent node got the row
    assertEquals(1, mockParentNode.getRowsList().size());
    EventBean[] resultRow = mockParentNode.getRowsList().get(0);

    // assert the node has added his event to the row
    assertEquals(myEvent, resultRow[1]);
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:19,代碼來源:TestSingleOptionalAssemblyNode.java

示例6: recursiveFill

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
private void recursiveFill(EventBean[] lookupEventsPerStream, Node node)
{
    if (node == null)
    {
        return;
    }

    Node parent = node.getParent();
    if (parent == null)
    {
        lookupEventsPerStream[rootStreamNum] = node.getParentEvent();
        return;
    }

    lookupEventsPerStream[parent.getStream()] = node.getParentEvent();
    recursiveFill(lookupEventsPerStream, parent);
}
 
開發者ID:mobile-event-processing,項目名稱:Asper,代碼行數:18,代碼來源:HistoricalTableLookupStrategy.java

示例7: init

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
public void init(List<Node>[] result)
{
    if (subStreamsNumsPerChild == null)
    {
        if (childNodes.size() < 2)
        {
            throw new IllegalStateException("Expecting at least 2 child nodes");
        }
        subStreamsNumsPerChild = new int[childNodes.size()][];
        for (int i = 0; i < childNodes.size(); i++)
        {
            subStreamsNumsPerChild[i] = childNodes.get(i).getSubstreams();
        }

        combinedSubStreams = computeCombined(subStreamsNumsPerChild);
    }

    haveChildResults = false;
    for (int i = 0; i < rowsPerStream.length; i++)
    {
        rowsPerStream[i] = null;
    }
}
 
開發者ID:mobile-event-processing,項目名稱:Asper,代碼行數:24,代碼來源:RootCartProdAssemblyNode.java

示例8: result

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
public void result(EventBean[] row, int fromStreamNum, EventBean myEvent, Node myNode, Collection<EventBean[]> resultFinalRows, EventBean resultRootEvent)
{
    haveChildResults = true;

    // fill event in
    row[streamNum] = myEvent;
    int childStreamArrIndex = childStreamIndex[fromStreamNum];

    // keep a reference to the row to build a cartesian product on the call to process
    List<EventBean[]> rows = rowsPerStream[childStreamArrIndex];
    if (rows == null)
    {
        rows = new LinkedList<EventBean[]>();
        rowsPerStream[childStreamArrIndex] = rows;
    }
    rows.add(row);
}
 
開發者ID:mobile-event-processing,項目名稱:Asper,代碼行數:18,代碼來源:RootCartProdAssemblyNode.java

示例9: process

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
public void process(List<Node>[] result, Collection<EventBean[]> resultFinalRows, EventBean resultRootEvent)
{
    List<Node> nodes = result[streamNum];
    if (nodes == null)
    {
        return;
    }

    for (Node node : nodes)
    {
        Set<EventBean> events = node.getEvents();
        for (EventBean theEvent : events)
        {
            processEvent(theEvent, node, resultFinalRows, resultRootEvent);
        }
    }
}
 
開發者ID:mobile-event-processing,項目名稱:Asper,代碼行數:18,代碼來源:LeafAssemblyNode.java

示例10: postCartesian

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
private void postCartesian(List<EventBean[]>[] rowsPerStream, Node node, Collection<EventBean[]> resultFinalRows, EventBean resultRootEvent)
{
    List<EventBean[]> result = new LinkedList<EventBean[]>();
    CartesianUtil.computeCartesian(
            rowsPerStream[0], subStreamsNumsPerChild[0],
            rowsPerStream[1], subStreamsNumsPerChild[1],
            result);

    if (rowsPerStream.length > 2)
    {
        for (int i = 0; i < subStreamsNumsPerChild.length - 2; i++)
        {
            List<EventBean[]> product = new LinkedList<EventBean[]>();
            CartesianUtil.computeCartesian(
                    result, combinedSubStreams[i],
                    rowsPerStream[i + 2], subStreamsNumsPerChild[i + 2],
                    product);
            result = product;
        }
    }

    for (EventBean[] row : result)
    {
        parentNode.result(row, streamNum, node.getParentEvent(), node.getParent(), resultFinalRows, resultRootEvent);
    }
}
 
開發者ID:mobile-event-processing,項目名稱:Asper,代碼行數:27,代碼來源:CartesianProdAssemblyNode.java

示例11: result

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
public void result(EventBean[] row, int fromStreamNum, EventBean myEvent, Node myNode, Collection<EventBean[]> resultFinalRows, EventBean resultRootEvent)
{
    row[streamNum] = myEvent;
    Node parentResultNode = myNode.getParent();
    parentNode.result(row, streamNum, myNode.getParentEvent(), parentResultNode, resultFinalRows, resultRootEvent);

    // record the fact that an event that was generated by a child
    haveChildResults = true;

    // If we had more then on result event for this stream, we need to track all the different events
    // generated by the child node
    if (singleResultNode == null)
    {
        completedEvents.add(myEvent);
    }
}
 
開發者ID:mobile-event-processing,項目名稱:Asper,代碼行數:17,代碼來源:BranchOptionalAssemblyNode.java

示例12: testProcessMultipleEvents

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
public void testProcessMultipleEvents()
{
    List<EventBean[]> resultFinalRows = new ArrayList<EventBean[]>();
    optAssemblyNode.init(resultMultipleEvents);

    // generate an event row originating from a child for 1 of the 2 events in the result
    EventBean[] childRow = new EventBean[4];
    Node nodeOne = resultMultipleEvents[1].get(0);
    EventBean eventOne = nodeOne.getEvents().iterator().next();
    optAssemblyNode.result(childRow, 3, eventOne, nodeOne, resultFinalRows, null);

    // test that the node indeed manufactures event rows for any event not received from a child
    parentNode.getRowsList().clear();
    optAssemblyNode.process(resultMultipleEvents, resultFinalRows, null);

    // check generated row
    assertEquals(1, parentNode.getRowsList().size());
    EventBean[] row = parentNode.getRowsList().get(0);
    assertEquals(4, row.length);
    Node nodeTwo = resultMultipleEvents[1].get(1);
    assertEquals(nodeTwo.getEvents().iterator().next(), row[1]);
}
 
開發者ID:mobile-event-processing,項目名稱:Asper,代碼行數:23,代碼來源:TestSingleOptionalAssemblyNode.java

示例13: testChildResult

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
protected static void testChildResult(BaseAssemblyNode nodeUnderTest, SupportJoinProcNode mockParentNode)
{
    EventBean[] childRow = new EventBean[4];
    childRow[3] = SupportJoinResultNodeFactory.makeEvent();

    EventBean myEvent = SupportJoinResultNodeFactory.makeEvent();
    Node myNode = SupportJoinResultNodeFactory.makeNode(3, 1);

    // indicate child result
    List<EventBean[]> resultFinalRows = new ArrayList<EventBean[]>();
    nodeUnderTest.result(childRow, 3, myEvent, myNode, resultFinalRows, null);

    // assert parent node got the row
    assertEquals(1, mockParentNode.getRowsList().size());
    EventBean[] resultRow = mockParentNode.getRowsList().get(0);

    // assert the node has added his event to the row
    assertEquals(myEvent, resultRow[1]);
}
 
開發者ID:mobile-event-processing,項目名稱:Asper,代碼行數:20,代碼來源:TestSingleOptionalAssemblyNode.java

示例14: recursiveFill

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
private void recursiveFill(EventBean[] lookupEventsPerStream, Node node) {
    if (node == null) {
        return;
    }

    Node parent = node.getParent();
    if (parent == null) {
        lookupEventsPerStream[rootStreamNum] = node.getParentEvent();
        return;
    }

    lookupEventsPerStream[parent.getStream()] = node.getParentEvent();
    recursiveFill(lookupEventsPerStream, parent);
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:15,代碼來源:HistoricalTableLookupStrategy.java

示例15: process

import com.espertech.esper.epl.join.rep.Node; //導入依賴的package包/類
public void process(List<Node>[] result, Collection<EventBean[]> resultFinalRows, EventBean resultRootEvent) {
    // If no child has posted any rows, generate row and done
    if ((!haveChildResults) && allSubStreamsOptional) {
        // post an empty row
        EventBean[] row = new EventBean[numStreams];
        parentNode.result(row, streamNum, null, null, resultFinalRows, resultRootEvent);
        return;
    }

    // Compute the cartesian product
    postCartesian(rowsPerStream, resultFinalRows, resultRootEvent);
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:13,代碼來源:RootCartProdAssemblyNode.java


注:本文中的com.espertech.esper.epl.join.rep.Node類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。