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


Java MatchRecognizeDefineItem类代码示例

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


MatchRecognizeDefineItem类属于com.espertech.esper.epl.spec包,在下文中一共展示了MatchRecognizeDefineItem类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildDefineStreamTypeServiceDefine

import com.espertech.esper.epl.spec.MatchRecognizeDefineItem; //导入依赖的package包/类
public static StreamTypeService buildDefineStreamTypeServiceDefine(StatementContext statementContext,
                                                                   LinkedHashMap<String, Pair<Integer, Boolean>> variableStreams,
                                                                   MatchRecognizeDefineItem defineItem,
                                                                   Map<String, Set<String>> visibilityByIdentifier,
                                                                   EventType parentViewType)
        throws ExprValidationException {
    if (!variableStreams.containsKey(defineItem.getIdentifier())) {
        throw new ExprValidationException("Variable '" + defineItem.getIdentifier() + "' does not occur in pattern");
    }

    String[] streamNamesDefine = new String[variableStreams.size() + 1];
    EventType[] typesDefine = new EventType[variableStreams.size() + 1];
    boolean[] isIStreamOnly = new boolean[variableStreams.size() + 1];
    Arrays.fill(isIStreamOnly, true);

    int streamNumDefine = variableStreams.get(defineItem.getIdentifier()).getFirst();
    streamNamesDefine[streamNumDefine] = defineItem.getIdentifier();
    typesDefine[streamNumDefine] = parentViewType;

    // add visible single-value
    Set<String> visibles = visibilityByIdentifier.get(defineItem.getIdentifier());
    boolean hasVisibleMultimatch = false;
    if (visibles != null) {
        for (String visible : visibles) {
            Pair<Integer, Boolean> def = variableStreams.get(visible);
            if (!def.getSecond()) {
                streamNamesDefine[def.getFirst()] = visible;
                typesDefine[def.getFirst()] = parentViewType;
            } else {
                hasVisibleMultimatch = true;
            }
        }
    }

    // compile multi-matching event type (in last position), if any are used
    if (hasVisibleMultimatch) {
        Map<String, Object> multievent = new LinkedHashMap<String, Object>();
        for (Map.Entry<String, Pair<Integer, Boolean>> entry : variableStreams.entrySet()) {
            String identifier = entry.getKey();
            if (entry.getValue().getSecond()) {
                if (visibles.contains(identifier)) {
                    multievent.put(identifier, new EventType[]{parentViewType});
                } else {
                    multievent.put("esper_matchrecog_internal", null);
                }
            }
        }
        EventType multimatch = statementContext.getEventAdapterService().createAnonymousObjectArrayType(
                "esper_matchrecog_internal", multievent);
        typesDefine[typesDefine.length - 1] = multimatch;
        streamNamesDefine[streamNamesDefine.length - 1] = multimatch.getName();
    }

    return new StreamTypeServiceImpl(typesDefine, streamNamesDefine, isIStreamOnly, statementContext.getEngineURI(), false, true);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:56,代码来源:EventRowRegexNFAViewFactoryHelper.java


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