Esempio n. 1
0
 /// <summary>Ctor. </summary>
 /// <param name="selector">is the events to select</param>
 /// <param name="unit">the unit of selection</param>
 /// <param name="afterTimePeriod">after-keyword time period</param>
 /// <param name="afterNumberOfEvents">after-keyword number of events</param>
 public OutputLimitClause(
     OutputLimitSelector selector,
     OutputLimitUnit unit,
     TimePeriodExpression afterTimePeriod,
     int?afterNumberOfEvents)
 {
     Selector = selector;
     Unit     = unit;
     AfterTimePeriodExpression = afterTimePeriod;
     AfterNumberOfEvents       = afterNumberOfEvents;
 }
Esempio n. 2
0
 /// <summary>Creates an output limit clause. </summary>
 /// <param name="selector">is the events to select</param>
 /// <param name="timePeriodExpression">a frequency to output at</param>
 /// <returns>clause</returns>
 public static OutputLimitClause Create(OutputLimitSelector selector, TimePeriodExpression timePeriodExpression)
 {
     return(new OutputLimitClause(selector, timePeriodExpression));
 }
Esempio n. 3
0
 /// <summary>Create with after-only time period. </summary>
 /// <param name="afterTimePeriodExpression">time period</param>
 /// <returns>clause</returns>
 public static OutputLimitClause CreateAfter(TimePeriodExpression afterTimePeriodExpression)
 {
     return(new OutputLimitClause(
                OutputLimitSelector.DEFAULT, OutputLimitUnit.AFTER, afterTimePeriodExpression, null));
 }
Esempio n. 4
0
        /// <summary>Renders the clause in textual representation. </summary>
        /// <param name="writer">to output to</param>
        public void ToEPL(TextWriter writer)
        {
            if (AfterTimePeriodExpression != null)
            {
                writer.Write("after ");
                AfterTimePeriodExpression.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
                writer.Write(" ");
            }
            else if ((AfterNumberOfEvents != null) && (AfterNumberOfEvents != 0))
            {
                writer.Write("after ");
                writer.Write(Convert.ToString(AfterNumberOfEvents));
                writer.Write(" events ");
            }

            if (Selector != OutputLimitSelector.DEFAULT)
            {
                writer.Write(Selector.GetText());
                writer.Write(" ");
            }
            if (Unit == OutputLimitUnit.WHEN_EXPRESSION)
            {
                writer.Write("when ");
                WhenExpression.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);

                if ((ThenAssignments != null) && (ThenAssignments.Count > 0))
                {
                    WriteThenAssignments(writer, ThenAssignments);
                }
            }
            else if (Unit == OutputLimitUnit.CRONTAB_EXPRESSION)
            {
                writer.Write("at (");
                String delimiter = "";
                for (int i = 0; i < CrontabAtParameters.Length; i++)
                {
                    writer.Write(delimiter);
                    CrontabAtParameters[i].ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
                    delimiter = ", ";
                }
                writer.Write(")");
            }
            else if (Unit == OutputLimitUnit.TIME_PERIOD && TimePeriodExpression != null)
            {
                writer.Write("every ");
                TimePeriodExpression.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
            }
            else if (Unit == OutputLimitUnit.AFTER)
            {
                // no action required
            }
            else if (Unit == OutputLimitUnit.CONTEXT_PARTITION_TERM)
            {
                writer.Write("when terminated");
                OutputAndAfter(writer);
            }
            else
            {
                writer.Write("every ");
                if (FrequencyVariable == null)
                {
                    writer.Write(Convert.ToString(Frequency.AsInt()));
                }
                else
                {
                    writer.Write(FrequencyVariable);
                }
                writer.Write(" events");
            }

            if (IsAndAfterTerminate)
            {
                writer.Write(" and when terminated");
                OutputAndAfter(writer);
            }
        }
Esempio n. 5
0
 /// <summary>Ctor. </summary>
 /// <param name="afterTimePeriodExpression">timer period for after.</param>
 public OutputLimitClause(TimePeriodExpression afterTimePeriodExpression)
 {
     Unit = OutputLimitUnit.AFTER;
     AfterTimePeriodExpression = afterTimePeriodExpression;
 }
Esempio n. 6
0
 /// <summary>Ctor. </summary>
 /// <param name="selector">is the events to select</param>
 /// <param name="timePeriodExpression">the unit for the frequency</param>
 public OutputLimitClause(OutputLimitSelector selector, TimePeriodExpression timePeriodExpression)
 {
     Selector             = selector;
     TimePeriodExpression = timePeriodExpression;
     Unit = OutputLimitUnit.TIME_PERIOD;
 }
Esempio n. 7
0
 /// <summary>Ctor. </summary>
 /// <param name="expression">interval expression</param>
 /// <param name="orTerminated">indicator whether or-terminated</param>
 public MatchRecognizeIntervalClause(TimePeriodExpression expression, bool orTerminated)
 {
     Expression     = expression;
     IsOrTerminated = orTerminated;
 }