com.espertech.esper.view.std.UniqueByPropertyView Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esper Show documentation
Show all versions of esper Show documentation
Complex event processing and event series analysis component
/*
***************************************************************************************
* Copyright (C) 2006 EsperTech, Inc. All rights reserved. *
* http://www.espertech.com/esper *
* http://www.espertech.com *
* ---------------------------------------------------------------------------------- *
* The software in this package is published under the terms of the GPL license *
* a copy of which has been included with this distribution in the license.txt file. *
***************************************************************************************
*/
package com.espertech.esper.view.std;
import com.espertech.esper.client.EventBean;
import com.espertech.esper.client.EventType;
import com.espertech.esper.collection.MultiKeyUntyped;
import com.espertech.esper.collection.OneEventCollection;
import com.espertech.esper.core.context.util.AgentInstanceViewFactoryChainContext;
import com.espertech.esper.epl.expression.core.ExprEvaluator;
import com.espertech.esper.epl.expression.core.ExprNode;
import com.espertech.esper.epl.expression.core.ExprNodeUtility;
import com.espertech.esper.metrics.instrumentation.InstrumentationHelper;
import com.espertech.esper.view.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* This view includes only the most recent among events having the same value for the specified field or fields.
* The view accepts the field name as parameter from which the unique values are obtained.
* For example, a trade's symbol could be used as a unique value.
* In this example, the first trade for symbol IBM would be posted as new data to child views.
* When the second trade for symbol IBM arrives the second trade is posted as new data to child views,
* and the first trade is posted as old data.
* Should more than one trades for symbol IBM arrive at the same time (like when batched)
* then the child view will get all new events in newData and all new events in oldData minus the most recent event.
* When the current new event arrives as old data, the the current unique event gets thrown away and
* posted as old data to child views.
* Iteration through the views data shows only the most recent events received for the unique value in the order
* that events arrived in.
* The type of the field returning the unique value can be any type but should override equals and hashCode()
* as the type plays the role of a key in a map storing unique values.
*/
public class UniqueByPropertyView extends ViewSupport implements CloneableView, DataWindowView {
private final UniqueByPropertyViewFactory viewFactory;
protected final ExprEvaluator[] criteriaExpressionsEvals;
protected final Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy