You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.0 KiB
C#

using System.Collections.Generic;
namespace FluidHTN.Factory
{
public sealed class DefaultFactory : IFactory
{
public T[] CreateArray<T>(int length)
{
return new T[length];
}
public List<T> CreateList<T>()
{
return new List<T>();
}
public Queue<T> CreateQueue<T>()
{
return new Queue<T>();
}
public bool FreeArray<T>(ref T[] array)
{
array = null;
return array == null;
}
public bool FreeList<T>(ref List<T> list)
{
list = null;
return list == null;
}
public bool FreeQueue<T>(ref Queue<T> queue)
{
queue = null;
return queue == null;
}
public T Create<T>() where T : new()
{
return new T();
}
public bool Free<T>(ref T obj)
{
obj = default(T);
return obj == null;
}
}
}