Example #1
0
        private SuspendableEventsComposite CreateSuspender()
        {
            var s = new SuspendableEventsComposite();

            s.Add(_viewProvider.Suspender);
            return(s);
        }
Example #2
0
        /// <summary>
        /// Creates an <see cref="ICalculator"/>.
        /// </summary>
        public static ICalculator CreateCalculator()
        {
            var innerNodeFactory       = new NodeFactory();
            var nodeFactory            = new TransformableNodeFactory(innerNodeFactory, v => new TransformableValue(v));
            var statRegistryCollection = new NodeCollection <IStat>();
            var statRegistry           = new StatRegistry(statRegistryCollection);
            var valueTransformer       = new ValueTransformer();

            var prunableGraph = CreateCalculationGraph(nodeFactory, statRegistry, valueTransformer);

            var defaultView     = new DefaultViewNodeRepository(prunableGraph);
            var suspendableView = new SuspendableViewNodeRepository(prunableGraph);

            innerNodeFactory.NodeRepository = defaultView;
            statRegistry.NodeRepository     = suspendableView;

            var suspender = new SuspendableEventsComposite();

            suspender.Add(new StatGraphCollectionSuspender(prunableGraph));
            suspender.Add(statRegistryCollection);

            return(new Calculator(suspender, prunableGraph, prunableGraph, suspendableView, statRegistryCollection));
        }