public NodePool(final int maxNodes, final int hashSize) { try { if (hashSize != Helper.NextPow2(hashSize)) { throw new Exception("Hash size must be a power of 2"); } if (maxNodes <= 0) { throw new Exception("Max nodes must be greater than 0"); } } catch (Exception e) { e.printStackTrace(); } this.MaxNodes = maxNodes; this.HashSize = hashSize; this._nodes = new Node[maxNodes]; for (int i = 0; i < maxNodes; ++i) { this._nodes[i] = new Node(); } this._next = new int[maxNodes]; this._first = new int[hashSize]; for (int i = 0; i < hashSize; ++i) { this._first[i] = Node.NullIdx; } for (int i = 0; i < maxNodes; ++i) { this._next[i] = Node.NullIdx; } }