示例#1
0
 private Chain(ChainIdentity chainIdentity, Braid braid, LongitudinalEvaluators longitudinalEvaluators, LongitudinalEvaluations evaluations)
 {
     _longitudinalEvaluators = longitudinalEvaluators;
     _evaluations            = evaluations;
     ChainIdentity           = chainIdentity;
     Braid = braid;
 }
示例#2
0
        public static Chain Build(ChainIdentity chainIdentity, Braid braid, LongitudinalEvaluators longitudinalEvaluators)
        {
            var evaluations = new LongitudinalEvaluations();

            longitudinalEvaluators.SetEvaluationDestination(evaluations);

            return(new Chain(chainIdentity, braid, longitudinalEvaluators, evaluations));
        }
示例#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
 internal void AddBraid(Braid braid)
 {
     _braid = braid;
 }
示例#5
0
        public Braid BuildBraid(Trunk trunk)
        {
            var braid = Braid.Build(Name, _discriminators, _chainBuilder, _addThreshold);

            return(braid);
        }