Changeset 14747 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Pool/ManagedPoolProvider.cs
- Timestamp:
- 03/12/17 13:16:56 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Pool/ManagedPoolProvider.cs
r14746 r14747 21 21 public const int DefaultMaxInstanceCount = 65536; 22 22 23 public ManagedPoolProvider(int partitionSize, int maxPartitionCount = -1) {23 public ManagedPoolProvider(int partitionSize, int? maxPartitionCount = null) { 24 24 PartitionSize = partitionSize; 25 MaxParitionCount = maxPartitionCount ?? DefaultMaxInstanceCount / PartitionSize; 25 26 26 if (maxPartitionCount <= 0) { 27 MaxParitionCount = DefaultMaxInstanceCount / PartitionSize; 28 } 29 30 managedPools = new ObjectPool<IManagedPool<T>>(() => new ManagedPool2<T>(this)); 27 managedPools = new ObjectPool<IManagedPool<T>>(() => new ManagedPool<T>(this)); 31 28 } 32 29 … … 65 62 } 66 63 67 private class ManagedPool 2<T> : IManagedPool<T> where T : class {64 private class ManagedPool<T> : IManagedPool<T> where T : class { 68 65 private readonly ManagedPoolProvider<T> provider; 69 66 private readonly IList<T[]> partitions = new List<T[]>(); … … 71 68 private int entryIndex; 72 69 73 public ManagedPool 2(ManagedPoolProvider<T> provider) {70 public ManagedPool(ManagedPoolProvider<T> provider) { 74 71 this.provider = provider; 75 72 entryIndex = provider.PartitionSize;
Note: See TracChangeset
for help on using the changeset viewer.