private bool ExcludeTypesFilter(Type arg)
        {
            if (_excludeFuncs == ImmutableLinkedList <Func <Type, bool> > .Empty)
            {
                return(true);
            }

            return(!_excludeFuncs.Any(m => m(arg)));
        }
        /// <summary>
        /// add method injection to list
        /// </summary>
        /// <param name="methodInjection"></param>
        public void MethodInjection(MethodInjectionInfo methodInjection)
        {
            if (MethodInjectionList != ImmutableLinkedList <MethodInjectionInfo> .Empty &&
                MethodInjectionList.Any(m => Equals(m.Method, methodInjection.Method)))
            {
                return;
            }

            MethodInjectionList = MethodInjectionList.Add(methodInjection);
        }
示例#3
0
        private void IteratePhase1(ISolveCoordinator solveCoordinator)
        {
            uint nextDepth;

            if (Cube.FlipsliceTwistDepthMod3 == 0)
            {
                nextDepth = 2;
            }
            else
            {
                nextDepth = Cube.FlipsliceTwistDepthMod3 - 1;
            }

            if (nextDepth + 1 + MovesDeep >= solveCoordinator.MaxTotalMoves)
            {
                return;//No way to solve in time
            }
            ImmutableArray <Move> moves;

            if (MovesSoFar.Any())
            {
                moves = MoveExtensions.PossibleNextMovesPhase1[(int)MovesSoFar.Head];
            }
            else
            {
                moves = MoveExtensions.AllMoves;
            }

            foreach (var moveEnum in moves)
            {
                var nextCube = Cube.Move(moveEnum, solveCoordinator.DataSource);

                var nextIsDeepening = nextCube.FlipsliceTwistDepthMod3 == nextDepth;

                if (nextIsDeepening || (!Deepening && MovesDeep <= 2))  //Once we are deepening, we do not allow non-deepening moves
                {
                    var nextState = new SearchState(Invert, Rotation, nextCube, MovesSoFar.Prepend(moveEnum),
                                                    nextIsDeepening);

                    solveCoordinator.MaybeAddSearch(nextState);
                }
            }
        }