Search in sources :

Example 1 with SnapshotOutputRate

use of org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.SnapshotOutputRate in project ballerina by ballerina-lang.

the class SiddhiQLBaseVisitorImpl method visitOutput_rate.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public OutputRate visitOutput_rate(@NotNull SiddhiQLParser.Output_rateContext ctx) {
    if (ctx.SNAPSHOT() != null) {
        SnapshotOutputRate snapshotOutputRate = new SnapshotOutputRate(((TimeConstant) visit(ctx.time_value())).value());
        populateQueryContext(snapshotOutputRate, ctx);
        return snapshotOutputRate;
    } else if (ctx.time_value() != null) {
        TimeOutputRate timeOutputRate = new TimeOutputRate(((TimeConstant) visit(ctx.time_value())).value());
        if (ctx.output_rate_type() != null) {
            timeOutputRate.output((OutputRate.Type) visit(ctx.output_rate_type()));
        }
        populateQueryContext(timeOutputRate, ctx);
        return timeOutputRate;
    } else if (ctx.EVENTS() != null) {
        EventOutputRate eventOutputRate = new EventOutputRate(Integer.parseInt(ctx.INT_LITERAL().getText()));
        if (ctx.output_rate_type() != null) {
            eventOutputRate.output((OutputRate.Type) visit(ctx.output_rate_type()));
        }
        populateQueryContext(eventOutputRate, ctx);
        return eventOutputRate;
    } else {
        throw newSiddhiParserException(ctx);
    }
}
Also used : SnapshotOutputRate(org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.SnapshotOutputRate) RangePartitionType(org.ballerinalang.siddhi.query.api.execution.partition.RangePartitionType) ValuePartitionType(org.ballerinalang.siddhi.query.api.execution.partition.ValuePartitionType) PartitionType(org.ballerinalang.siddhi.query.api.execution.partition.PartitionType) EventOutputRate(org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.EventOutputRate) SnapshotOutputRate(org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.SnapshotOutputRate) TimeOutputRate(org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.TimeOutputRate) OutputRate(org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.OutputRate) EventOutputRate(org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.EventOutputRate) TimeOutputRate(org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.TimeOutputRate) TimeConstant(org.ballerinalang.siddhi.query.api.expression.constant.TimeConstant)

Aggregations

PartitionType (org.ballerinalang.siddhi.query.api.execution.partition.PartitionType)1 RangePartitionType (org.ballerinalang.siddhi.query.api.execution.partition.RangePartitionType)1 ValuePartitionType (org.ballerinalang.siddhi.query.api.execution.partition.ValuePartitionType)1 EventOutputRate (org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.EventOutputRate)1 OutputRate (org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.OutputRate)1 SnapshotOutputRate (org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.SnapshotOutputRate)1 TimeOutputRate (org.ballerinalang.siddhi.query.api.execution.query.output.ratelimit.TimeOutputRate)1 TimeConstant (org.ballerinalang.siddhi.query.api.expression.constant.TimeConstant)1