/// <summary> /// Creates a new pattern with a register and adds an epsilon transition /// </summary> /// <typeparam name="TInput">The type of stream input data</typeparam> /// <typeparam name="TRegister">The type of the register to be mutated as transitions occur</typeparam> /// <returns>A pattern whose first transition is the one just created</returns> public static Afa <TInput, TRegister, bool> Epsilon <TInput, TRegister>() { var afa = Afa.Create <TInput, TRegister>(); afa.AddArc(0, 1, new EpsilonArc <TInput, TRegister> { }); afa.Seal(); return(afa); }
/// <summary> /// Creates a new pattern without a register and adds an epsilon transition /// </summary> /// <typeparam name="TInput">The type of stream input data</typeparam> /// <returns>A pattern whose first transition is the one just created</returns> public static Afa <TInput, Empty, bool> Epsilon <TInput>() { var afa = Afa.Create <TInput>(); afa.AddArc(0, 1, new EpsilonArc <TInput, Empty> { }); afa.Seal(); return(afa); }
/// <summary> /// Creates a new pattern with a register and adds a time-synchronous list transition that succeeds on event lists that match a condition /// </summary> /// <typeparam name="TInput">The type of stream input data</typeparam> /// <typeparam name="TRegister">The type of the register to be mutated as transitions occur</typeparam> /// <param name="condition">The time-sensitive, register-value sensitive condition that must be met to consider the transition satisfied</param> /// <param name="aggregator">A time-sensitive aggregator mutator that updates the value of the register</param> /// <returns>A pattern with an updatable register whose first transition is the one just created</returns> public static Afa <TInput, TRegister, bool> ListElement <TInput, TRegister>(Expression <Func <long, List <TInput>, TRegister, bool> > condition, Expression <Func <long, List <TInput>, TRegister, TRegister> > aggregator) { var afa = Afa.Create <TInput, TRegister>(); afa.AddArc(0, 1, new ListElementArc <TInput, TRegister> { Fence = condition, Transfer = aggregator }); afa.Seal(); return(afa); }
/// <summary> /// Creates a new pattern with a register and adds a single-element transition that succeeds on every stream element seen /// </summary> /// <typeparam name="TInput">The type of stream input data</typeparam> /// <typeparam name="TRegister">The type of the register to be mutated as transitions occur</typeparam> /// <returns>A pattern with an updatable register whose first transition is the one just created</returns> public static Afa <TInput, TRegister, bool> SingleElement <TInput, TRegister>() { var afa = Afa.Create <TInput, TRegister>(); afa.AddArc(0, 1, new SingleElementArc <TInput, TRegister> { Fence = (ts, ev, r) => true }); afa.Seal(); return(afa); }
/// <summary> /// Creates a new pattern without a register and adds a time-synchronous list transition that succeeds on every list of events seen /// </summary> /// <typeparam name="TInput">The type of stream input data</typeparam> /// <returns>A pattern whose first transition is the one just created</returns> public static Afa <TInput, Empty, bool> ListElement <TInput>() { var afa = Afa.Create <TInput>(); afa.AddArc(0, 1, new ListElementArc <TInput, Empty> { Fence = (ts, ev, r) => true }); afa.Seal(); return(afa); }
/// <summary> /// Creates a new pattern with a register and adds a single-element transition that succeeds on stream elements that match a condition /// </summary> /// <typeparam name="TInput">The type of stream input data</typeparam> /// <typeparam name="TRegister">The type of the register to be mutated as transitions occur</typeparam> /// <param name="condition">The time-sensitive, register-value sensitive condition that must be met to consider the transition satisfied</param> /// <returns>A pattern with an updatable register whose first transition is the one just created</returns> public static Afa <TInput, TRegister, bool> SingleElement <TInput, TRegister>(Expression <Func <long, TInput, TRegister, bool> > condition) { var afa = Afa.Create <TInput, TRegister>(); afa.AddArc(0, 1, new SingleElementArc <TInput, TRegister> { Fence = condition }); afa.Seal(); return(afa); }
/// <summary> /// Creates a new pattern with a register and adds a single-element transition that succeeds on stream elements that match a condition /// </summary> /// <typeparam name="TInput">The type of stream input data</typeparam> /// <typeparam name="TRegister">The type of the register to be mutated as transitions occur</typeparam> /// <param name="condition">The condition that must be met to consider the transition satisfied</param> /// <returns>A pattern with an updatable register whose first transition is the one just created</returns> public static Afa <TInput, TRegister, bool> SingleElement <TInput, TRegister>(Expression <Func <TInput, bool> > condition) { var afa = Afa.Create <TInput, TRegister>(); Expression <Func <long, TInput, TRegister, bool> > template = (ts, ev, r) => CallInliner.Call(condition, ev); afa.AddArc(0, 1, new SingleElementArc <TInput, TRegister> { Fence = template.InlineCalls() }); afa.Seal(); return(afa); }
/// <summary> /// Creates a new pattern with a register and adds a time-synchronous list transition that succeeds on event lists that match a condition /// </summary> /// <typeparam name="TInput">The type of stream input data</typeparam> /// <typeparam name="TRegister">The type of the register to be mutated as transitions occur</typeparam> /// <param name="condition">The time-sensitive, register-value sensitive condition that must be met to consider the transition satisfied</param> /// <param name="aggregator">An aggregator mutator that updates the value of the register</param> /// <returns>A pattern with an updatable register whose first transition is the one just created</returns> public static Afa <TInput, TRegister, bool> ListElement <TInput, TRegister>(Expression <Func <long, List <TInput>, TRegister, bool> > condition, Expression <Func <List <TInput>, TRegister, TRegister> > aggregator) { var afa = Afa.Create <TInput, TRegister>(); Expression <Func <long, List <TInput>, TRegister, TRegister> > aggregatorTemplate = (ts, ev, reg) => CallInliner.Call(aggregator, ev, reg); afa.AddArc(0, 1, new ListElementArc <TInput, TRegister> { Fence = condition, Transfer = aggregatorTemplate.InlineCalls(), }); afa.Seal(); return(afa); }
/// <summary> /// Creates a new pattern without a register and adds a time-synchronous list transition that succeeds on event lists that match a condition /// </summary> /// <typeparam name="TInput">The type of stream input data</typeparam> /// <param name="condition">The condition that must be met to consider the transition satisfied</param> /// <returns>A pattern whose first transition is the one just created</returns> public static Afa <TInput, Empty, bool> ListElement <TInput>(Expression <Func <List <TInput>, bool> > condition) { var afa = Afa.Create <TInput>(); Expression <Func <long, List <TInput>, Empty, bool> > template = (ts, ev, r) => CallInliner.Call(condition, ev); afa.AddArc(0, 1, new ListElementArc <TInput, Empty> { Fence = template.InlineCalls() }); afa.Seal(); return(afa); }