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


Java MultiKeyUntyped類代碼示例

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


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

示例1: addProperty

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
/**
 * Add a property to the event passed in.
 *
 * @param originalEvent       - event to add property to
 * @param propertyNames       - names of properties to add
 * @param propertyValues      - value of properties to add
 * @param targetEventType     - new event type
 * @param eventAdapterService - service for generating events and handling event types
 * @return event with added property
 */
protected static EventBean addProperty(EventBean originalEvent,
                                       String[] propertyNames,
                                       Object propertyValues,
                                       EventType targetEventType,
                                       EventAdapterService eventAdapterService) {
    Map<String, Object> values = new HashMap<String, Object>();
    if (propertyValues instanceof MultiKeyUntyped) {
        MultiKeyUntyped props = (MultiKeyUntyped) propertyValues;
        Object[] propertyValuesArr = props.getKeys();

        for (int i = 0; i < propertyNames.length; i++) {
            values.put(propertyNames[i], propertyValuesArr[i]);
        }
    } else {
        values.put(propertyNames[0], propertyValues);
    }

    return eventAdapterService.adapterForTypedWrapper(originalEvent, values, targetEventType);
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:30,代碼來源:AddPropertyValueOptionalView.java

示例2: computeSubkey

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public Object computeSubkey(Object groupKey) {
    if (isAggregationTop()) {
        return null;
    }
    if (groupKey instanceof MultiKeyUntyped) {
        MultiKeyUntyped mk = (MultiKeyUntyped) groupKey;
        Object[] keys = mk.getKeys();
        if (rollupKeys.length == keys.length) {
            return mk;
        } else if (rollupKeys.length == 1) {
            return keys[rollupKeys[0]];
        } else {
            Object[] subkeys = new Object[rollupKeys.length];
            int count = 0;
            for (int rollupKey : rollupKeys) {
                subkeys[count++] = keys[rollupKey];
            }
            return new MultiKeyUntyped(subkeys);
        }
    } else {
        return groupKey;
    }
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:24,代碼來源:AggregationGroupByRollupLevel.java

示例3: computeMultiKeyCodegen

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public static CodegenMethodNode computeMultiKeyCodegen(int idNumber, ExprForge[] partitionForges, CodegenClassScope classScope, CodegenNamedMethods namedMethods) {
    ExprForgeCodegenSymbol exprSymbol = new ExprForgeCodegenSymbol(true, null);
    Consumer<CodegenMethodNode> code = method -> {
        if (partitionForges.length == 1) {
            CodegenExpression expression = partitionForges[0].evaluateCodegen(Object.class, method, exprSymbol, classScope);
            exprSymbol.derivedSymbolsCodegen(method, method.getBlock(), classScope);
            method.getBlock().methodReturn(expression);
        } else {
            CodegenExpression[] expressions = new CodegenExpression[partitionForges.length];
            for (int i = 0; i < partitionForges.length; i++) {
                expressions[i] = partitionForges[i].evaluateCodegen(Object.class, method, exprSymbol, classScope);
            }
            exprSymbol.derivedSymbolsCodegen(method, method.getBlock(), classScope);
            method.getBlock().declareVar(Object[].class, "keys", newArrayByLength(Object.class, constant(partitionForges.length)));
            for (int i = 0; i < expressions.length; i++) {
                method.getBlock().assignArrayElement("keys", constant(i), expressions[i]);
            }
            method.getBlock().methodReturn(newInstance(MultiKeyUntyped.class, ref("keys")));
        }
    };

    return namedMethods.addMethodWithSymbols(Object.class, "computeKeyArrayCodegen_" + idNumber, CodegenNamedParam.from(EventBean[].class, NAME_EPS, boolean.class, NAME_ISNEWDATA, ExprEvaluatorContext.class, NAME_EXPREVALCONTEXT), AggSvcGroupLocalGroupByBase.class, classScope, code, exprSymbol);
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:24,代碼來源:AggregationServiceCodegenUtil.java

示例4: get

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public Collection<EventBean> get(EventBean[] eventsPerStream, Map parent, ExprEvaluatorContext context, CompositeIndexQueryResultPostProcessor postProcessor) {

        EventBean[] eventsToUse;
        if (isNWOnTrigger) {
            eventsToUse = eventsPerStream;
        } else {
            System.arraycopy(eventsPerStream, 0, events, 1, eventsPerStream.length);
            eventsToUse = events;
        }

        MultiKeyUntyped mk = EventBeanUtility.getMultiKey(eventsToUse, evaluators, context, keyCoercionTypes);
        Map innerIndex = (Map) parent.get(mk);
        if (innerIndex == null) {
            return null;
        }
        return next.get(eventsPerStream, innerIndex, context, postProcessor);
    }
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:18,代碼來源:CompositeIndexQueryKeyed.java

示例5: getCollectKeys

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public Collection<EventBean> getCollectKeys(EventBean[] eventsPerStream, Map parent, ExprEvaluatorContext context, ArrayList<Object> keys, CompositeIndexQueryResultPostProcessor postProcessor) {

        EventBean[] eventsToUse;
        if (isNWOnTrigger) {
            eventsToUse = eventsPerStream;
        } else {
            System.arraycopy(eventsPerStream, 0, events, 1, eventsPerStream.length);
            eventsToUse = events;
        }

        MultiKeyUntyped mk = EventBeanUtility.getMultiKey(eventsToUse, evaluators, context, keyCoercionTypes);
        Collections.addAll(keys, mk.getKeys());
        Map innerIndex = (Map) parent.get(mk);
        if (innerIndex == null) {
            return null;
        }
        return next.getCollectKeys(eventsPerStream, innerIndex, context, keys, postProcessor);
    }
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:19,代碼來源:CompositeIndexQueryKeyed.java

示例6: remove

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public void remove(EventBean theEvent, ExprEvaluatorContext exprEvaluatorContext) {
    MultiKeyUntyped key = getMultiKey(theEvent);

    Set<EventBean> events = propertyIndex.get(key);
    if (events == null) {
        return;
    }

    if (!events.remove(theEvent)) {
        // Not an error, its possible that an old-data event is artificial (such as for statistics) and
        // thus did not correspond to a new-data event raised earlier.
        return;
    }

    if (events.isEmpty()) {
        propertyIndex.remove(key);
    }
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:19,代碼來源:PropertyIndexedEventTableUnadorned.java

示例7: makeOA

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public ObjectArrayBackedEventBean makeOA(int agentInstanceId, Object groupByKey, Object groupKeyBinding, AggregationServicePassThru passThru) {
    AggregationRowPair row = makeAggs(agentInstanceId, groupByKey, groupKeyBinding, passThru);
    Object[] data = new Object[objectArrayEventType.getPropertyDescriptors().length];
    data[0] = row;

    if (groupKeyIndexes.length == 1) {
        data[groupKeyIndexes[0]] = groupByKey;
    } else {
        if (groupKeyIndexes.length > 1) {
            Object[] keys = ((MultiKeyUntyped) groupByKey).getKeys();
            for (int i = 0; i < groupKeyIndexes.length; i++) {
                data[groupKeyIndexes[i]] = keys[i];
            }
        }
    }

    return (ObjectArrayBackedEventBean) eventAdapterService.adapterForType(data, objectArrayEventType);
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:19,代碼來源:TableStateRowFactory.java

示例8: getMultiKey

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public static MultiKeyUntyped getMultiKey(EventBean theEvent, EventPropertyGetter[] propertyGetters, Class[] coercionTypes) {
    Object[] keyValues = getPropertyArray(theEvent, propertyGetters);
    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:espertechinc,項目名稱:esper,代碼行數:17,代碼來源:EventBeanUtility.java

示例9: makeBigIntegerComputer

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
private Computer makeBigIntegerComputer(Class typeOne, Class typeTwo) {
    if ((typeOne == BigDecimal.class) && (typeTwo == BigDecimal.class)) {
        return computers.get(new MultiKeyUntyped(new Object[]{BigDecimal.class, this}));
    }
    if ((typeOne == BigInteger.class) && (typeTwo == BigInteger.class)) {
        Computer computer = computers.get(new MultiKeyUntyped(new Object[]{BigInteger.class, this}));
        if (computer != null) {
            return computer;
        }
    }
    SimpleNumberBigIntegerCoercer convertorOne = SimpleNumberCoercerFactory.getCoercerBigInteger(typeOne);
    SimpleNumberBigIntegerCoercer convertorTwo = SimpleNumberCoercerFactory.getCoercerBigInteger(typeTwo);
    if (this == ADD) {
        return new AddBigIntConvComputer(convertorOne, convertorTwo);
    }
    if (this == SUBTRACT) {
        return new SubtractBigIntConvComputer(convertorOne, convertorTwo);
    }
    if (this == MULTIPLY) {
        return new MultiplyBigIntConvComputer(convertorOne, convertorTwo);
    }
    if (this == DIVIDE) {
        return new DivideBigIntConvComputer(convertorOne, convertorTwo);
    }
    return new ModuloLong();
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:27,代碼來源:MathArithTypeEnum.java

示例10: put

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public final void put(Object filterConstant, EventEvaluator evaluator) {
    // Store evaluator keyed to set of values
    MultiKeyUntyped keys = (MultiKeyUntyped) filterConstant;

    // make sure to remove the old evaluator for this constant
    EventEvaluator oldEvaluator = evaluatorsMap.put(keys, evaluator);

    // Store each value to match against in Map with it's evaluator as a list
    Object[] keyValues = keys.getKeys();
    for (int i = 0; i < keyValues.length; i++) {
        List<EventEvaluator> evaluators = constantsMap.get(keyValues[i]);
        if (evaluators == null) {
            evaluators = new LinkedList<EventEvaluator>();
            constantsMap.put(keyValues[i], evaluators);
        } else {
            if (oldEvaluator != null) {
                evaluators.remove(oldEvaluator);
            }
        }
        evaluators.add(evaluator);
    }
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:23,代碼來源:FilterParamIndexIn.java

示例11: remove

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public final void remove(Object filterConstant) {
    MultiKeyUntyped keys = (MultiKeyUntyped) filterConstant;

    // remove the mapping of value set to evaluator
    EventEvaluator eval = evaluatorsMap.remove(keys);

    Object[] keyValues = keys.getKeys();
    for (int i = 0; i < keyValues.length; i++) {
        List<EventEvaluator> evaluators = constantsMap.get(keyValues[i]);
        if (evaluators != null) {
            // could be removed already as same-value constants existed
            evaluators.remove(eval);
            if (evaluators.isEmpty()) {
                constantsMap.remove(keyValues[i]);
            }
        }
    }
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:19,代碼來源:FilterParamIndexIn.java

示例12: put

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public final void put(Object filterConstant, EventEvaluator evaluator) {
    // Store evaluator keyed to set of values
    MultiKeyUntyped keys = (MultiKeyUntyped) filterConstant;
    filterValueEvaluators.put(keys, evaluator);
    evaluatorsSet.add(evaluator);

    // Store each value to match against in Map with it's evaluator as a list
    Object[] keyValues = keys.getKeys();
    for (Object keyValue : keyValues) {
        Set<EventEvaluator> evaluators = constantsMap.get(keyValue);
        if (evaluators == null) {
            evaluators = new HashSet<EventEvaluator>();
            constantsMap.put(keyValue, evaluators);
        }
        evaluators.add(evaluator);
    }
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:18,代碼來源:FilterParamIndexNotIn.java

示例13: remove

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public final void remove(Object filterConstant) {
    MultiKeyUntyped keys = (MultiKeyUntyped) filterConstant;

    // remove the mapping of value set to evaluator
    EventEvaluator eval = filterValueEvaluators.remove(keys);
    evaluatorsSet.remove(eval);

    Object[] keyValues = keys.getKeys();
    for (Object keyValue : keyValues) {
        Set<EventEvaluator> evaluators = constantsMap.get(keyValue);
        if (evaluators != null) {
            // could already be removed as constants may be the same
            evaluators.remove(eval);
            if (evaluators.isEmpty()) {
                constantsMap.remove(keyValue);
            }
        }
    }
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:20,代碼來源:FilterParamIndexNotIn.java

示例14: getPartitionBean

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
public static Map<String, Object> getPartitionBean(String contextName, int agentInstanceId, Object keyValue, List<String> propertyNames, Map<String, Object> initEvents) {
    Object[] agentInstanceProperties;
    if (propertyNames.size() == 1) {
        agentInstanceProperties = new Object[]{keyValue};
    } else {
        agentInstanceProperties = ((MultiKeyUntyped) keyValue).getKeys();
    }

    Map<String, Object> props = new HashMap<String, Object>();
    props.put(PROP_CTX_NAME, contextName);
    props.put(PROP_CTX_ID, agentInstanceId);
    for (int i = 0; i < agentInstanceProperties.length; i++) {
        String propertyName = ContextPropertyEventType.PROP_CTX_KEY_PREFIX + (i + 1);
        props.put(propertyName, agentInstanceProperties[i]);
    }
    if (!initEvents.isEmpty()) {
        for (Map.Entry<String, Object> entry : initEvents.entrySet()) {
            props.put(entry.getKey(), entry.getValue());
        }
    }
    return props;
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:23,代碼來源:ContextPropertyEventType.java

示例15: addProperty

import com.espertech.esper.collection.MultiKeyUntyped; //導入依賴的package包/類
/**
 * Add a property to the event passed in.
 * @param originalEvent - event to add property to
 * @param propertyNames - names of properties to add
 * @param propertyValues - value of properties to add
 * @param targetEventType - new event type
 * @param eventAdapterService - service for generating events and handling event types
 * @return event with added property
 */
protected static EventBean addProperty(EventBean originalEvent,
                                   String[] propertyNames,
                                   Object propertyValues,
                                   EventType targetEventType,
                                   EventAdapterService eventAdapterService)
{
    Map<String, Object> values = new HashMap<String, Object>();
    if (propertyValues instanceof MultiKeyUntyped) {
        MultiKeyUntyped props = (MultiKeyUntyped) propertyValues;
        Object[] propertyValuesArr = props.getKeys();

        for (int i = 0; i < propertyNames.length; i++)
        {
            values.put(propertyNames[i], propertyValuesArr[i]);
        }
    }
    else {
        values.put(propertyNames[0], propertyValues);
    }

    return eventAdapterService.adapterForTypedWrapper(originalEvent, values, targetEventType);
}
 
開發者ID:mobile-event-processing,項目名稱:Asper,代碼行數:32,代碼來源:AddPropertyValueView.java


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