Commit f0453574 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ed81f1bb
...@@ -316,9 +316,9 @@ func (tidx trackIndex) verify() { ...@@ -316,9 +316,9 @@ func (tidx trackIndex) verify() {
// Update tidx with trees subsets from tidx2. // Update tidx with trees subsets from tidx2.
func (tidx trackIndex) Update(tidx2 trackIndex) { func (tidx trackIndex) Update(tidx2 trackIndex) {
fmt.Printf("\n\nUpdate:\n") //fmt.Printf("\n\nUpdate:\n")
fmt.Printf("tidx: %s\n", tidx) //fmt.Printf("tidx: %s\n", tidx)
fmt.Printf("tidx2: %s\n", tidx2) //fmt.Printf("tidx2: %s\n", tidx2)
tidx.verify() tidx.verify()
tidx2.verify() tidx2.verify()
......
...@@ -554,7 +554,7 @@ func (kadj KAdjMatrix) Map(keys SetKey) SetKey { ...@@ -554,7 +554,7 @@ func (kadj KAdjMatrix) Map(keys SetKey) SetKey {
for k := range keys { for k := range keys {
to, ok := kadj[k] to, ok := kadj[k]
if !ok { if !ok {
panicf("%d ∉ kadj\n\nkadj: %v", k, kadj) panicf("kadj.Map: %d ∉ kadj\n\nkadj: %v", k, kadj)
} }
res.Update(to) res.Update(to)
} }
...@@ -562,12 +562,27 @@ func (kadj KAdjMatrix) Map(keys SetKey) SetKey { ...@@ -562,12 +562,27 @@ func (kadj KAdjMatrix) Map(keys SetKey) SetKey {
} }
// KAdj computes adjacency matrix for t1 -> t2 transition. // KAdj computes adjacency matrix for t1 -> t2 transition.
//
// The set of keys for which kadj matrix is computed can be optionally provided.
// This set of keys defaults to allTestKeys(t1,t2).
//
// KAdj itself is verified by testΔBTail on entries with .kadjOK set. // KAdj itself is verified by testΔBTail on entries with .kadjOK set.
func KAdj(t1, t2 *tTreeCommit) (kadj KAdjMatrix) { func KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
var keys SetKey
switch len(keysv) {
case 0:
keys = allTestKeys(t1, t2)
case 1:
keys = keysv[0]
default:
panic("multiple key sets on the call")
}
// kadj = {} k -> adjacent keys. // kadj = {} k -> adjacent keys.
// if k is tracked -> changes to adjacents must be in Update(t1->t2). // if k is tracked -> changes to adjacents must be in Update(t1->t2).
kadj = KAdjMatrix{} kadj = KAdjMatrix{}
for k := range allTestKeys(t1, t2) { for k := range keys {
adj1 := SetKey{} adj1 := SetKey{}
adj2 := SetKey{} adj2 := SetKey{}
...@@ -849,8 +864,8 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1 ...@@ -849,8 +864,8 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
_ = d01 _ = d01
_ = d12 _ = d12
kadj01 := KAdj(t0,t1) // FIXME for all keys from t0,t1,t2 kadj01 := KAdj(t0,t1, allTestKeys(t0,t1,t2))
kadj12 := KAdj(t1,t2) // FIXME for all keys from t0,t1,t2 kadj12 := KAdj(t1,t2, allTestKeys(t0,t1,t2))
_ = kadj01 _ = kadj01
_ = kadj12 _ = kadj12
......
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