Example #1
0
        static string Interface(int n)
        {
            return($@"
    public interface {_IStrongFlow}{(n > 0 ? "<" : "")}{GenericTs(n)}{(n > 0 ? ">" : "")} : {_IHack}<{_StrongFlow}{(n > 0 ? "<" : "")}{GenericTs(n)}{(n > 0 ? ">" : "")}, {_StrongFlow}{(n > 0 ? "<" : "")}{GenericTs(n)}{(n > 0 ? ">" : "")}>
    {{
    }}
");
        }
Example #2
0
        public static string PackedUpdate(int n, int funcIn, int funcOut)
        {
            return($@"
        public static {_IStrongFlow}<{GenericTs(n)}> {nameof(PackedUpdate)}<T{_StrongFlow}{(n == 0 ? "" : ", ")}{GenericTs(n)}{(funcIn == 0 ? "" : ", ")}{GenericTIns(funcIn)}{(funcOut == 0 ? "" : ", ")}{GenericTOuts(funcOut)}>(this {_IHack}<{_StrongFlow}{(n != 0 ? "<" : "")}{GenericTs(n)}{(n != 0 ? ">" : "")}, T{_StrongFlow}> self, Func<{GenericTIns(funcIn)}{(funcIn == 0 ? "" : ", ")}({GenericTOuts(funcOut)})> func)
            where T{_StrongFlow} : {_StrongFlow}{(n != 0 ? "<" : "")}{GenericTs(n)}{(n != 0 ? ">" : "")} {Holds(funcIn)} {HoldsOut(funcOut)}
        {{
            self.{_AddStepPacked}<{GenericTOuts(funcOut)}>(func);
            return new {_StrongFlow}<{GenericTs(n)}>(({_StrongFlowBase})self);
        }}
");
        }
Example #3
0
        public static string Update(int n, int funcIn)
        {
            return($@"
        public static {_IStrongFlow}<{GenericTs(n)}> {nameof(Update)}<T{_StrongFlow}{(n == 0 ? "" : ", ")}{GenericTs(n)}{(funcIn == 0 ? "" : ",")}{GenericTIns(funcIn)}, TOut>(this {_IHack}<{_StrongFlow}{(n != 0 ? "<" : "")}{GenericTs(n)}{(n != 0 ? ">" : "")}, T{_StrongFlow}> self, Func<{GenericTIns(funcIn) + (funcIn == 0 ? "" : ", ") }TOut> func)
            where T{_StrongFlow} : {_StrongFlow}{(n != 0 ? "<" : "")}{GenericTs(n)}{(n != 0 ? ">" : "")} {Holds(funcIn)}, {_IHold}<TOut>
        {{
            self.{_AddStep}(func);
            return new {_StrongFlow}<{GenericTs(n)}>(({_StrongFlowBase})self);
        }}
");
        }
Example #4
0
        static string Class(int n)
        {
            var baseName = $"{_StrongFlowBase}{(n > 0 ? "<" : "")}{GenericTs(n)}{(n > 0 ? ">" : "")}";
            var typeName = $"{_StrongFlow}{(n > 0 ? "<" : "")}{GenericTs(n)}{(n > 0 ? ">" : "")}";

            return($@"
    public class {typeName} : {baseName}, {_IStrongFlow}<{GenericTs(n)}>
    {{
        public {_StrongFlow}({_StrongFlowBase} backing): base(backing) {{
        }}
        public {_StrongFlow}({Parameters(n)}): base(new {_FlowBuilderType}()) {{
{Set(n)}
        }}
    }}
");
        }
Example #5
0
        static string BaseClass(int n)
        {
            var typeName = $"{_StrongFlowBase}<{GenericTs(n)}>";

            return($@"
    public class {typeName} : {_StrongFlowBase}{(n - 1 > 0 ? "<" : "")}{GenericTs(n - 1)}{(n - 1 > 0 ? ">" : "")}, {_IHold}<T{n}>
    {{
        public {_StrongFlowBase}({_StrongFlowBase} backing) : base(backing)
        {{
        }}

        protected {_StrongFlowBase}({_FlowBuilderType} flowBuilder) : base(flowBuilder)
        {{
        }}
    }}
");
        }