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


Java ExprEvaluator.evaluate方法代码示例

本文整理汇总了Java中com.espertech.esper.epl.expression.ExprEvaluator.evaluate方法的典型用法代码示例。如果您正苦于以下问题:Java ExprEvaluator.evaluate方法的具体用法?Java ExprEvaluator.evaluate怎么用?Java ExprEvaluator.evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.espertech.esper.epl.expression.ExprEvaluator的用法示例。


在下文中一共展示了ExprEvaluator.evaluate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConstant

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
private Object getConstant(AggregationValidationContext validationContext, int index, Class<?> clazz) {

		if (index >= validationContext.getIsConstantValue().length) {
			throw new IllegalArgumentException("only " + validationContext.getIsConstantValue().length + " params have been specified, should be "
					+ (index + 1));
		}

		if (validationContext.getIsConstantValue()[index]) {
			if (validationContext.getParameterTypes()[index].equals(clazz)) {
				return validationContext.getConstantValues()[index];
			} else {
				throw new IllegalArgumentException("param " + index + " has to be a constant of type " + clazz);
			}
		} else {
			ExprEvaluator evaluator = (ExprEvaluator) validationContext.getExpressions()[index];
			Object obj = evaluator.evaluate(null, true, null);
			if (obj.getClass().equals(clazz)) {
				return obj;
			} else {
				throw new IllegalArgumentException("param " + index + " has to be a constant of type " + clazz);
			}
		}
	}
 
开发者ID:curtiszimmerman,项目名称:AlgoTrader,代码行数:24,代码来源:GenericTALibFunction.java

示例2: getMax

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
public int getMax(int position) {
    Integer cached = cachedMaxPerChild[position];
    if (cached != null) {
        return cached;  // constant value cached
    }

    ExprEvaluator cachedExpr = cachedMaxEvaluatorPerChild[position];
    if (cachedExpr == null) {
        return -1;  // no limit defined for this sub-expression
    }

    Number result = (Number) cachedExpr.evaluate(null, true, null);
    if (result != null) {
        return result.intValue();
    }
    return -1;  // no limit
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:18,代码来源:EvalFollowedByFactoryNode.java

示例3: getSelectEventsHaving

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
/**
 * Applies the select-clause to the given events returning the selected events. The number of events stays the
 * same, i.e. this method does not filter it just transforms the result set.
 * <p>
 * Also applies a having clause.
 * @param exprProcessor - processes each input event and returns output event
 * @param orderByProcessor - for sorting output events according to the order-by clause
 * @param events - input events
 * @param optionalHavingNode - supplies the having-clause expression
 * @param isNewData - indicates whether we are dealing with new data (istream) or old data (rstream)
 * @param isSynthesize - set to true to indicate that synthetic events are required for an iterator result set
 * @param result is the result event list to populate
 * @param optSortKeys is the result sort key list to populate, for sorting
 * @param exprEvaluatorContext context for expression evalauation
 */
protected static void getSelectEventsHaving(SelectExprProcessor exprProcessor, OrderByProcessor orderByProcessor, Set<MultiKey<EventBean>> events, ExprEvaluator optionalHavingNode, boolean isNewData, boolean isSynthesize, List<EventBean> result, List<Object> optSortKeys, ExprEvaluatorContext exprEvaluatorContext)
{
    if (events == null)
    {
        return;
    }
    for (MultiKey<EventBean> key : events)
    {
        EventBean[] eventsPerStream = key.getArray();

        Boolean passesHaving = (Boolean) optionalHavingNode.evaluate(eventsPerStream, isNewData, exprEvaluatorContext);
        if ((passesHaving == null) || (!passesHaving))
        {
            continue;
        }

        EventBean resultEvent = exprProcessor.process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext);
        result.add(resultEvent);
        if(orderByProcessor != null)
        {
            optSortKeys.add(orderByProcessor.getSortKey(eventsPerStream, isNewData, exprEvaluatorContext));
        }
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:40,代码来源:ResultSetProcessorSimple.java

示例4: evaluate

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
private boolean evaluate(ExprEvaluator evaluator)
{
    if (builtinProperties != null)
    {
        populateBuiltinProps();
        eventsPerStream[0] = agentInstanceContext.getStatementContext().getEventAdapterService().adapterForTypedMap(builtinProperties, parent.getBuiltinPropertiesEventType());
    }

    boolean result = false;
    Boolean output = (Boolean) evaluator.evaluate(eventsPerStream, true, agentInstanceContext);
    if ((output != null) && (output))
    {
        result = true;
    }

    return result;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:18,代码来源:OutputConditionExpression.java

示例5: generateGroupKey

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
private Object generateGroupKey(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
{
    ExprEvaluator[] evals = factory.getGroupByNodes();
    if (evals.length == 1) {
        return evals[0].evaluate(eventsPerStream, isNewData, exprEvaluatorContext);
    }

    Object[] keys = new Object[evals.length];
    int count = 0;
    for (ExprEvaluator exprNode : evals)
    {
        keys[count] = exprNode.evaluate(eventsPerStream, isNewData, exprEvaluatorContext);
        count++;
    }

    return new MultiKeyUntyped(keys);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:18,代码来源:OrderByProcessorImpl.java

示例6: generateGroupKey

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
/**
 * Generates the group-by key for the row
 * @param eventsPerStream is the row of events
 * @param isNewData is true for new data
 * @return grouping keys
 */
protected Object generateGroupKey(EventBean[] eventsPerStream, boolean isNewData)
{
    if (prototype.getGroupKeyNode() != null) {
        return prototype.getGroupKeyNode().evaluate(eventsPerStream, isNewData, agentInstanceContext);
    }

    Object[] keys = new Object[prototype.getGroupKeyNodes().length];

    int count = 0;
    for (ExprEvaluator exprNode : prototype.getGroupKeyNodes())
    {
        keys[count] = exprNode.evaluate(eventsPerStream, isNewData, agentInstanceContext);
        count++;
    }

    return new MultiKeyUntyped(keys);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:24,代码来源:ResultSetProcessorAggregateGrouped.java

示例7: getCriteriaMultiKey

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
public static MultiKeyUntyped getCriteriaMultiKey(EventBean[] eventsPerStream, ExprEvaluator[] evaluators, ExprEvaluatorContext evalContext)
{
    Object[] result = new Object[evaluators.length];
    int count = 0;
    for(ExprEvaluator expr : evaluators)
    {
        result[count++] = expr.evaluate(eventsPerStream, true, evalContext);
    }
    return new MultiKeyUntyped(result);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:11,代码来源:RankWindowView.java

示例8: getSortValues

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
protected Object getSortValues(EventBean theEvent)
{
    eventsPerStream[0] = theEvent;
    if (sortCriteriaExpressions.length == 1) {
        return sortCriteriaEvaluators[0].evaluate(eventsPerStream, true, agentInstanceViewFactoryContext);
    }

	Object[] result = new Object[sortCriteriaExpressions.length];
	int count = 0;
	for(ExprEvaluator expr : sortCriteriaEvaluators)
	{
        result[count++] = expr.evaluate(eventsPerStream, true, agentInstanceViewFactoryContext);
	}
	return new MultiKeyUntyped(result);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:16,代码来源:SortWindowView.java

示例9: getKeys

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
private Object getKeys(EventBean theEvent)
{
    eventsPerStream[0] = theEvent;
    if (partitionExpressions.length == 1) {
        return partitionExpressions[0].evaluate(eventsPerStream, true, exprEvaluatorContext);
    }

    Object[] keys = new Object[partitionExpressions.length];
    int count = 0;
    for (ExprEvaluator node : partitionExpressions)
    {
        keys[count++] = node.evaluate(eventsPerStream, true, exprEvaluatorContext);
    }
    return new MultiKeyUntyped(keys);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:16,代码来源:RegexPartitionStateRepoGroup.java

示例10: getNext

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
private void getNext()
{
    if ((filterList == null) || (filterList.length == 0))
    {
        if (parent.hasNext())
        {
            next = parent.next();
        }
        else
        {
            next = null;
        }
        return;
    }

    while(parent.hasNext())
    {
        next = parent.next();

        eventPerStream[0] = next;
        boolean pass = true;
        for (ExprEvaluator filter : filterList)
        {
            Boolean result = (Boolean) filter.evaluate(eventPerStream, true, exprEvaluatorContext);
            if (result == null || !result)
            {
                pass = false;
                break;
            }
        }

        if (pass)
        {
            return;
        }
    }

    next = null;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:40,代码来源:FilteredEventIterator.java

示例11: filter

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
/**
 * Filter event by applying the filter nodes evaluation method.
 * @param filterExprNode - top node of the filter expression tree.
 * @param events - set of tuples of events
 * @param isNewData - true to indicate filter new data (istream) and not old data (rstream)
 * @param exprEvaluatorContext expression evaluation context
 */
protected static void filter(ExprEvaluator filterExprNode, Set<MultiKey<EventBean>> events, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
{
    for (Iterator<MultiKey<EventBean>> it = events.iterator(); it.hasNext();)
    {
        MultiKey<EventBean> key = it.next();
        EventBean[] eventArr = key.getArray();

        Boolean matched = (Boolean) filterExprNode.evaluate(eventArr, isNewData, exprEvaluatorContext);
        if ((matched == null) || (!matched))
        {
            it.remove();
        }
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:22,代码来源:JoinSetFilter.java

示例12: getInt

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
protected static Integer getInt(ExprEvaluator expr, EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext context) {
    Object result = expr.evaluate(eventsPerStream, isNewData, context);
    if (result == null) {
        return null;
    }
    return (Integer) result;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:8,代码来源:CalendarOpWithDate.java

示例13: process

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
public EventBean process(EventBean[] eventsPerStream, boolean isNewData, boolean isSynthesize, ExprEvaluatorContext exprEvaluatorContext)
{
    // Evaluate all expressions and build a map of name-value pairs
    Map<String, Object> props = new HashMap<String, Object>();
    int count = 0;
    for (ExprEvaluator expressionNode : selectExprContext.getExpressionNodes())
    {
        Object evalResult = expressionNode.evaluate(eventsPerStream, isNewData, exprEvaluatorContext);
        props.put(selectExprContext.getColumnNames()[count], evalResult);
        count++;
    }
    for (SelectClauseStreamCompiledSpec element : namedStreams)
    {
        EventBean theEvent = eventsPerStream[element.getStreamNumber()];
        props.put(selectExprContext.getColumnNames()[count], theEvent);
        count++;
    }
    if (isUsingWildcard && eventsPerStream.length > 1)
    {
        for (EventBean anEventsPerStream : eventsPerStream)
        {
            props.put(selectExprContext.getColumnNames()[count], anEventsPerStream);
            count++;
        }
    }

    return processSpecific(props, eventsPerStream, exprEvaluatorContext);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:29,代码来源:EvalSelectStreamBaseMap.java

示例14: process

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
public EventBean process(EventBean[] eventsPerStream, boolean isNewData, boolean isSynthesize, ExprEvaluatorContext exprEvaluatorContext)
{
    // Evaluate all expressions and build a map of name-value pairs
    int size = (isUsingWildcard && eventsPerStream.length > 1) ? eventsPerStream.length : 0;
    size += selectExprContext.getExpressionNodes().length + namedStreams.size();
    Object[] props = new Object[size];
    int count = 0;
    for (ExprEvaluator expressionNode : selectExprContext.getExpressionNodes())
    {
        Object evalResult = expressionNode.evaluate(eventsPerStream, isNewData, exprEvaluatorContext);
        props[count] = evalResult;
        count++;
    }
    for (SelectClauseStreamCompiledSpec element : namedStreams)
    {
        EventBean theEvent = eventsPerStream[element.getStreamNumber()];
        props[count] = theEvent;
        count++;
    }
    if (isUsingWildcard && eventsPerStream.length > 1)
    {
        for (EventBean anEventsPerStream : eventsPerStream)
        {
            props[count] = anEventsPerStream;
            count++;
        }
    }

    return processSpecific(props, eventsPerStream, exprEvaluatorContext);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:31,代码来源:EvalSelectStreamBaseObjectArray.java

示例15: filterEvents

import com.espertech.esper.epl.expression.ExprEvaluator; //导入方法依赖的package包/类
/**
 * Filters events using the supplied evaluator.
 * @param exprEvaluator - evaluator to use
 * @param events - events to filter
 * @param isNewData - true to indicate filter new data (istream) and not old data (rstream)
 * @param exprEvaluatorContext context for expression evalauation
 * @return filtered events, or null if no events got through the filter
 */
protected static EventBean[] filterEvents(ExprEvaluator exprEvaluator, EventBean[] events, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
{
    if (events == null)
    {
        return null;
    }

    EventBean[] evalEventArr = new EventBean[1];
    boolean passResult[] = new boolean[events.length];
    int passCount = 0;

    for (int i = 0; i < events.length; i++)
    {
        evalEventArr[0] = events[i];
        Boolean pass = (Boolean) exprEvaluator.evaluate(evalEventArr, isNewData, exprEvaluatorContext);
        if ((pass != null) && (pass))
        {
            passResult[i] = true;
            passCount++;
        }
    }

    if (passCount == 0)
    {
        return null;
    }
    if (passCount == events.length)
    {
        return events;
    }

    EventBean[] resultArray = new EventBean[passCount];
    int count = 0;
    for (int i = 0; i < passResult.length; i++)
    {
        if (passResult[i])
        {
            resultArray[count] = events[i];
            count++;
        }
    }
    return resultArray;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:52,代码来源:FilterExprView.java


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