コード例 #1
0
        /// <summary>Renders the clause in textual representation. </summary>
        /// <param name="writer">to output to</param>
        /// <param name="formatter">for NewLine-whitespace formatting</param>
        public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
        {
            foreach (OnInsertSplitStreamItem item in Items)
            {
                item.InsertInto.ToEPL(writer, formatter, true);
                item.SelectClause.ToEPL(writer, formatter, true, false);
                if (item.PropertySelects != null)
                {
                    writer.Write(" from ");
                    ContainedEventSelect.ToEPL(writer, formatter, item.PropertySelects);
                    if (item.PropertySelectsStreamName != null)
                    {
                        writer.Write(" as ");
                        writer.Write(item.PropertySelectsStreamName);
                    }
                }
                if (item.WhereClause != null)
                {
                    writer.Write(" where ");
                    item.WhereClause.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
                }
            }

            if (!IsFirst)
            {
                writer.Write(" output all");
            }
        }
コード例 #2
0
        public override void ToEPLStream(TextWriter writer, EPStatementFormatter formatter)
        {
            writer.Write("method:");
            writer.Write(ClassName);
            writer.Write(".");
            writer.Write(MethodName);
            writer.Write("(");

            string delimiter = "";

            foreach (Expression expr in ParameterExpressions)
            {
                writer.Write(delimiter);
                expr.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
                delimiter = ",";
            }
            writer.Write(")");

            if (OptionalEventTypeName != null)
            {
                writer.Write(" @Type(");
                writer.Write(OptionalEventTypeName);
                writer.Write(")");
            }
        }
コード例 #3
0
        /// <summary>Renders the clause in textual representation. </summary>
        /// <param name="writer">to output to</param>
        /// <param name="formatter">for NewLine-whitespace formatting</param>
        /// <param name="isTopLevel">to indicate if this insert-into-clause is inside other clauses.</param>
        public void ToEPL(TextWriter writer, EPStatementFormatter formatter, bool isTopLevel)
        {
            formatter.BeginInsertInto(writer, isTopLevel);
            writer.Write("insert ");
            if (StreamSelector != StreamSelector.ISTREAM_ONLY)
            {
                writer.Write(StreamSelector.GetEPL());
                writer.Write(" ");
            }

            writer.Write("into ");
            writer.Write(StreamName);

            if (ColumnNames.Count > 0)
            {
                writer.Write("(");
                String delimiter = "";
                foreach (var name in ColumnNames)
                {
                    writer.Write(delimiter);
                    writer.Write(name);
                    delimiter = ", ";
                }
                writer.Write(")");
            }
        }
コード例 #4
0
 /// <summary>Render as EPL. </summary>
 /// <param name="writer">to output to</param>
 /// <param name="formatter">formatter</param>
 public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
 {
     writer.Write("create context ");
     writer.Write(ContextName);
     writer.Write(" as ");
     Descriptor.ToEPL(writer, formatter);
 }
コード例 #5
0
ファイル: OnMergeClause.cs プロジェクト: valmac/nesper
        /// <summary>Renders the clause in textual representation. </summary>
        /// <param name="writer">to output to</param>
        /// <param name="optionalWhereClause">where clause if present, or null</param>
        /// <param name="formatter">for NewLine-whitespace formatting</param>
        public void ToEPL(TextWriter writer,
                          Expression optionalWhereClause,
                          EPStatementFormatter formatter)
        {
            formatter.BeginMerge(writer);
            writer.Write("merge ");
            writer.Write(WindowName);

            if (OptionalAsName != null)
            {
                writer.Write(" as ");
                writer.Write(OptionalAsName);
            }

            if (optionalWhereClause != null)
            {
                formatter.BeginMergeWhere(writer);
                writer.Write("where ");
                optionalWhereClause.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
            }

            foreach (OnMergeMatchItem item in MatchItems)
            {
                item.ToEPL(writer, formatter);
            }
        }
コード例 #6
0
        /// <summary>
        /// Rendering using the provided formatter.
        /// </summary>
        /// <param name="formatter">to use</param>
        /// <returns>rendered string</returns>
        public string ToEPL(EPStatementFormatter formatter)
        {
            var writer = new StringWriter();

            ToEPL(formatter, writer);
            return(writer.ToString());
        }
コード例 #7
0
 /// <summary>
 /// Returns the EPL.
 /// </summary>
 /// <param name="writer">to write to</param>
 /// <param name="formatter">for newline-whitespace formatting</param>
 public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
 {
     if (SelectClause != null)
     {
         SelectClause.ToEPL(writer, formatter, false, false);
         writer.Write(" from ");
     }
     SplitExpression.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
     if (OptionalSplitExpressionTypeName != null)
     {
         writer.Write("@Type(");
         writer.Write(OptionalSplitExpressionTypeName);
         writer.Write(")");
     }
     if (OptionalAsName != null)
     {
         writer.Write(" as ");
         writer.Write(OptionalAsName);
     }
     if (WhereClause != null)
     {
         writer.Write(" where ");
         WhereClause.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
     }
 }
コード例 #8
0
 public override void ToEPLStream(TextWriter writer, EPStatementFormatter formatter)
 {
     writer.Write("sql:");
     writer.Write(_databaseName);
     writer.Write("[\"");
     writer.Write(_sqlWithSubsParams);
     writer.Write("\"]");
 }
コード例 #9
0
 public void ToEPL(TextWriter writer,
                   EPStatementFormatter formatter)
 {
     writer.Write("group ");
     Expression.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
     writer.Write(" as ");
     writer.Write(Label);
 }
コード例 #10
0
 public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
 {
     if (HashFunction != null)
     {
         HashFunction.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
     }
     writer.Write(" from ");
     Filter.ToEPL(writer, formatter);
 }
コード例 #11
0
 public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
 {
     Filter.ToEPL(writer, formatter);
     if (OptionalAsName != null)
     {
         writer.Write(" as ");
         writer.Write(OptionalAsName);
     }
 }
コード例 #12
0
 /// <summary>
 /// RenderAny contained-event select
 /// </summary>
 /// <param name="writer">to render to</param>
 /// <param name="formatter">to use</param>
 /// <param name="items">to render</param>
 public static void ToEPL(TextWriter writer, EPStatementFormatter formatter, IList <ContainedEventSelect> items)
 {
     foreach (ContainedEventSelect propertySelect in items)
     {
         writer.Write('[');
         propertySelect.ToEPL(writer, formatter);
         writer.Write(']');
     }
 }
コード例 #13
0
 public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
 {
     if (IsNow)
     {
         writer.Write("@now and");
     }
     writer.Write("after ");
     TimePeriod.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
 }
コード例 #14
0
        public override void ToPrecedenceFreeEPL(TextWriter writer, EPStatementFormatter formatter)
        {
            String delimiter = "";

            foreach (PatternExpr child in Children)
            {
                writer.Write(delimiter);
                child.ToEPL(writer, Precedence, formatter);
                delimiter = " and ";
            }
        }
コード例 #15
0
        public override void ToPrecedenceFreeEPL(TextWriter writer, EPStatementFormatter formatter)
        {
            writer.Write("every ");
            PatternExprPrecedenceEnum precedence = Precedence;

            if (Children[0] is PatternEveryExpr)
            {
                precedence = PatternExprPrecedenceEnum.MAXIMIM;
            }
            Children[0].ToEPL(writer, precedence, formatter);
        }
コード例 #16
0
ファイル: Stream.cs プロジェクト: valmac/nesper
        /// <summary>Renders the clause in textual representation. </summary>
        /// <param name="writer">to output to</param>
        /// <param name="formatter">for NewLine-whitespace formatting</param>
        public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
        {
            ToEPLStream(writer, formatter);

            if (StreamName != null)
            {
                writer.Write(" as ");
                writer.Write(StreamName);
            }

            ToEPLStreamOptions(writer);
        }
コード例 #17
0
        public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
        {
            writer.Write("partition by ");
            String delimiter = "";

            foreach (ContextDescriptorKeyedSegmentedItem item in Items)
            {
                writer.Write(delimiter);
                item.ToEPL(writer, formatter);
                delimiter = ", ";
            }
        }
コード例 #18
0
        public override void ToPrecedenceFreeEPL(TextWriter writer, EPStatementFormatter formatter)
        {
            if ((Children == null) || (Children.Count == 0))
            {
                return;
            }
            PatternExpr patternExpr = Children[0];

            if (patternExpr != null)
            {
                patternExpr.ToEPL(writer, Precedence, formatter);
            }
        }
コード例 #19
0
        public void ToEPL(TextWriter writer,
                          EPStatementFormatter formatter)
        {
            String delimiter = "";

            foreach (String prop in PropertyNames)
            {
                writer.Write(delimiter);
                writer.Write(prop);
                delimiter = " and ";
            }
            writer.Write(" from ");
            Filter.ToEPL(writer, formatter);
        }
コード例 #20
0
        public void ToEPL(TextWriter writer,
                          EPStatementFormatter formatter)
        {
            String delimiter = "";

            foreach (ContextDescriptorCategoryItem item in Items)
            {
                writer.Write(delimiter);
                item.ToEPL(writer, formatter);
                delimiter = ", ";
            }
            writer.Write(" from ");
            Filter.ToEPL(writer, formatter);
        }
コード例 #21
0
 /// <summary>
 /// Returns a textual representation of the filter.
 /// </summary>
 /// <param name="writer">to output to</param>
 /// <param name="formatter">for newline-whitespace formatting</param>
 public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
 {
     writer.Write(EventTypeName);
     if (FilterExpression != null)
     {
         writer.Write('(');
         FilterExpression.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
         writer.Write(')');
     }
     if (OptionalPropertySelects != null)
     {
         ContainedEventSelect.ToEPL(writer, formatter, OptionalPropertySelects);
     }
 }
コード例 #22
0
        public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
        {
            String delimiter = "";

            foreach (CreateContextClause context in Contexts)
            {
                writer.Write(delimiter);
                writer.Write("context ");
                writer.Write(context.ContextName);
                writer.Write(" as ");
                context.Descriptor.ToEPL(writer, formatter);
                delimiter = ", ";
            }
        }
コード例 #23
0
        public override void ToPrecedenceFreeEPL(TextWriter writer, EPStatementFormatter formatter)
        {
            writer.Write("every-distinct(");
            String delimiter = "";

            foreach (Expression expr in Expressions)
            {
                writer.Write(delimiter);
                expr.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
                delimiter = ",";
            }
            writer.Write(") ");

            Children[0].ToEPL(writer, Precedence, formatter);
        }
コード例 #24
0
 /// <summary>
 /// Renders the expressions and all it's child expression, in full tree depth, as a string in language syntax.
 /// </summary>
 /// <param name="writer">is the output to use</param>
 /// <param name="formatter">for NewLine-whitespace formatting</param>
 public void ToPrecedenceFreeEPL(TextWriter writer, EPStatementFormatter formatter)
 {
     Children[0].ToEPL(writer, Precedence, formatter);
     if (GuardEnumExtensions.IsWhile(Namespace, Name))
     {
         writer.Write(" while (");
         Parameters[0].ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
         writer.Write(")");
     }
     else
     {
         writer.Write(" where ");
         base.ToEPL(writer);
     }
 }
コード例 #25
0
        public override void ToPrecedenceFreeEPL(TextWriter writer, EPStatementFormatter formatter)
        {
            if (Single != null)
            {
                writer.Write("[");
                Single.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
                writer.Write("]");
            }
            else
            {
                if (Low != null || High != null)
                {
                    writer.Write("[");
                    if ((Low != null) && (High != null))
                    {
                        Low.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
                        writer.Write(":");
                        High.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
                    }
                    else if (Low != null)
                    {
                        Low.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
                        writer.Write(":");
                    }
                    else
                    {
                        writer.Write(":");
                        High.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
                    }
                    writer.Write("] ");
                }
            }

            PatternExprPrecedenceEnum precedence = Precedence;

            if (Children[0] is PatternMatchUntilExpr)
            {
                precedence = PatternExprPrecedenceEnum.MAXIMIM;
            }
            Children[0].ToEPL(writer, precedence, formatter);

            if (Children.Count > 1)
            {
                writer.Write(" until ");
                Children[1].ToEPL(writer, Precedence, formatter);
            }
        }
コード例 #26
0
 public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
 {
     if (IsNow)
     {
         writer.Write("@now and");
     }
     writer.Write("pattern [");
     if (Pattern != null)
     {
         Pattern.ToEPL(writer, PatternExprPrecedenceEnum.MINIMUM, formatter);
     }
     writer.Write("]");
     if (IsInclusive)
     {
         writer.Write("@Inclusive");
     }
 }
コード例 #27
0
        public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
        {
            writer.Write("coalesce ");
            String delimiter = "";

            foreach (ContextDescriptorHashSegmentedItem item in Items)
            {
                writer.Write(delimiter);
                item.ToEPL(writer, formatter);
                delimiter = ", ";
            }
            writer.Write(" granularity ");
            writer.Write(Convert.ToString(Granularity));
            if (IsPreallocate)
            {
                writer.Write(" preallocate");
            }
        }
コード例 #28
0
 public override void ToEPLProjectedStream(TextWriter writer, EPStatementFormatter formatter)
 {
     writer.Write("pattern");
     if (Annotations != null)
     {
         foreach (var part in Annotations)
         {
             writer.Write(' ');
             part.ToEPL(writer);
         }
     }
     writer.Write(" [");
     if (Expression != null)
     {
         Expression.ToEPL(writer, PatternExprPrecedenceEnum.MINIMUM, formatter);
     }
     writer.Write(']');
 }
コード例 #29
0
ファイル: PatternFilterExpr.cs プロジェクト: valmac/nesper
 public override void ToPrecedenceFreeEPL(TextWriter writer, EPStatementFormatter formatter)
 {
     if (TagName != null)
     {
         writer.Write(TagName);
         writer.Write('=');
     }
     Filter.ToEPL(writer, formatter);
     if (OptionalConsumptionLevel != null)
     {
         writer.Write("@consume");
         if (OptionalConsumptionLevel != 1)
         {
             writer.Write("(");
             writer.Write(Convert.ToString(OptionalConsumptionLevel));
             writer.Write(")");
         }
     }
 }
コード例 #30
0
 public void ToEPL(TextWriter writer, EPStatementFormatter formatter)
 {
     writer.Write(IsOverlapping ? "initiated by " : "start ");
     if (_optionalDistinctExpressions != null && _optionalDistinctExpressions.Count > 0)
     {
         writer.Write("distinct(");
         String delimiter = "";
         foreach (Expression expression in _optionalDistinctExpressions)
         {
             writer.Write(delimiter);
             expression.ToEPL(writer, ExpressionPrecedenceEnum.MINIMUM);
             delimiter = ", ";
         }
         writer.Write(") ");
     }
     StartCondition.ToEPL(writer, formatter);
     writer.Write(" ");
     writer.Write(IsOverlapping ? "terminated " : "end ");
     EndCondition.ToEPL(writer, formatter);
 }