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) {
if debugPPSet {
fmt.Printf("\n\nDifferenceInplace:\n") fmt.Printf("\n\nDifferenceInplace:\n")
fmt.Printf(" A: %s\n", A) fmt.Printf(" A: %s\n", A)
fmt.Printf(" B: %s\n", B) fmt.Printf(" B: %s\n", B)
defer fmt.Printf("->D: %s\n", A) defer fmt.Printf("->D: %s\n", A)
}
A.verify() A.verify()
B.verify() B.verify()
...@@ -395,6 +399,7 @@ func (A trackIndex) DifferenceInplace(B trackIndex) { ...@@ -395,6 +399,7 @@ 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) {
if debugPPSet {
fmt.Printf("\n\n xDifferenceInplace:\n") fmt.Printf("\n\n xDifferenceInplace:\n")
fmt.Printf(" a: %s\n", A) fmt.Printf(" a: %s\n", A)
fmt.Printf(" b: %s\n", B) fmt.Printf(" b: %s\n", B)
...@@ -403,6 +408,7 @@ func (A trackIndex) xDifferenceInplace(B trackIndex) { ...@@ -403,6 +408,7 @@ func (A trackIndex) xDifferenceInplace(B trackIndex) {
fmt.Printf(" ->d: %s\n", A) fmt.Printf(" ->d: %s\n", A)
// fmt.Printf(" ->δ: %v\n", δnchild) // fmt.Printf(" ->δ: %v\n", δnchild)
}() }()
}
δnchild := map[zodb.Oid]int{} δnchild := map[zodb.Oid]int{}
...@@ -437,6 +443,7 @@ func (A trackIndex) xDifferenceInplace(B trackIndex) { ...@@ -437,6 +443,7 @@ 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) {
if debugPPSet {
fmt.Printf("\n\n xUnionInplace:\n") fmt.Printf("\n\n xUnionInplace:\n")
fmt.Printf(" a: %s\n", A) fmt.Printf(" a: %s\n", A)
fmt.Printf(" b: %s\n", B) fmt.Printf(" b: %s\n", B)
...@@ -445,6 +452,7 @@ func (A trackIndex) xUnionInplace(B trackIndex) { ...@@ -445,6 +452,7 @@ func (A trackIndex) xUnionInplace(B trackIndex) {
fmt.Printf(" ->u: %s\n", A) fmt.Printf(" ->u: %s\n", A)
// fmt.Printf(" ->δ: %v\n", δnchild) // 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) {
if debugPPSet {
fmt.Printf("\n\nUnionInplace:\n") fmt.Printf("\n\nUnionInplace:\n")
fmt.Printf(" A: %s\n", A) fmt.Printf(" A: %s\n", A)
fmt.Printf(" B: %s\n", B) fmt.Printf(" B: %s\n", B)
defer fmt.Printf("->U: %s\n", A) 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) {
if debugPPSet {
fmt.Printf("\n\nApplyΔ\n") fmt.Printf("\n\nApplyΔ\n")
fmt.Printf(" A: %s\n", tidx) fmt.Printf(" A: %s\n", tidx)
fmt.Printf(" -: %s\n", δ.Del) fmt.Printf(" -: %s\n", δ.Del)
fmt.Printf(" +: %s\n", δ.Add) fmt.Printf(" +: %s\n", δ.Add)
fmt.Printf(" x: %v\n", δ.δnchildNonLeafs) fmt.Printf(" x: %v\n", δ.δnchildNonLeafs)
defer fmt.Printf("\n->B: %s\n", tidx) 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