Пример #1
0
        internal static GraphStack New(GraphPointer model)
        {
            var stack = GenericPool <GraphStack> .New(() => new GraphStack());

            stack.CopyFrom(model);
            return(stack);
        }
Пример #2
0
        internal static GraphStack New(IGraphRoot root, List <IGraphParentElement> parentElements)
        {
            var stack = GenericPool <GraphStack> .New(() => new GraphStack());

            stack.InitializeNoAlloc(root, parentElements, true);
            return(stack);
        }
Пример #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);
        }
Пример #4
0
        public void Dispose()
        {
            if (disposed)
            {
                throw new ObjectDisposedException(ToString());
            }

            GenericPool <CloningContext> .Free(this);
        }
Пример #5
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);
        }
Пример #6
0
 protected virtual void Free()
 {
     GenericPool <Recursion <T> > .Free(this);
 }
Пример #7
0
 public void Dispose()
 {
     GenericPool <GraphStack> .Free(this);
 }