/// <summary> /// Renders the clause in textual representation. /// </summary> /// <param name="writer">to output to</param> public void ToEPL(TextWriter writer) { string delimiter; writer.Write(" match_recognize ("); if (PartitionExpressions.Count > 0) { delimiter = ""; writer.Write(" partition by "); foreach (Expression part in PartitionExpressions) { writer.Write(delimiter); part.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM); delimiter = ", "; } } delimiter = ""; writer.Write(" measures "); foreach (SelectClauseExpression part in Measures) { writer.Write(delimiter); part.ToEPLElement(writer); delimiter = ", "; } if (IsAll) { writer.Write(" all matches"); } if (SkipClause != MatchRecognizeSkipClause.PAST_LAST_ROW) { writer.Write(" after match skip " + SkipClause.GetText()); } writer.Write(" pattern ("); Pattern.WriteEPL(writer); writer.Write(")"); if ((IntervalClause != null) && (IntervalClause.Expression != null)) { writer.Write(" interval "); IntervalClause.Expression.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM); if (IntervalClause.IsOrTerminated) { writer.Write(" or terminated"); } } delimiter = ""; if (!Defines.IsEmpty()) { writer.Write(" define "); foreach (MatchRecognizeDefine def in Defines) { writer.Write(delimiter); writer.Write(def.Name); writer.Write(" as "); def.Expression.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM); delimiter = ", "; } } writer.Write(")"); }