uschindler commented on code in PR #13668: URL: https://github.com/apache/lucene/pull/13668#discussion_r1722023350
########## lucene/core/src/java/org/apache/lucene/util/bkd/BKDConfig.java: ########## @@ -31,48 +48,23 @@ public final class BKDConfig { /** Maximum number of index dimensions */ public static final int MAX_INDEX_DIMS = 8; - /** How many dimensions we are storing at the leaf (data) nodes */ - public final int numDims; - - /** How many dimensions we are indexing in the internal nodes */ - public final int numIndexDims; - - /** How many bytes each value in each dimension takes. */ - public final int bytesPerDim; - - /** max points allowed on a Leaf block */ - public final int maxPointsInLeafNode; - - /** numDataDims * bytesPerDim */ - public final int packedBytesLength; - - /** numIndexDims * bytesPerDim */ - public final int packedIndexBytesLength; - - /** packedBytesLength plus docID size */ - public final int bytesPerDoc; - + /** Constructor that populates the derived input parameters. */ public BKDConfig( final int numDims, final int numIndexDims, final int bytesPerDim, final int maxPointsInLeafNode) { - verifyParams(numDims, numIndexDims, bytesPerDim, maxPointsInLeafNode); - this.numDims = numDims; - this.numIndexDims = numIndexDims; - this.bytesPerDim = bytesPerDim; - this.maxPointsInLeafNode = maxPointsInLeafNode; - this.packedIndexBytesLength = numIndexDims * bytesPerDim; - this.packedBytesLength = numDims * bytesPerDim; - // dimensional values (numDims * bytesPerDim) + docID (int) - this.bytesPerDoc = this.packedBytesLength + Integer.BYTES; + this( + numDims, + numIndexDims, + bytesPerDim, + maxPointsInLeafNode, + numDims * bytesPerDim, + numIndexDims * bytesPerDim, + numDims * bytesPerDim + Integer.BYTES); } - private static void verifyParams( - final int numDims, - final int numIndexDims, - final int bytesPerDim, - final int maxPointsInLeafNode) { + public BKDConfig { Review Comment: An alternative to this would be to not define the calculated values as field and just declare them as final fields (this is possible in records, too) and populate them in default ctor. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org