예제 #1
0
 private Braid(string name, BraidLinkDiscriminators discriminators, ChainBuilder chainBuilder, int addThreshold)
 {
     Name            = name;
     _discriminators = discriminators;
     _chainBuilder   = chainBuilder;
     _addThreshold   = addThreshold;
 }
예제 #2
0
 private BraidBuilder(string name, BraidLinkDiscriminators discriminators, ChainBuilder chainBuilder, LongitudinalEvaluators evaluators, int addThreshold)
 {
     Name = name;
     this._discriminators = discriminators;
     this._chainBuilder   = chainBuilder;
     _evaluators          = evaluators;
     this._addThreshold   = addThreshold;
 }
예제 #3
0
        internal static Braid Build(string name, BraidLinkDiscriminators discriminators, ChainBuilder chainBuilder, int addThreshold = 1)
        {
            var braid = new Braid(name, discriminators, chainBuilder, addThreshold);

            chainBuilder.AddBraid(braid);

            chainBuilder.AcceptAddChainAction(braid._chains.ContainsKey, braid._chains.Add, x => braid._chains[x]);

            // wire up async here
            var subscription = braid._chainBuilderSubject.Subscribe(x =>
            {
                var discriminationResult = braid._discriminators.Discriminate(x);

                if (discriminationResult >= braid._addThreshold)
                {
                    braid._chainBuilder.Accept(x);
                }
            });

            braid._subscription = subscription;

            return(braid);
        }
예제 #4
0
        public static BraidBuilder Build(string name, BraidLinkDiscriminators discriminators, ChainBuilder chainBuilder, LongitudinalEvaluators evaluators, int addThreshold = 1)
        {
            var braidBuilder = new BraidBuilder(name, discriminators, chainBuilder, evaluators, addThreshold);

            return(braidBuilder);
        }