public DependenciesSnapshotProvider(
            IUnconfiguredProjectCommonServices commonServices,
            Lazy <AggregateCrossTargetProjectContextProvider> contextProvider,
            IUnconfiguredProjectTasksService tasksService,
            IActiveConfiguredProjectSubscriptionService activeConfiguredProjectSubscriptionService,
            IActiveProjectConfigurationRefreshService activeProjectConfigurationRefreshService,
            ITargetFrameworkProvider targetFrameworkProvider)
            : base(commonServices.ThreadingService.JoinableTaskContext)
        {
            _commonServices = commonServices;
            _tasksService   = tasksService;
            _activeConfiguredProjectSubscriptionService = activeConfiguredProjectSubscriptionService;
            _targetFrameworkProvider = targetFrameworkProvider;

            _dependencySubscribers = new OrderPrecedenceImportCollection <IDependencyCrossTargetSubscriber>(
                projectCapabilityCheckProvider: commonServices.Project);

            _snapshotFilters = new OrderPrecedenceImportCollection <IDependenciesSnapshotFilter>(
                ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesLast,
                projectCapabilityCheckProvider: commonServices.Project);

            _subTreeProviders = new OrderPrecedenceImportCollection <IProjectDependenciesSubTreeProvider>(
                ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesLast,
                projectCapabilityCheckProvider: commonServices.Project);

            _context = new ContextTracker(targetFrameworkProvider, commonServices, contextProvider, activeProjectConfigurationRefreshService);

            _snapshot = new SnapshotUpdater(commonServices.ThreadingService, tasksService.UnloadCancellationToken);

            _disposables = new DisposableBag {
                _snapshot, _contextUpdateGate
            };
        }
 protected override void BeginProcessing()
 {
     if (this.encoding != null)
     {
         this.textEncoding = EncodingConversion.Convert(this, this.encoding);
     }
     else
     {
         this.textEncoding = new UTF8Encoding();
     }
     if (!this.simpleMatch)
     {
         RegexOptions options = this.caseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase;
         this.regexPattern = new Regex[this.pattern.Length];
         for (int i = 0; i < this.pattern.Length; i++)
         {
             try
             {
                 this.regexPattern[i] = new Regex(this.pattern[i], options);
             }
             catch (Exception exception)
             {
                 base.ThrowTerminatingError(BuildErrorRecord(MatchStringStrings.InvalidRegex, this.pattern[i], exception.Message, "InvalidRegex", exception));
                 throw;
             }
         }
     }
     this.globalContextTracker = new ContextTracker(this.preContext, this.postContext);
 }
        public void TestInit1()
        {
            var context = new PhysicalContext <int>(0.1, 1);
            var entity  = new PointMass(new AxisStatus(1, 3), new AxisStatus(0, 0), new AxisStatus(0, 0), 1);

            context.AddEntity(0, entity);

            var tracker = new ContextTracker <int, double>(context, c => c[0].X.Position);

            AreEqual(1, tracker[0]);
            AreEqual(0ul, tracker.ObservationBeginTick);
            ThrowsException <ArgumentOutOfRangeException>(() => tracker[2]);

            context.Tick(0.5);
            AreEqual(1, tracker[0]);
            var pos05 = context[0].X.Position;

            AreEqual(pos05, tracker[5]);
            AreEqual(pos05, tracker.GetApproximately(0.5));

            context.Tick(0.5);
            AreEqual(1, tracker[0]);
            AreEqual(pos05, tracker.GetApproximately(0.5));
            AreEqual(pos05, tracker.GetApproximately(0.478));
            AreEqual(pos05, tracker.GetApproximately(0.505));
            AreEqual(context[0].X.Position, tracker[context.Ticks]);
        }
        public void TestDispose()
        {
            var context = new PhysicalContext <int>(0.1, 2);
            var entity  = new PointMass(0, 0, 0, 1);

            context.AddEntity(0, entity, c => new Force(1, 0, 0));
            context.AddEntity(1, entity, c => new Force(1, 0, 0));

            context.Tick(1);

            var tracker = new ContextTracker <int, int>(context, c => (int)Math.Round(c[0].X.Velocity + c[1].X.Velocity));

            AreEqual(2, tracker[context.Ticks]);
            AreEqual(10ul, tracker.ObservationBeginTick);
            ThrowsException <ArgumentOutOfRangeException>(() => tracker.GetApproximately(0));
            ThrowsException <ArgumentOutOfRangeException>(() => tracker.GetApproximately(2));

            context.Tick(1);
            AreEqual(2, tracker.GetApproximately(1));
            AreEqual(1, tracker.ObservationBeginTime);
            AreEqual(4, tracker[context.Ticks]);
            AreEqual(20ul, tracker.LastObservedTick);

            tracker.Dispose();

            context.Tick(1);
            AreEqual(20ul, tracker.LastObservedTick);
            ThrowsException <ArgumentOutOfRangeException>(() => tracker[context.Ticks]);
        }
Exemple #5
0
        public void Execute(object book)
        {
            Book bookModel = Mapper.Instance.Map <Book>(book);

            bookModel.Id = Guid.NewGuid();
            ContextTracker.AttackBookRelatedEntries(bookModel);
            ApplicationDbContext.Instance.Entry(bookModel).State = EntityState.Added;
            ApplicationDbContext.Instance.SaveChanges();
            ApplicationDbContext.Instance.ChangeTracker.Clear();
        }
        public void Execute(object book)
        {
            Book bookModel = Mapper.Instance.Map <Book>(book);

            ContextTracker.AttackBookRelatedEntries(bookModel);
            var bookFromDb = ApplicationDbContext.Instance.Books
                             .Include(a => a.Authors)
                             .Include(a => a.Categories)
                             .Include(a => a.PublishingHouse)
                             .Include(a => a.Series)
                             .Include(a => a.StoragePlace)
                             .Single(a => a.Id == bookModel.Id);

            Mapper.Instance.Map(bookModel, bookFromDb);

            ApplicationDbContext.Instance.SaveChanges();
        }
        public void TestStoryboard()
        {
            var context = new PhysicalContext <int>(1, 1);
            var entity  = new PointMass(new AxisStatus(0, 1), new AxisStatus(1, 0), new AxisStatus(0, 0), 1);

            context.AddEntity(0, entity);

            var tracker = new ContextTracker <int, double>(context, c => c[0].X.Position);

            AreEqual(1, tracker.Count);
            IsTrue(tracker.Keys.Contains <ulong>(0));

            context.Tick();
            AreEqual(2, tracker.Count);
            IsTrue(tracker.Keys.Contains <ulong>(0));
            IsTrue(tracker.Keys.Contains <ulong>(1));
            IsFalse(tracker.Keys.Contains <ulong>(2));
        }
        public void TestInterval()
        {
            ulong[] intervals = { 1, 3, 11, 100 };
            foreach (var i in intervals)
            {
                var context = new PhysicalContext <int>(1, 1);
                var entity  = new PointMass(new AxisStatus(0, 1), new AxisStatus(1, 0), new AxisStatus(0, 0), 1);
                context.AddEntity(0, entity);

                var tracker = new ContextTracker <int, double>(context, c => c[0].X.Position, i);

                context.Tick(42);
                AreEqual((int)(42 / i + 1), tracker.Count);
                AreEqual(42 - 42 % i, tracker.LastRecordTick);
                ThrowsException <ArgumentOutOfRangeException>(() => tracker[43]);
                if (i > 1)
                {
                    ThrowsException <ArgumentOutOfRangeException>(() => tracker[i + 1]);
                }

                var noException = tracker[0];
            }
        }
 private bool FlushTrackerQueue(ContextTracker contextTracker)
 {
     if (contextTracker.EmitQueue.Count < 1)
     {
         return(false);
     }
     if (this.quiet && !this.list)
     {
         base.WriteObject(true);
     }
     else if (this.list)
     {
         base.WriteObject(contextTracker.EmitQueue[0]);
     }
     else
     {
         foreach (MatchInfo info in contextTracker.EmitQueue)
         {
             base.WriteObject(info);
         }
     }
     contextTracker.EmitQueue.Clear();
     return(true);
 }
        private bool doMatch(object operand, out MatchInfo matchResult, out string operandString)
        {
            bool success = false;

            Match[] array = null;
            int     index = 0;

            matchResult = null;
            MatchInfo info = operand as MatchInfo;

            if (info != null)
            {
                operandString = info.Line;
                if ((this.preContext > 0) || (this.postContext > 0))
                {
                    this.preContext           = 0;
                    this.postContext          = 0;
                    this.globalContextTracker = new ContextTracker(this.preContext, this.postContext);
                    this.WarnFilterContext();
                }
            }
            else
            {
                operandString = (string)LanguagePrimitives.ConvertTo(operand, typeof(string), CultureInfo.InvariantCulture);
            }
            if (!this.simpleMatch)
            {
                while (index < this.pattern.Length)
                {
                    Regex regex = this.regexPattern[index];
                    if (this.allMatches && !this.notMatch)
                    {
                        MatchCollection matchs = regex.Matches(operandString);
                        if ((matchs != null) && (matchs.Count > 0))
                        {
                            array = new Match[matchs.Count];
                            matchs.CopyTo(array, 0);
                            success = true;
                        }
                    }
                    else
                    {
                        Match match = regex.Match(operandString);
                        success = match.Success;
                        if (match.Success)
                        {
                            array = new Match[] { match };
                        }
                    }
                    if (success)
                    {
                        break;
                    }
                    index++;
                }
            }
            else
            {
                StringComparison comparisonType = this.caseSensitive ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;
                while (index < this.pattern.Length)
                {
                    string str = this.pattern[index];
                    if (operandString.IndexOf(str, comparisonType) >= 0)
                    {
                        success = true;
                        break;
                    }
                    index++;
                }
            }
            if (this.notMatch)
            {
                success = !success;
                index   = 0;
            }
            if (!success)
            {
                return(false);
            }
            if (info != null)
            {
                if (info.Context != null)
                {
                    matchResult = info.Clone();
                    matchResult.Context.DisplayPreContext  = new string[0];
                    matchResult.Context.DisplayPostContext = new string[0];
                }
                else
                {
                    matchResult = info;
                }
                return(true);
            }
            matchResult            = new MatchInfo();
            matchResult.IgnoreCase = !this.caseSensitive;
            matchResult.Line       = operandString;
            matchResult.Pattern    = this.pattern[index];
            if ((this.preContext > 0) || (this.postContext > 0))
            {
                matchResult.Context = new MatchInfoContext();
            }
            matchResult.Matches = (array != null) ? array : new Match[0];
            return(true);
        }
        private bool ProcessFile(string filename)
        {
            ContextTracker contextTracker = new ContextTracker(this.preContext, this.postContext);
            bool           flag           = false;

            try
            {
                if (!this.meetsIncludeExcludeCriteria(filename))
                {
                    return(false);
                }
                using (FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    using (StreamReader reader = new StreamReader(stream, this.textEncoding))
                    {
                        string str;
                        int    num = 0;
                        while ((str = reader.ReadLine()) != null)
                        {
                            num++;
                            MatchInfo matchResult   = null;
                            string    operandString = null;
                            if (this.doMatch(str, out matchResult, out operandString))
                            {
                                matchResult.Path       = filename;
                                matchResult.LineNumber = num;
                                contextTracker.TrackMatch(matchResult);
                            }
                            else
                            {
                                contextTracker.TrackLine(str);
                            }
                            if (contextTracker.EmitQueue.Count > 0)
                            {
                                flag = true;
                                if (this.quiet || this.list)
                                {
                                    goto Label_00C9;
                                }
                                this.FlushTrackerQueue(contextTracker);
                            }
                        }
                    }
                }
Label_00C9:
                contextTracker.TrackEOF();
                if (this.FlushTrackerQueue(contextTracker))
                {
                    flag = true;
                }
            }
            catch (NotSupportedException exception)
            {
                base.WriteError(BuildErrorRecord(MatchStringStrings.FileReadError, filename, exception.Message, "ProcessingFile", exception));
            }
            catch (IOException exception2)
            {
                base.WriteError(BuildErrorRecord(MatchStringStrings.FileReadError, filename, exception2.Message, "ProcessingFile", exception2));
            }
            catch (SecurityException exception3)
            {
                base.WriteError(BuildErrorRecord(MatchStringStrings.FileReadError, filename, exception3.Message, "ProcessingFile", exception3));
            }
            catch (UnauthorizedAccessException exception4)
            {
                base.WriteError(BuildErrorRecord(MatchStringStrings.FileReadError, filename, exception4.Message, "ProcessingFile", exception4));
            }
            return(flag);
        }
Exemple #12
0
        private async void EvalButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SetPanelEnablity(false);
                _isCancelationRequested = false;

                var k            = double.Parse(kValBox.Text);
                var alpha        = double.Parse(alphaValueBox.Text);
                var dt           = double.Parse(dtBox.Text);
                var timeSpan     = double.Parse(timeSpanBox.Text);
                var planetRadius = double.Parse(planetRadiusBox.Text);

                var interval         = ulong.Parse(renderingIntervalBox.Text);
                var progressBarSteps = uint.Parse(progressBarStepsBox.Text);

                var context = new PhysicalContext <Entities>(timePerTick: dt, capacity: 2);
                context.AddEntity
                (
                    Entities.Planet,
                    new PointMass(0, 0, 0, 1)
                );
                context.AddEntity
                (
                    Entities.Ship,
                    new PointMass
                    (
                        new AxisStatus(double.Parse(xPosBox.Text), double.Parse(xVelBox.Text)),
                        new AxisStatus(double.Parse(yPosBox.Text), double.Parse(yVelBox.Text)),
                        new AxisStatus(),
                        1
                    ),
                    c => ModifiedGravityLaw <Entities>(c[Entities.Ship], c[Entities.Planet], alpha, k)
                );

                var xTracker = new ContextTracker <Entities, double>(context, c => c[Entities.Ship].X.Position, interval);
                var yTracker = new ContextTracker <Entities, double>(context, c => c[Entities.Ship].Y.Position, interval);

                var progress = ContextProgressTracker <Entities> .FromTime
                               (
                    context,
                    timeSpan,
                    Enumerable.Range(1, (int)progressBarSteps).Select(i => timeSpan *i / progressBarSteps).ToArray()
                               );

                progress.OnCheckPoint += (c, _) => Dispatcher.Invoke(() => progressBar.Value = progress.Progress);

                bool isSuccesful = await Task.Run
                                   (
                    () => context.Tick
                    (
                        timeSpan,
                        c =>
                        !_isCancelationRequested &&
                        (
                            c[Entities.Ship].X.Position *c[Entities.Ship].X.Position +
                            c[Entities.Ship].Y.Position *c[Entities.Ship].Y.Position >=
                            planetRadius *planetRadius
                        ),
                        false
                    )
                                   );

                if (!isSuccesful && !_isCancelationRequested)
                {
                    Task.Run(() => MessageBox.Show($"Ship has crashed at {context.Timer}"));
                }

                var title = $"Start position = ({xPosBox.Text}; {yPosBox.Text})\n" +
                            $"Start velocity = ({xVelBox.Text}; {yVelBox.Text})\n" +
                            $"dt = {dtBox.Text}, K = {kValBox.Text}, Alpha = {alphaValueBox.Text}";

                var xSeries = new LineSeries()
                {
                    CanTrackerInterpolatePoints = false,
                    Title = title
                };
                var ySeries = new LineSeries()
                {
                    CanTrackerInterpolatePoints = false,
                    Title = title
                };
                var orbitSeries = new LineSeries()
                {
                    CanTrackerInterpolatePoints = false,
                    Title = title
                };

                xSeries.Points.AddRange(from p in xTracker select new DataPoint(p.Key * dt, p.Value));
                ySeries.Points.AddRange(from p in yTracker select new DataPoint(p.Key * dt, p.Value));
                orbitSeries.Points.AddRange(xTracker.Zip(yTracker, (x, y) => new DataPoint(x.Value, y.Value)));

                plotX.Model.Series.Add(xSeries);
                plotY.Model.Series.Add(ySeries);
                orbitPlot.Model.Series.Add(orbitSeries);
                orbitPlot.Model.PlotType = PlotType.Cartesian;
                plotX.InvalidatePlot();
                plotY.InvalidatePlot();
                orbitPlot.InvalidatePlot();

                progressBar.Value = 0;
                SetPanelEnablity(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #13
0
 /// <summary>
 /// Enters the specified context with the current thread.
 /// </summary>
 /// <remarks>
 /// <para>
 /// Conceptually this method pushes the specified context onto the context
 /// stack for the current thread.  It then returns a cookie that can be used
 /// to restore the current thread's context to its previous value.
 /// </para>
 /// </remarks>
 /// <param name="context">The context to enter, or null to enter a scope
 /// without a context.</param>
 /// <returns>A cookie that can be used to restore the current thread's context to its previous value.</returns>
 /// <seealso cref="TestContextCookie"/>
 public static TestContextCookie EnterContext(TestContext context)
 {
     return(new TestContextCookie(ContextTracker.EnterContext(context.inner)));
 }
Exemple #14
0
 /// <summary>
 /// Gets the default context for the specified thread.
 /// </summary>
 /// <remarks>
 /// <para>
 /// The default context for a thread is <see cref="GlobalContext" /> unless the thread's
 /// default context has been overridden with <see cref="SetThreadDefaultContext" />.
 /// </para>
 /// <para>
 /// Changing the default context of a thread is useful for capturing existing threads created
 /// outside of a test into a particular context.  Among other things, this ensures that side-effects
 /// of the thread, such as writing text to the console, are recorded as part of the step
 /// represented by the specified context.
 /// </para>
 /// </remarks>
 /// <param name="thread">The thread.</param>
 /// <returns>The default context.</returns>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="thread"/> is null.</exception>
 public static TestContext GetThreadDefaultContext(Thread thread)
 {
     return(WrapContext(ContextTracker.GetThreadDefaultContext(thread)));
 }
Exemple #15
0
 /// <summary>
 /// Sets the default context for the specified thread.
 /// </summary>
 /// <remarks>
 /// <para>
 /// The default context for a thread is <see cref="GlobalContext" /> unless the thread's
 /// default context has been overridden with <see cref="SetThreadDefaultContext" />.
 /// </para>
 /// <para>
 /// Changing the default context of a thread is useful for capturing existing threads created
 /// outside of a test into a particular context.  Among other things, this ensures that side-effects
 /// of the thread, such as writing text to the console, are recorded as part of the step
 /// represented by the specified context.
 /// </para>
 /// </remarks>
 /// <param name="thread">The thread.</param>
 /// <param name="context">The context to associate with the thread, or null to reset the
 /// thread's default context to inherit the <see cref="GlobalContext" /> once again.</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="thread"/> is null.</exception>
 public static void SetThreadDefaultContext(Thread thread, TestContext context)
 {
     ContextTracker.SetThreadDefaultContext(thread, context.inner);
 }
Exemple #16
0
        static void Main(string[] args)
        {
            //PhysicalContext is the core class represents set of entities and
            //set of force evaluation laws binded to it.
            //Type parameter represents the type of keys used to adding and retrieving entities.
            var context = new PhysicalContext <string>
                          (
                timePerTick: dt, //The time, that is considered to be as small, as force values are uniform.
                //The smaller timePerTick is, the better precision we get.
                //Be aware, time for evaluating state of entities after certain period of time
                //is proportional to (timePerTick)^-1.
                capacity: 1 //Number of entities required to be added to context.
                          );

            //Adding entity
            var freeFallEntity = new PointMass
                                 (
                x: new AxisStatus(3.4),    //Position = 3.4, zero velocity
                y: new AxisStatus(0, 10),  //Zero position, velocity = 10
                z: new AxisStatus(1.1, 2), //Position = 1.1, Velocity = 2
                mass: 77.7
                                 );

            context.AddEntity
            (
                "freeFallEntity", //key
                freeFallEntity,   //entity
                c =>              //Only force that have impact on this entity
                - new Force
                (
                    xComponent: 0,
                    yComponent: c["freeFallEntity"].Mass * freeFallAcceleration,
                    zComponent: 0
                )
                //This force is always vertical and equal to mass of entity multiplied
                //by free fall acceleration.
            );

            Console.WriteLine($"Start state is \n{context["freeFallEntity"]}");
            //Evaluating the state of context after 1 second.
            context.Tick(timeSpan: 1);
            Console.WriteLine($"\nState of entity after 1 second is \n{context["freeFallEntity"]}");

            //If you want to record some data while context is updating,
            //you may subscribe to OnTick event or better use class derived from ContextObserver.
            var yPositionTracker = new ContextTracker <string, double>
                                   (
                context,
                c => c["freeFallEntity"].Y.Position
                                   );

            context.Tick(1);

            //Context tracker implements IReadonlyDictionary.
            Console.WriteLine($"\nOn tick 10345 y position is {yPositionTracker[10345]}");
            Console.WriteLine($"\nOn time 1.27 y position is {yPositionTracker.GetApproximately(1.27)}");
            //Throws exception because tracker has started recording when time is context
            //was already 1.00.
            //Console.WriteLine($"On time 0.4 y position is {yPositionTracker.GetApproximately(0.4)}");
            //Throws exception because tracker hasn't record data yet because time in context is 2.00.
            //Console.WriteLine($"On time 2.7 y position is {yPositionTracker.GetApproximately(2.7)}");

            //Don't forget to dispose tracker when you don't need it anymore.
            //It will increase performance because tracker doesn't record data anymore.
            yPositionTracker.Dispose();
            context.Tick(1);
            //Time is context is 3.0, but tracker is already disposed and doesn't record data anymore.
            Console.WriteLine
            (
                $"\nTracker records data during time span {yPositionTracker.ObservationBeginTime} - {yPositionTracker.LastObservationTime}" +
                $"\nAverage y position is {yPositionTracker.Sum(record => record.Value) / yPositionTracker.Count}"
            );

            //However, if you want to record only max, min, average value etc,
            //better use ContextDependentValue, because it doesn't use a lot of memory
            //to record value in each tick.
            var maxYVelocity = new ContextDependentValue <string, double>
                               (
                startValue: context["freeFallEntity"].Y.Velocity,
                observableContext: context,
                newValueFunc: (c, oldValue) =>
                c["freeFallEntity"].Velocity > oldValue ? new double?(c["freeFallEntity"].Velocity) : null
                //null value means that there is no reason to change value
                               );

            context.Tick(1);
            Console.WriteLine
            (
                $"\nMax y velocity in time span {maxYVelocity.ObservationBeginTime} - " +
                $"{maxYVelocity.LastObservationTime} is {maxYVelocity.Value}"
            );

            //So, lets create something more complex.
            //What about the spring pendulum with air resistance?
            var pendulumContext = new PhysicalContext <PendulumEntities>(dt, 2);
            var axis            = new PointMass(0, 0, 0, 0);
            var mass            = new PointMass(1, 0, 0, 0);

            pendulumContext.AddEntity(PendulumEntities.Axis, axis);
            pendulumContext.AddEntity
            (
                PendulumEntities.Mass,
                mass,
                c => new Force(0, c[PendulumEntities.Mass].Mass * freeFallAcceleration, 0), //Gravity
                HookesLaw.GetLaw                                                            //Mechanix.Laws contains amount of static classes to help force evaluating.
                (
                    PendulumEntities.Mass,
                    PendulumEntities.Axis,
                    1, //undeformed length of spring
                    10 //elasticity coefficient
                )
            );

            //Or set of elastic balls.
            var          ballsContext = new PhysicalContext <int>(dt, 100);
            var          random       = new Random();
            const double radius       = 1;
            const double elasticity   = 100;

            for (int i = 0; i < 100; ++i)
            {
                var ball = new PointMass
                           (
                    new AxisStatus(random.NextDouble(), random.NextDouble()),
                    new AxisStatus(random.NextDouble(), random.NextDouble()),
                    new AxisStatus(random.NextDouble(), random.NextDouble()),
                    random.NextDouble()
                           );
                ballsContext.AddEntity
                (
                    i,
                    ball,
                    c =>
                {
                    var force = Force.Zero;
                    foreach (var pair in c)
                    {
                        if (pair.Key != i)
                        {
                            force += RadialCollisionLaw.Eval
                                     (
                                c[i],
                                pair.Value,
                                radius,
                                elasticity
                                     );
                        }
                    }
                    return(force);
                }
                );
            }
        }