Exemplo n.º 1
0
        public static HashSet <T> ToHashSetPooled <T>(this IEnumerable <T> source)
        {
            var hashSet = HashSetPool <T> .New();

            foreach (var item in source)
            {
                hashSet.Add(item);
            }

            return(hashSet);
        }
Exemplo n.º 2
0
        public static IEnumerable <T> OrderByDependencies <T>(this IEnumerable <T> source, Func <T, IEnumerable <T> > getDependencies, bool throwOnCycle = true)
        {
            var sorted  = new List <T>();
            var visited = HashSetPool <T> .New();

            foreach (var item in source)
            {
                OrderByDependenciesVisit(item, visited, sorted, getDependencies, throwOnCycle);
            }

            HashSetPool <T> .Free(visited);

            return(sorted);
        }
Exemplo n.º 3
0
        protected void FreeInvalidChildren()
        {
            var toFree = HashSetPool <Inspector> .New();

            foreach (var child in children)
            {
                if (!child.Key.isLinked)
                {
                    toFree.Add(child.Value);
                }
            }

            foreach (var invalid in toFree)
            {
                invalid.Dispose();
                children.Remove(invalid.accessor);
            }

            toFree.Free();
        }
Exemplo n.º 4
0
 public static void Free <T>(this HashSet <T> hashSet)
 {
     HashSetPool <T> .Free(hashSet);
 }