Commit 19552f74 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 563f3e5e
...@@ -375,14 +375,18 @@ func (tidx trackIndex) verify() { ...@@ -375,14 +375,18 @@ func (tidx trackIndex) verify() {
} }
} }
const debugPPSet = false
// DifferenceInplace sets A = PP(A.leafs \ B.leafs) // DifferenceInplace sets A = PP(A.leafs \ B.leafs)
// //
// In other words it removes B nodes from A while still maintaining A as P-connected. // In other words it removes B nodes from A while still maintaining A as P-connected.
func (A trackIndex) DifferenceInplace(B trackIndex) { func (A trackIndex) DifferenceInplace(B trackIndex) {
fmt.Printf("\n\nDifferenceInplace:\n") if debugPPSet {
fmt.Printf(" A: %s\n", A) fmt.Printf("\n\nDifferenceInplace:\n")
fmt.Printf(" B: %s\n", B) fmt.Printf(" A: %s\n", A)
defer fmt.Printf("->D: %s\n", A) fmt.Printf(" B: %s\n", B)
defer fmt.Printf("->D: %s\n", A)
}
A.verify() A.verify()
B.verify() B.verify()
...@@ -395,14 +399,16 @@ func (A trackIndex) DifferenceInplace(B trackIndex) { ...@@ -395,14 +399,16 @@ func (A trackIndex) DifferenceInplace(B trackIndex) {
//func (A trackIndex) xDifferenceInplace(B trackIndex, δnchild map[zodb.Oid]int) { //func (A trackIndex) xDifferenceInplace(B trackIndex, δnchild map[zodb.Oid]int) {
func (A trackIndex) xDifferenceInplace(B trackIndex) { func (A trackIndex) xDifferenceInplace(B trackIndex) {
fmt.Printf("\n\n xDifferenceInplace:\n") if debugPPSet {
fmt.Printf(" a: %s\n", A) fmt.Printf("\n\n xDifferenceInplace:\n")
fmt.Printf(" b: %s\n", B) fmt.Printf(" a: %s\n", A)
// fmt.Printf(" δ: %v\n", δnchild) fmt.Printf(" b: %s\n", B)
defer func() { // fmt.Printf(" δ: %v\n", δnchild)
fmt.Printf(" ->d: %s\n", A) defer func() {
// fmt.Printf(" ->δ: %v\n", δnchild) fmt.Printf(" ->d: %s\n", A)
}() // fmt.Printf(" ->δ: %v\n", δnchild)
}()
}
δnchild := map[zodb.Oid]int{} δnchild := map[zodb.Oid]int{}
...@@ -437,14 +443,16 @@ func (A trackIndex) xDifferenceInplace(B trackIndex) { ...@@ -437,14 +443,16 @@ func (A trackIndex) xDifferenceInplace(B trackIndex) {
//func (A trackIndex) xUnionInplace(B trackIndex, δnchild map[zodb.Oid]int) { //func (A trackIndex) xUnionInplace(B trackIndex, δnchild map[zodb.Oid]int) {
func (A trackIndex) xUnionInplace(B trackIndex) { func (A trackIndex) xUnionInplace(B trackIndex) {
fmt.Printf("\n\n xUnionInplace:\n") if debugPPSet {
fmt.Printf(" a: %s\n", A) fmt.Printf("\n\n xUnionInplace:\n")
fmt.Printf(" b: %s\n", B) fmt.Printf(" a: %s\n", A)
// fmt.Printf(" δ: %v\n", δnchild) fmt.Printf(" b: %s\n", B)
defer func() { // fmt.Printf(" δ: %v\n", δnchild)
fmt.Printf(" ->u: %s\n", A) defer func() {
// fmt.Printf(" ->δ: %v\n", δnchild) fmt.Printf(" ->u: %s\n", A)
}() // fmt.Printf(" ->δ: %v\n", δnchild)
}()
}
δnchild := map[zodb.Oid]int{} δnchild := map[zodb.Oid]int{}
...@@ -494,10 +502,12 @@ func (A trackIndex) fixup(δnchild map[zodb.Oid]int) { ...@@ -494,10 +502,12 @@ func (A trackIndex) fixup(δnchild map[zodb.Oid]int) {
// //
// In other words it adds B nodes to A. // In other words it adds B nodes to A.
func (A trackIndex) UnionInplace(B trackIndex) { func (A trackIndex) UnionInplace(B trackIndex) {
fmt.Printf("\n\nUnionInplace:\n") if debugPPSet {
fmt.Printf(" A: %s\n", A) fmt.Printf("\n\nUnionInplace:\n")
fmt.Printf(" B: %s\n", B) fmt.Printf(" A: %s\n", A)
defer fmt.Printf("->U: %s\n", A) fmt.Printf(" B: %s\n", B)
defer fmt.Printf("->U: %s\n", A)
}
A.verify() A.verify()
B.verify() B.verify()
...@@ -536,12 +546,14 @@ func (A trackIndex) UnionInplace(B trackIndex) { ...@@ -536,12 +546,14 @@ func (A trackIndex) UnionInplace(B trackIndex) {
// ApplyΔ applies δ to trackIdx. XXX // ApplyΔ applies δ to trackIdx. XXX
func (tidx trackIndex) ApplyΔ(δ *δtrackIndex) { func (tidx trackIndex) ApplyΔ(δ *δtrackIndex) {
fmt.Printf("\n\nApplyΔ\n") if debugPPSet {
fmt.Printf(" A: %s\n", tidx) fmt.Printf("\n\nApplyΔ\n")
fmt.Printf(" -: %s\n", δ.Del) fmt.Printf(" A: %s\n", tidx)
fmt.Printf(" +: %s\n", δ.Add) fmt.Printf(" -: %s\n", δ.Del)
fmt.Printf(" x: %v\n", δ.δnchildNonLeafs) fmt.Printf(" +: %s\n", δ.Add)
defer fmt.Printf("\n->B: %s\n", tidx) fmt.Printf(" x: %v\n", δ.δnchildNonLeafs)
defer fmt.Printf("\n->B: %s\n", tidx)
}
tidx.verify() tidx.verify()
δ.Del.verify() δ.Del.verify()
......
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