Commit 4c6bd292 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c7b5c7e0
...@@ -606,9 +606,9 @@ func _KAdj_old(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) { ...@@ -606,9 +606,9 @@ func _KAdj_old(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
return kadj return kadj
} }
const traceKAdj = true const debugKAdj = false
func tracefKAdj(format string, argv ...interface{}) { func debugfKAdj(format string, argv ...interface{}) {
if traceKAdj { if debugKAdj {
fmt.Printf(format, argv...) fmt.Printf(format, argv...)
} }
} }
...@@ -624,12 +624,12 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) { ...@@ -624,12 +624,12 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
panic("multiple key sets on the call") panic("multiple key sets on the call")
} }
tracefKAdj("\n\n_KAdj\n") debugfKAdj("\n\n_KAdj\n")
tracefKAdj("t1: %s\n", t1.tree) debugfKAdj("t1: %s\n", t1.tree)
tracefKAdj("t2: %s\n", t2.tree) debugfKAdj("t2: %s\n", t2.tree)
tracefKAdj("keys: %s\n", keys) debugfKAdj("keys: %s\n", keys)
defer func() { defer func() {
tracefKAdj("kadj -> %v\n", kadj) debugfKAdj("kadj -> %v\n", kadj)
}() }()
// kadj = {} k -> adjacent keys. // kadj = {} k -> adjacent keys.
...@@ -644,19 +644,19 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) { ...@@ -644,19 +644,19 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
done1 := &RangedKeySet{} done1 := &RangedKeySet{}
done2 := &RangedKeySet{} done2 := &RangedKeySet{}
tracefKAdj("\nk%s\n", kstr(k)) debugfKAdj("\nk%s\n", kstr(k))
for !q1.Empty() || !q2.Empty() { for !q1.Empty() || !q2.Empty() {
tracefKAdj("q1: %s\tdone1: %s\n", q1, done1) debugfKAdj("q1: %s\tdone1: %s\n", q1, done1)
tracefKAdj("q2: %s\tdone2: %s\n", q2, done2) debugfKAdj("q2: %s\tdone2: %s\n", q2, done2)
for _, r1 := range q1.AllRanges() { for _, r1 := range q1.AllRanges() {
lo1 := r1.lo lo1 := r1.lo
for { for {
b1 := t1.xkv.Get(lo1) b1 := t1.xkv.Get(lo1)
tracefKAdj(" b1: %s\n", b1) debugfKAdj(" b1: %s\n", b1)
for k_ := range keys { for k_ := range keys {
if b1.lo <= k_ && k_ <= b1.hi_ { if b1.lo <= k_ && k_ <= b1.hi_ {
adj1.Add(k_) adj1.Add(k_)
tracefKAdj(" adj1 += %s\t-> %s\n", kstr(k_), adj1) debugfKAdj(" adj1 += %s\t-> %s\n", kstr(k_), adj1)
} }
} }
b1r := KeyRange{b1.lo, b1.hi_} b1r := KeyRange{b1.lo, b1.hi_}
...@@ -666,7 +666,7 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) { ...@@ -666,7 +666,7 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
δq2.AddRange(b1r) δq2.AddRange(b1r)
δq2.DifferenceInplace(done2) δq2.DifferenceInplace(done2)
q2.UnionInplace(δq2) q2.UnionInplace(δq2)
tracefKAdj("q2 += %s\t-> %s\n", δq2, q2) debugfKAdj("q2 += %s\t-> %s\n", δq2, q2)
// continue with next right bucket until r1 coverage is complete // continue with next right bucket until r1 coverage is complete
if r1.hi_ <= b1.hi_ { if r1.hi_ <= b1.hi_ {
...@@ -681,11 +681,11 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) { ...@@ -681,11 +681,11 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
lo2 := r2.lo lo2 := r2.lo
for { for {
b2 := t2.xkv.Get(lo2) b2 := t2.xkv.Get(lo2)
tracefKAdj(" b2: %s\n", b2) debugfKAdj(" b2: %s\n", b2)
for k_ := range keys { for k_ := range keys {
if b2.lo <= k_ && k_ <= b2.hi_ { if b2.lo <= k_ && k_ <= b2.hi_ {
adj2.Add(k_) adj2.Add(k_)
tracefKAdj(" adj2 += %s\t-> %s\n", kstr(k_), adj2) debugfKAdj(" adj2 += %s\t-> %s\n", kstr(k_), adj2)
} }
} }
b2r := KeyRange{b2.lo, b2.hi_} b2r := KeyRange{b2.lo, b2.hi_}
...@@ -695,7 +695,7 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) { ...@@ -695,7 +695,7 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
δq1.AddRange(b2r) δq1.AddRange(b2r)
δq1.DifferenceInplace(done1) δq1.DifferenceInplace(done1)
q1.UnionInplace(δq1) q1.UnionInplace(δq1)
tracefKAdj("q1 += %s\t-> %s\n", δq1, q1) debugfKAdj("q1 += %s\t-> %s\n", δq1, q1)
// continue with next right bucket until r2 coverage is complete // continue with next right bucket until r2 coverage is complete
if r2.hi_ <= b2.hi_ { if r2.hi_ <= b2.hi_ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment