예제 #1
0
        public static IEnumerable <T> ExploreSequence <T>(T initial, T endCondition, Func <T, T> next)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

            return(ExploreSequenceExtracted(initial, endCondition, next, FuncHelper.GetIdentityFunc <T>(), null));
        }
예제 #2
0
        public static IEnumerable <T> ExploreBreadthFirstTree <T>(IEnumerable <T> initial, Func <T, IEnumerable <T> > next)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }
            var branches = initial;

            return(ExploreBreadthFirstTreeExtracted(branches, next, FuncHelper.GetIdentityFunc <T>()));
        }
예제 #3
0
        public static IEnumerable <T> ExploreBreadthFirstGraph <T>(IEnumerable <T> initial, Func <T, IEnumerable <T> > next, IEqualityComparer <T> comparer)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }
            var branches = initial;

            return(ExploreBreadthFirstGraphExtracted(branches, next, FuncHelper.GetIdentityFunc <T>(), comparer ?? EqualityComparer <T> .Default));
        }
예제 #4
0
 public ValueFuncClosure(Func <TReturn> target)
 {
     _result = default(TReturn);
     _target = target ?? FuncHelper.GetDefaultFunc <TReturn>();
 }
예제 #5
0
 public static Func <TReturn> GetDefault <TReturn>()
 {
     return(FuncHelper.GetDefaultFunc <TReturn>());
 }
예제 #6
0
 public static TReturn Default <TReturn>()
 {
     return(FuncHelper.GetDefaultFunc <TReturn>().Invoke());
 }
예제 #7
0
        public static IEnumerable <T> ExploreBreadthFirstTree <T>(IEnumerable <T> initial, Func <T, IEnumerable <T> > next)
        {
            var branches = initial;

            return(ExploreBreadthFirstTreeExtracted(branches, next, FuncHelper.GetIdentityFunc <T>()));
        }
예제 #8
0
        public static IEnumerable <T> ExploreBreadthFirstGraph <T>(T initial, Func <T, IEnumerable <T> > next)
        {
            var branches = new[] { initial };

            return(ExploreBreadthFirstGraphExtracted(branches, next, FuncHelper.GetIdentityFunc <T>()));
        }
예제 #9
0
 public ErsatzFunc(Func <TReturn> target)
 {
     _result = default(TReturn);
     _target = target ?? FuncHelper.GetDefaultFunc <TReturn>();
 }