Package com.espertech.esper.epl.expression

Source Code of com.espertech.esper.epl.expression.ExprDotEvalStreamEventBean

/**************************************************************************************
* Copyright (C) 2008 EsperTech, Inc. All rights reserved.                            *
* http://esper.codehaus.org                                                          *
* http://www.espertech.com                                                           *
* ---------------------------------------------------------------------------------- *
* The software in this package is published under the terms of the GPL license       *
* a copy of which has been included with this distribution in the license.txt file.  *
**************************************************************************************/
package com.espertech.esper.epl.expression;

import com.espertech.esper.client.EventBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.Map;

public class ExprDotEvalStreamEventBean implements ExprEvaluator
{
    private static final Log log = LogFactory.getLog(ExprDotEvalStreamEventBean.class);

    private final int streamNumber;
    private final ExprDotEval[] evaluators;

    public ExprDotEvalStreamEventBean(int streamNumber, ExprDotEval[] evaluators) {
        this.streamNumber = streamNumber;
        this.evaluators = evaluators;
    }

    public Class getType()
    {
        return evaluators[evaluators.length - 1].getTypeInfo().getSingleValueType();
    }

    public Map<String, Object> getEventType() {
        return null;
    }

    public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
  {
        EventBean theEvent = eventsPerStream[streamNumber];
        if (theEvent == null) {
            return null;
        }

        Object inner = theEvent;
        for (ExprDotEval methodEval : evaluators) {
            inner = methodEval.evaluate(inner, eventsPerStream, isNewData, exprEvaluatorContext);
            if (inner == null) {
                break;
            }
        }
        return inner;
    }
}
TOP

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

TOP
Copyright © 2018 www.massapi.com. 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.