本文整理汇总了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;
}
}
示例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);
}
}
示例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>();
}
}
}
示例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]);
}
示例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]);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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]);
}
示例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]);
}
示例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);
}
示例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);
}