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


Java ExpressionExecutor类代码示例

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


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

示例1: init

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
/**
 * The initialization method for FunctionExecutor, this method will be called before the other methods
 *  @param attributeExpressionExecutors are the executors of each function parameters
 * @param configReader
 * @param siddhiAppContext         the context of the siddhi app
 */
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                    SiddhiAppContext siddhiAppContext) {
    for (ExpressionExecutor expressionExecutor : attributeExpressionExecutors) {
        Attribute.Type attributeType = expressionExecutor.getReturnType();
        if (attributeType == Attribute.Type.DOUBLE) {
            returnType = attributeType;

        } else if ((attributeType == Attribute.Type.STRING) || (attributeType == Attribute.Type.BOOL)) {
            throw new SiddhiAppCreationException("Plus cannot have parameters with types String or Bool");
        } else {
            returnType = Attribute.Type.LONG;
        }
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:22,代码来源:CustomFunctionExtension.java

示例2: init

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
/**
 * The initialization method for FunctionExecutor
 *
 * @param attributeExpressionExecutors are the executors of each attributes in the function
 * @param configReader                 this hold the {@link MaxAttributeAggregator} configuration reader.
 * @param siddhiAppContext             Siddhi app runtime context
 */
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                    SiddhiAppContext siddhiAppContext) {
    if (attributeExpressionExecutors.length != 1) {
        throw new OperationNotSupportedException("Max aggregator has to have exactly 1 parameter, currently " +
                attributeExpressionExecutors.length + " parameters provided");
    }
    Attribute.Type type = attributeExpressionExecutors[0].getReturnType();
    switch (type) {
        case FLOAT:
            maxOutputAttributeAggregator = new MaxAttributeAggregatorFloat();
            break;
        case INT:
            maxOutputAttributeAggregator = new MaxAttributeAggregatorInt();
            break;
        case LONG:
            maxOutputAttributeAggregator = new MaxAttributeAggregatorLong();
            break;
        case DOUBLE:
            maxOutputAttributeAggregator = new MaxAttributeAggregatorDouble();
            break;
        default:
            throw new OperationNotSupportedException("Max not supported for " + type);
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:33,代码来源:MaxAttributeAggregator.java

示例3: init

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
/**
 * The initialization method for FunctionExecutor
 *
 * @param attributeExpressionExecutors are the executors of each attributes in the function
 * @param configReader                 this hold the {@link MinAttributeAggregator} configuration reader.
 * @param siddhiAppContext             Siddhi app runtime context
 */
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                    SiddhiAppContext siddhiAppContext) {
    if (attributeExpressionExecutors.length != 1) {
        throw new OperationNotSupportedException("Min aggregator has to have exactly 1 parameter, currently " +
                attributeExpressionExecutors.length + " parameters provided");
    }
    Attribute.Type type = attributeExpressionExecutors[0].getReturnType();
    switch (type) {
        case FLOAT:
            minOutputAttributeAggregator = new MinAttributeAggregatorFloat();
            break;
        case INT:
            minOutputAttributeAggregator = new MinAttributeAggregatorInt();
            break;
        case LONG:
            minOutputAttributeAggregator = new MinAttributeAggregatorLong();
            break;
        case DOUBLE:
            minOutputAttributeAggregator = new MinAttributeAggregatorDouble();
            break;
        default:
            throw new OperationNotSupportedException("Min not supported for " + type);
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:33,代码来源:MinAttributeAggregator.java

示例4: init

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
@Override
public void init(List<ExpressionExecutor> attributeExpressionExecutors, SiddhiContext siddhiContext) {
    if (attributeSize != 2) {
        throw new OperationNotSupportedException("IsMatch has to have 2 expressions regex and the attribute, " +
                "currently " + attributeSize + " expressions provided");
    }
    ExpressionExecutor regexExecutor = attributeExpressionExecutors.get(0);
    if (regexExecutor.getReturnType() != Attribute.Type.STRING &&
            regexExecutor instanceof ConstantExpressionExecutor) {
        throw new OperationNotSupportedException("IsMatch expects regex string input expression but found " +
                regexExecutor.getReturnType());
    }
    expressionExecutor = attributeExpressionExecutors.get(1);

    pattern = Pattern.compile((String) regexExecutor.execute(null));

}
 
开发者ID:sacjaya,项目名称:siddhi-3,代码行数:18,代码来源:IsMatchFunctionExecutor.java

示例5: cloneProcessor

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
@Override
public Processor cloneProcessor(String key) {
    try {
        AggregateWindowProcessor streamProcessor = new AggregateWindowProcessor(aggregationRuntime, within, per);
        streamProcessor.inputDefinition = inputDefinition;
        ExpressionExecutor[] innerExpressionExecutors = new ExpressionExecutor[attributeExpressionLength];
        ExpressionExecutor[] attributeExpressionExecutors1 = this.attributeExpressionExecutors;
        for (int i = 0; i < attributeExpressionLength; i++) {
            innerExpressionExecutors[i] = attributeExpressionExecutors1[i].cloneExecutor(key);
        }
        streamProcessor.attributeExpressionExecutors = innerExpressionExecutors;
        streamProcessor.attributeExpressionLength = attributeExpressionLength;
        streamProcessor.additionalAttributes = additionalAttributes;
        streamProcessor.complexEventPopulater = complexEventPopulater;
        streamProcessor.init(inputDefinition, attributeExpressionExecutors, configReader, siddhiAppContext,
                outputExpectsExpiredEvents);
        streamProcessor.start();
        return streamProcessor;

    } catch (Exception e) {
        throw new SiddhiAppRuntimeException("Exception in cloning " + this.getClass().getCanonicalName(), e);
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:24,代码来源:AggregateWindowProcessor.java

示例6: init

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, boolean
        outputExpectsExpiredEvents, SiddhiAppContext siddhiAppContext) {
    support = Double.parseDouble(String.valueOf(((ConstantExpressionExecutor) attributeExpressionExecutors[0])
            .getValue()));
    if (attributeExpressionExecutors.length > 1) {
        error = Double.parseDouble(String.valueOf(((ConstantExpressionExecutor) attributeExpressionExecutors[1])
                .getValue()));
    } else {
        error = support / 10; // recommended error is 10% of 20$ of support value;
    }
    if ((support > 1 || support < 0) || (error > 1 || error < 0)) {
        log.error("Wrong argument has provided, Error executing the window");
    }
    variableExpressionExecutors = new VariableExpressionExecutor[attributeExpressionExecutors.length - 2];
    if (attributeExpressionExecutors.length > 2) {  // by-default all the attributes will be compared
        for (int i = 2; i < attributeExpressionExecutors.length; i++) {
            variableExpressionExecutors[i - 2] = (VariableExpressionExecutor) attributeExpressionExecutors[i];
        }
    }
    windowWidth = Math.ceil(1 / error);
    currentBucketId = 1;
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:24,代码来源:LossyFrequentWindowProcessor.java

示例7: buildStreamVariableExecutor

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
private void buildStreamVariableExecutor(Variable variable, int streamEventChainIndex,
                                         ExpressionVisitor expressionVisitor, Attribute.Type type) {
    String id = variable.getAttributeName();
    if (variable.getStreamId() != null) {
        id = variable.getStreamId() + "." + id;
    }
    expressionVisitor.beginVisitStreamVariable(id, variable.getStreamId(), variable.getAttributeName(), type);
    if (!variableExpressionExecutorMap.containsKey(id)) {
        ExpressionExecutor variableExpressionExecutor = ExpressionParser.parseExpression(
                variable, matchingMetaInfoHolder.getMetaStateEvent(), streamEventChainIndex, tableMap,
                variableExpressionExecutors, siddhiAppContext, false, 0, queryName);
        variableExpressionExecutorMap.put(id, variableExpressionExecutor);
    }
    expressionVisitor.endVisitStreamVariable(id, variable.getStreamId(), variable.getAttributeName(), type);

}
 
开发者ID:wso2,项目名称:siddhi,代码行数:17,代码来源:ExpressionBuilder.java

示例8: createAggregateSelectionEventChunk

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
private ComplexEventChunk<StreamEvent> createAggregateSelectionEventChunk(
        ComplexEventChunk<StreamEvent> complexEventChunkToHoldMatches,
        List<ExpressionExecutor> outputExpressionExecutors) {
    ComplexEventChunk<StreamEvent> aggregateSelectionComplexEventChunk = new ComplexEventChunk<>(true);
    StreamEvent resetEvent = streamEventPoolForTableMeta.borrowEvent();
    resetEvent.setType(ComplexEvent.Type.RESET);

    while (complexEventChunkToHoldMatches.hasNext()) {
        StreamEvent streamEvent = complexEventChunkToHoldMatches.next();
        StreamEvent newStreamEvent = streamEventPoolForAggregateMeta.borrowEvent();
        Object outputData[] = new Object[newStreamEvent.getOutputData().length];
        for (int i = 0; i < outputExpressionExecutors.size(); i++) {
            outputData[i] = outputExpressionExecutors.get(i).execute(streamEvent);
        }
        newStreamEvent.setTimestamp(streamEvent.getTimestamp());
        newStreamEvent.setOutputData(outputData);
        aggregateSelectionComplexEventChunk.add(newStreamEvent);
    }

    for (ExpressionExecutor expressionExecutor : outputExpressionExecutors) {
        expressionExecutor.execute(resetEvent);
    }

    return aggregateSelectionComplexEventChunk;
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:26,代码来源:IncrementalAggregateCompileCondition.java

示例9: extractAndValidateFeatures

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
/**
 * @param inputDefinition
 * @param attributeExpressionExecutors
 * @param startIndex                   starting index
 * @param noOfFeatures
 * @return
 */
public static List<VariableExpressionExecutor> extractAndValidateFeatures(
        AbstractDefinition inputDefinition, ExpressionExecutor[]
        attributeExpressionExecutors,
        int startIndex, int noOfFeatures) {

    List<VariableExpressionExecutor> featureVariableExpressionExecutors = new ArrayList<>();

    // feature values start
    for (int i = startIndex; i < (startIndex + noOfFeatures); i++) {
        if (attributeExpressionExecutors[i] instanceof VariableExpressionExecutor) {
            featureVariableExpressionExecutors.add((VariableExpressionExecutor)
                    attributeExpressionExecutors[i]);
            // other attributes should be numeric type.
            String attributeName = ((VariableExpressionExecutor)
                    attributeExpressionExecutors[i]).getAttribute().getName();
            Attribute.Type featureAttributeType = inputDefinition.
                    getAttributeType(attributeName);

            //feature attributes not numerical type
            if (!isNumeric(featureAttributeType)) {
                throw new SiddhiAppValidationException("model.features in " + (i + 1) + "th parameter is not "
                        + "a numerical type attribute. Found " + attributeExpressionExecutors[i].getReturnType()
                        + ". Check the input stream definition.");
            }
        } else {
            throw new SiddhiAppValidationException((i + 1) + "th parameter is not " +
                    "an attribute (VariableExpressionExecutor) present in the stream definition. Found a "
                    + attributeExpressionExecutors[i].getClass().getCanonicalName());
        }
    }
    return featureVariableExpressionExecutors;
}
 
开发者ID:wso2-extensions,项目名称:siddhi-gpl-execution-streamingml,代码行数:40,代码来源:CoreUtils.java

示例10: init

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
/**
 * The initialization method for FunctionExecutor, this method will be called before the other methods
 */
@Override
protected void init(ExpressionExecutor[] expressionExecutors, ConfigReader configReader, SiddhiAppContext siddhiAppContext) {
	for (ExpressionExecutor expressionExecutor : attributeExpressionExecutors) {
		Attribute.Type attributeType = expressionExecutor.getReturnType();
		if (attributeType == Attribute.Type.DOUBLE) {
			returnType = attributeType;

		} else if ((attributeType == Attribute.Type.STRING) || (attributeType == Attribute.Type.BOOL)) {
			throw new SiddhiAppCreationException("Plus cannot have parameters with types String or Bool");
		} else {
			returnType = Attribute.Type.LONG;
		}
	}
}
 
开发者ID:haoch,项目名称:flink-siddhi,代码行数:18,代码来源:CustomPlusFunctionExtension.java

示例11: init

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
/**
 * The initialization method for FunctionExecutor, this method will be called before the other methods
 */
@Override
protected void init(ExpressionExecutor[] expressionExecutors, ConfigReader configReader, SiddhiAppContext siddhiAppContext) {
    for (ExpressionExecutor expressionExecutor : attributeExpressionExecutors) {
        Attribute.Type attributeType = expressionExecutor.getReturnType();
        if (attributeType == Attribute.Type.DOUBLE) {
            returnType = attributeType;

        } else if ((attributeType == Attribute.Type.STRING) || (attributeType == Attribute.Type.BOOL)) {
            throw new SiddhiAppCreationException("Plus cannot have parameters with types String or Bool");
        } else {
            returnType = Attribute.Type.LONG;
        }
    }
}
 
开发者ID:apache,项目名称:bahir-flink,代码行数:18,代码来源:CustomPlusFunctionExtension.java

示例12: init

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                    SiddhiAppContext siddhiAppContext) {
    if (attributeExpressionExecutors.length != 1) {
        throw new SiddhiAppValidationException("Invalid no of arguments passed to instanceOfString() " +
                "function, required only 1, but found " + attributeExpressionExecutors.length);
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:9,代码来源:InstanceOfStringFunctionExecutor.java

示例13: init

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
/**
 * The initialization method for FunctionExecutor
 *
 * @param attributeExpressionExecutors are the executors of each attributes in the function
 * @param configReader                 this hold the {@link SumAttributeAggregator} configuration reader.
 * @param siddhiAppContext             Siddhi app runtime context
 */
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                    SiddhiAppContext siddhiAppContext) {
    if (attributeExpressionExecutors.length != 1) {
        throw new OperationNotSupportedException("Sum aggregator has to have exactly 1 parameter, currently " +
                attributeExpressionExecutors.length
                + " parameters provided");
    }
    Attribute.Type type = attributeExpressionExecutors[0].getReturnType();
    switch (type) {
        case FLOAT:
            sumOutputAttributeAggregator = new SumAttributeAggregatorFloat();
            break;
        case INT:
            sumOutputAttributeAggregator = new SumAttributeAggregatorInt();
            break;
        case LONG:
            sumOutputAttributeAggregator = new SumAttributeAggregatorLong();
            break;
        case DOUBLE:
            sumOutputAttributeAggregator = new SumAttributeAggregatorDouble();
            break;
        default:
            throw new OperationNotSupportedException("Sum not supported for " + type);
    }

}
 
开发者ID:wso2,项目名称:siddhi,代码行数:35,代码来源:SumAttributeAggregator.java

示例14: testConditionExpressionExecutorValidation

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
@Test(expected = OperationNotSupportedException.class)
public void testConditionExpressionExecutorValidation() {
    StreamDefinition streamDefinition = StreamDefinition.id("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT);

    VariableExpressionExecutor volumeVariableExpressionExecutor = new VariableExpressionExecutor("volume", streamDefinition);
    ConstantExpressionExecutor constantExpressionExecutor = new ConstantExpressionExecutor(10f, Attribute.Type.FLOAT);
    ExpressionExecutor compareGreaterThanExecutor = new GreaterThanCompareConditionExpressionExecutorIntInt(new ConstantExpressionExecutor(10, Attribute.Type.INT), volumeVariableExpressionExecutor);
    ExpressionExecutor andExecutor = new AndConditionExpressionExecutor(constantExpressionExecutor, compareGreaterThanExecutor);
}
 
开发者ID:sacjaya,项目名称:siddhi-3,代码行数:10,代码来源:EventTest.java

示例15: init

import org.wso2.siddhi.core.executor.ExpressionExecutor; //导入依赖的package包/类
@Override
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, boolean
        outputExpectsExpiredEvents, SiddhiAppContext siddhiAppContext) {
    // nothing to be done
    this.configReader = configReader;
    this.outputExpectsExpiredEvents = outputExpectsExpiredEvents;
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:8,代码来源:WindowWindowProcessor.java


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