Package com.espertech.esper.epl.expression

Examples of com.espertech.esper.epl.expression.ExprTimePeriodEvalDeltaConst


                                                                           String expectedMessage,
                                                                           int expressionNumber)
            throws ViewParameterException
    {
        StreamTypeService streamTypeService = new StreamTypeServiceImpl(statementContext.getEngineURI(), false);
        ExprTimePeriodEvalDeltaConst timeDelta;
        if (expression instanceof ExprTimePeriod) {
            ExprTimePeriod validated = (ExprTimePeriod) ViewFactorySupport.validateExpr(viewName, statementContext, expression, streamTypeService, expressionNumber);
            timeDelta = validated.constEvaluator(new ExprEvaluatorContextStatement(statementContext));
        }
        else {
            Object result = ViewFactorySupport.validateAndEvaluateExpr(viewName, statementContext, expression, streamTypeService, expressionNumber);
            if (!(result instanceof Number)) {
                throw new ViewParameterException(expectedMessage);
            }
            Number param = (Number) result;
            long millisecondsBeforeExpiry;
            if (JavaClassHelper.isFloatingPointNumber(param)) {
                millisecondsBeforeExpiry = Math.round(1000d * param.doubleValue());
            }
            else {
                millisecondsBeforeExpiry = 1000 * param.longValue();
            }
            timeDelta = new ExprTimePeriodEvalDeltaConstMsec(millisecondsBeforeExpiry);
        }
        if (timeDelta.deltaMillisecondsAdd(0) < 1) {
            throw new ViewParameterException(viewName + " view requires a size of at least 1 msec");
        }
        return timeDelta;
    }
View Full Code Here

TOP

Related Classes of com.espertech.esper.epl.expression.ExprTimePeriodEvalDeltaConst

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.