[COST] Provide descriptive Object#toString
for ClusterCosts
#1473
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: #1463 (comment)
這個 PR 給
ClusterCost
提供Object#toString()
實作,該實作將會暴露關於自己分數的一些細部統計資訊。給使用者一些提示這個數字背後的故事。預期套用這個 PR 後,ClusterCost
分數背後的來源會比較透明一些。ClusterCost
,現在一定要透過ClusterCost#of(double)
或ClusterCost#of(double,Supplier<String>)
函數來建立。ClusterCost#of(double, Supplier<String>)
簽名提供一個參數來指出這個 ClusterCost 的細部資訊(以字串顯示),這個字串內容會在HasClusterCost#of()
回傳的版本中出現。HasClusterCost
的實作添加適合的ClusterCost
敘述字串範例
輸出
手動換行後的輸出