Class OutputLimitClause

java.lang.Object
com.espertech.esper.common.client.soda.OutputLimitClause
All Implemented Interfaces:
Serializable

public class OutputLimitClause extends Object implements Serializable
An output limit clause defines how to limit output of statements and consists of a selector specifiying which events to select to output, a frequency and a unit.
See Also:
  • Constructor Details

    • OutputLimitClause

      public OutputLimitClause()
      Ctor.
    • OutputLimitClause

      public OutputLimitClause(OutputLimitSelector selector, OutputLimitUnit unit)
      Ctor.
      Parameters:
      selector - selector
      unit - unit
    • OutputLimitClause

      public OutputLimitClause(OutputLimitSelector selector, Double frequency)
      Ctor.
      Parameters:
      selector - is the events to select
      frequency - a frequency to output at
    • OutputLimitClause

      public OutputLimitClause(OutputLimitSelector selector, TimePeriodExpression timePeriodExpression)
      Ctor.
      Parameters:
      selector - is the events to select
      timePeriodExpression - the unit for the frequency
    • OutputLimitClause

      public OutputLimitClause(TimePeriodExpression afterTimePeriodExpression)
      Ctor.
      Parameters:
      afterTimePeriodExpression - timer period for after.
    • OutputLimitClause

      public OutputLimitClause(OutputLimitSelector selector, String frequencyVariable)
      Ctor.
      Parameters:
      selector - is the events to select
      frequencyVariable - is the variable name providing output rate frequency values
    • OutputLimitClause

      public OutputLimitClause(OutputLimitSelector selector, Double frequency, String frequencyVariable, OutputLimitUnit unit)
      Ctor.
      Parameters:
      selector - is the events to select
      frequency - a frequency to output at
      unit - the unit for the frequency
      frequencyVariable - is the variable name providing output rate frequency values
    • OutputLimitClause

      public OutputLimitClause(OutputLimitSelector selector, OutputLimitUnit unit, TimePeriodExpression afterTimePeriod, Integer afterNumberOfEvents)
      Ctor.
      Parameters:
      selector - is the events to select
      unit - the unit of selection
      afterTimePeriod - after-keyword time period
      afterNumberOfEvents - after-keyword number of events
    • OutputLimitClause

      public OutputLimitClause(OutputLimitSelector selector, Expression[] crontabAtParameters)
      Ctor.
      Parameters:
      selector - is the events to select
      crontabAtParameters - the crontab schedule parameters
    • OutputLimitClause

      public OutputLimitClause(OutputLimitSelector selector, Expression whenExpression, List<Assignment> thenAssignments)
      Ctor.
      Parameters:
      selector - is the events to select
      whenExpression - the boolean expression to evaluate to control output
      thenAssignments - the variable assignments, optional or an empty list
  • Method Details

    • create

      public static OutputLimitClause create(TimePeriodExpression timePeriodExpression)
      Creates an output limit clause.
      Parameters:
      timePeriodExpression - a frequency to output at
      Returns:
      clause
    • createAfter

      public static OutputLimitClause createAfter(TimePeriodExpression afterTimePeriodExpression)
      Create with after-only time period.
      Parameters:
      afterTimePeriodExpression - time period
      Returns:
      clause
    • createAfter

      public static OutputLimitClause createAfter(int afterNumEvents)
      Create with after-only and number of events.
      Parameters:
      afterNumEvents - num events
      Returns:
      clause
    • create

      public static OutputLimitClause create(OutputLimitSelector selector, TimePeriodExpression timePeriodExpression)
      Creates an output limit clause.
      Parameters:
      selector - is the events to select
      timePeriodExpression - a frequency to output at
      Returns:
      clause
    • create

      public static OutputLimitClause create(OutputLimitSelector selector, double frequency)
      Creates an output limit clause.
      Parameters:
      selector - is the events to select
      frequency - a frequency to output at
      Returns:
      clause
    • create

      public static OutputLimitClause create(OutputLimitSelector selector, String frequencyVariable)
      Creates an output limit clause.
      Parameters:
      selector - is the events to select
      frequencyVariable - is the variable providing the output limit frequency
      Returns:
      clause
    • create

      public static OutputLimitClause create(double frequency)
      Creates an output limit clause.
      Parameters:
      frequency - a frequency to output at
      Returns:
      clause
    • create

      public static OutputLimitClause create(String frequencyVariable)
      Creates an output limit clause.
      Parameters:
      frequencyVariable - is the variable name providing output rate frequency values
      Returns:
      clause
    • create

      public static OutputLimitClause create(Expression whenExpression)
      Creates an output limit clause with a when-expression and optional then-assignment expressions to be added.
      Parameters:
      whenExpression - the expression that returns true to trigger output
      Returns:
      clause
    • createSchedule

      public static OutputLimitClause createSchedule(Expression[] scheduleParameters)
      Creates an output limit clause with a crontab 'at' schedule parameters, see FrequencyParameter and related.
      Parameters:
      scheduleParameters - the crontab schedule parameters
      Returns:
      clause
    • getSelector

      public OutputLimitSelector getSelector()
      Returns the selector indicating the events to output.
      Returns:
      selector
    • setSelector

      public void setSelector(OutputLimitSelector selector)
      Sets the selector indicating the events to output.
      Parameters:
      selector - to set
    • getFrequency

      public Double getFrequency()
      Returns output frequency.
      Returns:
      frequency of output
    • getUnit

      public OutputLimitUnit getUnit()
      Returns the unit the frequency is in.
      Returns:
      unit for the frequency.
    • setUnit

      public void setUnit(OutputLimitUnit unit)
      Sets the unit the frequency is in.
      Parameters:
      unit - is the unit for the frequency
    • getFrequencyVariable

      public String getFrequencyVariable()
      Returns the variable name of the variable providing output rate frequency values, or null if the frequency is a fixed value.
      Returns:
      variable name or null if no variable is used
    • setFrequencyVariable

      public void setFrequencyVariable(String frequencyVariable)
      Sets the variable name of the variable providing output rate frequency values, or null if the frequency is a fixed value.
      Parameters:
      frequencyVariable - variable name or null if no variable is used
    • getWhenExpression

      public Expression getWhenExpression()
      Returns the expression that controls output for use with the when-keyword.
      Returns:
      expression should be boolean result
    • getTimePeriodExpression

      public Expression getTimePeriodExpression()
      Returns the time period, or null if none provided.
      Returns:
      time period
    • getThenAssignments

      public List<Assignment> getThenAssignments()
      Returns the list of optional then-keyword variable assignments, if any
      Returns:
      list of variable assignments or null if none
    • addThenAssignment

      public OutputLimitClause addThenAssignment(Expression assignmentExpression)
      Adds a then-keyword variable assigment for use with the when-keyword.
      Parameters:
      assignmentExpression - expression to calculate new value
      Returns:
      clause
    • getCrontabAtParameters

      public Expression[] getCrontabAtParameters()
      Returns the crontab parameters, or null if not using crontab-like schedule.
      Returns:
      parameters
    • isAndAfterTerminate

      public boolean isAndAfterTerminate()
      Returns true for output upon termination of a context partition
      Returns:
      indicator
    • setAndAfterTerminate

      public void setAndAfterTerminate(boolean andAfterTerminate)
      Set true for output upon termination of a context partition
      Parameters:
      andAfterTerminate - indicator
    • toEPL

      public void toEPL(StringWriter writer)
      Renders the clause in textual representation.
      Parameters:
      writer - to output to
    • getAfterTimePeriodExpression

      public Expression getAfterTimePeriodExpression()
      Returns the after-keyword time period.
      Returns:
      after-keyword time period
    • setAfterTimePeriodExpression

      public void setAfterTimePeriodExpression(Expression afterTimePeriodExpression)
      Sets the after-keyword time period.
      Parameters:
      afterTimePeriodExpression - after-keyword time period
    • afterTimePeriodExpression

      public OutputLimitClause afterTimePeriodExpression(TimePeriodExpression afterTimePeriodExpression)
      Sets the after-keyword time period.
      Parameters:
      afterTimePeriodExpression - after-keyword time period
      Returns:
      clause
    • getAfterNumberOfEvents

      public Integer getAfterNumberOfEvents()
      Returns the after-keyword number of events, or null if undefined.
      Returns:
      num events for after-keyword
    • setFrequency

      public void setFrequency(Double frequency)
      Set frequency.
      Parameters:
      frequency - to set
    • setWhenExpression

      public void setWhenExpression(Expression whenExpression)
      Set when.
      Parameters:
      whenExpression - to set
    • setThenAssignments

      public void setThenAssignments(List<Assignment> thenAssignments)
      Set then.
      Parameters:
      thenAssignments - to set
    • setCrontabAtParameters

      public void setCrontabAtParameters(Expression[] crontabAtParameters)
      Crontab.
      Parameters:
      crontabAtParameters - to set
    • setTimePeriodExpression

      public void setTimePeriodExpression(Expression timePeriodExpression)
      Crontab
      Parameters:
      timePeriodExpression - to set
    • setAfterNumberOfEvents

      public void setAfterNumberOfEvents(Integer afterNumberOfEvents)
      Sets the after-keyword number of events, or null if undefined.
      Parameters:
      afterNumberOfEvents - set num events for after-keyword
    • afterNumberOfEvents

      public OutputLimitClause afterNumberOfEvents(Integer afterNumberOfEvents)
      Sets the after-keyword number of events, or null if undefined.
      Parameters:
      afterNumberOfEvents - set num events for after-keyword
      Returns:
      clause
    • getAndAfterTerminateAndExpr

      public Expression getAndAfterTerminateAndExpr()
      Returns the optional expression evaluated when a context partition terminates before triggering output.
      Returns:
      expression
    • setAndAfterTerminateAndExpr

      public void setAndAfterTerminateAndExpr(Expression andAfterTerminateAndExpr)
      Sets an optional expression evaluated when a context partition terminates before triggering output.
      Parameters:
      andAfterTerminateAndExpr - expression
    • getAndAfterTerminateThenAssignments

      public List<Assignment> getAndAfterTerminateThenAssignments()
      Returns the set-assignments to execute when a context partition terminates.
      Returns:
      set-assignments
    • setAndAfterTerminateThenAssignments

      public void setAndAfterTerminateThenAssignments(List<Assignment> andAfterTerminateThenAssignments)
      Sets the set-assignments to execute when a context partition terminates.
      Parameters:
      andAfterTerminateThenAssignments - set-assignments