altavir/diff #494

Merged
altavir merged 71 commits from altavir/diff into commandertvis/diff 2022-07-16 09:58:44 +03:00
Showing only changes of commit 86d89f89f9 - Show all commits

View File

@ -68,8 +68,9 @@ public interface IndexedHistogramGroup<T : Comparable<T>, V : Any> : Group<Index
public fun produce(builder: HistogramBuilder<T, V>.() -> Unit): IndexedHistogram<T, V>
override fun add(left: IndexedHistogram<T, V>, right: IndexedHistogram<T, V>): IndexedHistogram<T, V> {
require(left.histogramSpace == this) { "Can't operate on a histogram produced by external space" }
require(right.histogramSpace == this) { "Can't operate on a histogram produced by external space" }
require(left.histogramSpace == this && right.histogramSpace == this) {
"A histogram belonging to a different group cannot be operated."
}
return IndexedHistogram(this, histogramValueAlgebra { left.values + right.values })
}