internal static GraphStack New(GraphPointer model)
        {
            var stack = GenericPool <GraphStack> .New(() => new GraphStack());

            stack.CopyFrom(model);
            return(stack);
        }
        internal static GraphStack New(IGraphRoot root, List <IGraphParentElement> parentElements)
        {
            var stack = GenericPool <GraphStack> .New(() => new GraphStack());

            stack.InitializeNoAlloc(root, parentElements, true);
            return(stack);
        }
Exemple #3
0
        public static CloningContext New(ICloner fallbackCloner, bool tryPreserveInstances)
        {
            var context = GenericPool <CloningContext> .New(() => new CloningContext());

            context.fallbackCloner       = fallbackCloner;
            context.tryPreserveInstances = tryPreserveInstances;
            return(context);
        }
Exemple #4
0
        public static Recursion <T> New(int maxDepth)
        {
            if (!Recursion.safeMode)
            {
                return(null);
            }

            if (maxDepth < 1)
            {
                throw new ArgumentException("Max recursion depth must be at least one.", nameof(maxDepth));
            }

            var recursion = GenericPool <Recursion <T> > .New(() => new Recursion <T>());

            recursion.maxDepth = maxDepth;

            return(recursion);
        }