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


Java ExprEvaluator类代码示例

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


ExprEvaluator类属于com.espertech.esper.epl.expression包,在下文中一共展示了ExprEvaluator类的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: CompositeIndexQueryKeyed

import com.espertech.esper.epl.expression.ExprEvaluator; //导入依赖的package包/类
public CompositeIndexQueryKeyed(boolean isNWOnTrigger, int lookupStream, int numStreams, List<QueryGraphValueEntryHashKeyed> hashKeys, Class[] keyCoercionTypes) {
    this.keyCoercionTypes  = keyCoercionTypes;
    this.evaluators = new ExprEvaluator[hashKeys.size()];
    this.isNWOnTrigger = isNWOnTrigger;
    this.lookupStream = lookupStream;

    for (int i = 0; i < evaluators.length; i++) {
        evaluators[i] = hashKeys.get(i).getKeyExpr().getExprEvaluator();
    }
    if (lookupStream != -1) {
        events = new EventBean[lookupStream + 1];
    }
    else {
        events = new EventBean[numStreams + 1];
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:17,代码来源:CompositeIndexQueryKeyed.java

示例4: ExternallyTimedBatchView

import com.espertech.esper.epl.expression.ExprEvaluator; //导入依赖的package包/类
/**
 * Constructor.
 * @param timestampExpression is the field name containing a long timestamp value
 * that should be in ascending order for the natural order of events and is intended to reflect
 * System.currentTimeInMillis but does not necessarily have to.
 * @param msecBeforeExpiry is the number of milliseconds before events gets pushed
 * out of the window as oldData in the update method. The view compares
 * each events timestamp against the newest event timestamp and those with a delta
 * greater then secondsBeforeExpiry are pushed out of the window.
 * @param viewUpdatedCollection is a collection that the view must update when receiving events
 * @param factory for copying this view in a group-by
 * @param agentInstanceViewFactoryContext context for expression evalauation
 */
public ExternallyTimedBatchView(ExternallyTimedBatchViewFactory factory,
                                ExprNode timestampExpression,
                                ExprEvaluator timestampExpressionEval,
                                long msecBeforeExpiry,
                                Long optionalReferencePoint,
                                ViewUpdatedCollection viewUpdatedCollection,
                                AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
{
    this.factory = factory;
    this.timestampExpression = timestampExpression;
    this.timestampExpressionEval = timestampExpressionEval;
    this.millisecondsBeforeExpiry = msecBeforeExpiry;
    this.viewUpdatedCollection = viewUpdatedCollection;
    this.agentInstanceViewFactoryContext = agentInstanceViewFactoryContext;
    this.referenceTimestamp = optionalReferencePoint;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:30,代码来源:ExternallyTimedBatchView.java

示例5: SortWindowView

import com.espertech.esper.epl.expression.ExprEvaluator; //导入依赖的package包/类
/**
 * Ctor.
 * @param sortCriteriaExpressions is the event property names to sort
 * @param descendingValues indicates whether to sort ascending or descending for each field
 * @param sortWindowSize is the window size
 * @param optionalSortedRandomAccess is the friend class handling the random access, if required by
 * expressions
 * @param sortWindowViewFactory for copying this view in a group-by
 * @param isSortUsingCollator for string value sorting using compare or Collator
 */
public SortWindowView(SortWindowViewFactory sortWindowViewFactory,
                      ExprNode[] sortCriteriaExpressions,
                      ExprEvaluator[] sortCriteriaEvaluators,
                      boolean[] descendingValues,
                      int sortWindowSize,
                      IStreamSortRankRandomAccess optionalSortedRandomAccess,
                      boolean isSortUsingCollator,
                      AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
{
    this.sortWindowViewFactory = sortWindowViewFactory;
    this.sortCriteriaExpressions = sortCriteriaExpressions;
    this.sortCriteriaEvaluators = sortCriteriaEvaluators;
    this.isDescendingValues = descendingValues;
    this.sortWindowSize = sortWindowSize;
    this.optionalSortedRandomAccess = optionalSortedRandomAccess;
    this.agentInstanceViewFactoryContext = agentInstanceViewFactoryContext;

    Comparator<Object> comparator = RankWindowView.getComparator(sortCriteriaEvaluators, isSortUsingCollator, isDescendingValues);
    sortedEvents = new TreeMap<Object, Object>(comparator);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:31,代码来源:SortWindowView.java

示例6: EvalSelectStreamWUnderlying

import com.espertech.esper.epl.expression.ExprEvaluator; //导入依赖的package包/类
public EvalSelectStreamWUnderlying(SelectExprContext selectExprContext,
                                   EventType resultEventType,
                                   List<SelectClauseStreamCompiledSpec> namedStreams,
                                   boolean usingWildcard,
                                   List<SelectExprStreamDesc> unnamedStreams,
                                   boolean singleStreamWrapper,
                                   boolean underlyingIsFragmentEvent,
                                   int underlyingStreamNumber,
                                   EventPropertyGetter underlyingPropertyEventGetter,
                                   ExprEvaluator underlyingExprEvaluator) {
    super(selectExprContext, resultEventType, namedStreams, usingWildcard);
    this.unnamedStreams = unnamedStreams;
    this.singleStreamWrapper = singleStreamWrapper;
    this.underlyingIsFragmentEvent = underlyingIsFragmentEvent;
    this.underlyingStreamNumber = underlyingStreamNumber;
    this.underlyingPropertyEventGetter = underlyingPropertyEventGetter;
    this.underlyingExprEvaluator = underlyingExprEvaluator;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:19,代码来源:EvalSelectStreamWUnderlying.java

示例7: getMultiKey

import com.espertech.esper.epl.expression.ExprEvaluator; //导入依赖的package包/类
public static MultiKeyUntyped getMultiKey(EventBean[] eventsPerStream, ExprEvaluator[] evaluators, ExprEvaluatorContext context, Class[] coercionTypes) {
    Object[] keyValues = getPropertyArray(eventsPerStream, evaluators, context);
    if (coercionTypes == null) {
        return new MultiKeyUntyped(keyValues);
    }
    for (int i = 0; i < coercionTypes.length; i++)
    {
        Object key = keyValues[i];
        if ((key != null) && (!key.getClass().equals(coercionTypes[i])))
        {
            if (key instanceof Number)
            {
                key = JavaClassHelper.coerceBoxed((Number) key, coercionTypes[i]);
                keyValues[i] = key;
            }
        }
    }
    return new MultiKeyUntyped(keyValues);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:20,代码来源:EventBeanUtility.java

示例8: CompositeAccessStrategyRangeBase

import com.espertech.esper.epl.expression.ExprEvaluator; //导入依赖的package包/类
protected CompositeAccessStrategyRangeBase(boolean isNWOnTrigger, int lookupStream, int numStreams, ExprEvaluator start, boolean includeStart, ExprEvaluator end, boolean includeEnd, Class coercionType) {
    this.start = start;
    this.includeStart = includeStart;
    this.end = end;
    this.includeEnd = includeEnd;
    this.coercionType = coercionType;
    this.isNWOnTrigger = isNWOnTrigger;

    if (lookupStream != -1) {
        events = new EventBean[lookupStream + 1];
    }
    else {
        events = new EventBean[numStreams + 1];
    }
    this.lookupStream = lookupStream;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:17,代码来源:CompositeAccessStrategyRangeBase.java

示例9: setUp

import com.espertech.esper.epl.expression.ExprEvaluator; //导入依赖的package包/类
public void setUp() throws Exception
{
    agentInstanceContext = SupportStatementContextFactory.makeAgentInstanceContext();

    SelectExprEventTypeRegistry selectExprEventTypeRegistry = new SelectExprEventTypeRegistry(new HashSet<String>());
    SelectExprProcessorHelper factory = new SelectExprProcessorHelper(Collections.<Integer>emptyList(), SupportSelectExprFactory.makeSelectListFromIdent("theString", "s0"),
    		Collections.<SelectExprStreamDesc>emptyList(), null, false, new SupportStreamTypeSvc1Stream(), SupportEventAdapterService.getService(), null, selectExprEventTypeRegistry, null, null, null, new Configuration());
    SelectExprProcessor selectProcessor = factory.getEvaluator();
    supportAggregationService = new SupportAggregationService();

    ExprEvaluator[] groupKeyNodes = new ExprEvaluator[2];
    groupKeyNodes[0] = SupportExprNodeFactory.makeIdentNode("intPrimitive", "s0").getExprEvaluator();
    groupKeyNodes[1] = SupportExprNodeFactory.makeIdentNode("intBoxed", "s0").getExprEvaluator();

    ResultSetProcessorRowPerGroupFactory prototype = new ResultSetProcessorRowPerGroupFactory(selectProcessor, groupKeyNodes, null, true, false, null, false, false);
    processor = (ResultSetProcessorRowPerGroup) prototype.instantiate(null, supportAggregationService, agentInstanceContext);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:18,代码来源:TestResultSetProcessorRowPerGroup.java

示例10: process

import com.espertech.esper.epl.expression.ExprEvaluator; //导入依赖的package包/类
public EventBean process(EventBean[] eventsPerStream, boolean isNewData, boolean isSynthesize, ExprEvaluatorContext exprEvaluatorContext)
{
    ExprEvaluator[] expressionNodes = selectExprContext.getExpressionNodes();
    String[] columnNames = selectExprContext.getColumnNames();

    // Evaluate all expressions and build a map of name-value pairs
    Map<String, Object> props;
    if (expressionNodes.length == 0)
    {
        props = Collections.EMPTY_MAP;
    }
    else
    {
        props = new HashMap<String, Object>();
        for (int i = 0; i < expressionNodes.length; i++)
        {
            Object evalResult = expressionNodes[i].evaluate(eventsPerStream, isNewData, exprEvaluatorContext);
            props.put(columnNames[i], evalResult);
        }
    }

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

示例11: ExpressionWindowView

import com.espertech.esper.epl.expression.ExprEvaluator; //导入依赖的package包/类
/**
 * Constructor creates a moving window extending the specified number of elements into the past.
 * @param dataWindowViewFactory for copying this view in a group-by
 * @param viewUpdatedCollection is a collection that the view must update when receiving events
 * @param variableNames variable names
 */
public ExpressionWindowView(ExpressionWindowViewFactory dataWindowViewFactory,
                            ViewUpdatedCollection viewUpdatedCollection,
                            ExprEvaluator expiryExpression,
                            AggregationServiceFactoryDesc aggregationServiceFactoryDesc,
                            MapEventBean builtinEventProps,
                            Set<String> variableNames,
                            AgentInstanceViewFactoryChainContext agentInstanceContext)
{
    super(viewUpdatedCollection, expiryExpression, aggregationServiceFactoryDesc, builtinEventProps, variableNames, agentInstanceContext);
    this.dataWindowViewFactory = dataWindowViewFactory;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:18,代码来源:ExpressionWindowView.java

示例12: RouteResultViewHandlerFirst

import com.espertech.esper.epl.expression.ExprEvaluator; //导入依赖的package包/类
/**
 * Ctor.
 * @param epStatementHandle handle
 * @param internalEventRouter routes generated events
 * @param processors select clauses
 * @param whereClauses where clauses
 * @param statementContext statement services
 */
public RouteResultViewHandlerFirst(EPStatementHandle epStatementHandle, InternalEventRouter internalEventRouter, boolean[] isNamedWindowInsert, ResultSetProcessor[] processors, ExprEvaluator[] whereClauses, StatementContext statementContext)
{
    this.internalEventRouter = internalEventRouter;
    this.isNamedWindowInsert = isNamedWindowInsert;
    this.epStatementHandle = epStatementHandle;
    this.processors = processors;
    this.whereClauses = whereClauses;
    this.statementContext = statementContext;
    this.exprEvaluatorContextStatement = new ExprEvaluatorContextStatement(statementContext);
    this.audit = AuditEnum.INSERT.getAudit(statementContext.getAnnotations()) != null;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:20,代码来源:RouteResultViewHandlerFirst.java

示例13: makeView

import com.espertech.esper.epl.expression.ExprEvaluator; //导入依赖的package包/类
public View makeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
{
    IStreamSortRankRandomAccess sortedRandomAccess = ViewServiceHelper.getOptPreviousExprSortedRankedAccess(agentInstanceViewFactoryContext);

    boolean useCollatorSort = false;
    if (agentInstanceViewFactoryContext.getAgentInstanceContext().getStatementContext().getConfigSnapshot() != null)
    {
        useCollatorSort = agentInstanceViewFactoryContext.getAgentInstanceContext().getStatementContext().getConfigSnapshot().getEngineDefaults().getLanguage().isSortUsingCollator();
    }

    ExprEvaluator[] childEvals = ExprNodeUtility.getEvaluators(sortCriteriaExpressions);
    return new SortWindowView(this, sortCriteriaExpressions, childEvals, isDescendingValues, sortWindowSize, sortedRandomAccess, useCollatorSort, agentInstanceViewFactoryContext);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:14,代码来源:SortWindowViewFactory.java

示例14: 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

示例15: 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


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