Commit 485f8c21 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 1489a805
...@@ -99,7 +99,7 @@ func (M *RangedMap) Get_(k Key) (v VALUE, ok bool) { ...@@ -99,7 +99,7 @@ func (M *RangedMap) Get_(k Key) (v VALUE, ok bool) {
} }
// found // found
return e.value, true return e.Value, true
} }
// SetRange changes M to map key range r to value v. // SetRange changes M to map key range r to value v.
...@@ -170,7 +170,7 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) { ...@@ -170,7 +170,7 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
// and check if we should merge it with right/left neighbours // and check if we should merge it with right/left neighbours
if ilo+1 < len(M.entryv) { // right if ilo+1 < len(M.entryv) { // right
if M.entryv[ilo].Hi_+1 == M.entryv[ilo+1].Lo { // XXX && .value same if M.entryv[ilo].Hi_+1 == M.entryv[ilo+1].Lo { // XXX && .Value same
vReplaceSlice(&M.entryv, ilo,ilo+2, vReplaceSlice(&M.entryv, ilo,ilo+2,
KeyRange{M.entryv[ilo].Lo, M.entryv[ilo+1].Hi_}) KeyRange{M.entryv[ilo].Lo, M.entryv[ilo+1].Hi_})
debugfRMap("\tmerge right\t-> %s\n", M) debugfRMap("\tmerge right\t-> %s\n", M)
...@@ -178,7 +178,7 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) { ...@@ -178,7 +178,7 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
} }
if ilo > 0 { // left if ilo > 0 { // left
if M.entryv[ilo-1].Hi_+1 == M.entryv[ilo].Lo { // XXX && .value same if M.entryv[ilo-1].Hi_+1 == M.entryv[ilo].Lo { // XXX && .Value same
vReplaceSlice(&M.entryv, ilo-1,ilo+1, vReplaceSlice(&M.entryv, ilo-1,ilo+1,
KeyRange{M.entryv[ilo-1].Lo, M.entryv[ilo].Hi_}) KeyRange{M.entryv[ilo-1].Lo, M.entryv[ilo].Hi_})
debugfRMap("\tmerge left\t-> %s\n", M) debugfRMap("\tmerge left\t-> %s\n", M)
...@@ -316,7 +316,7 @@ func (M *RangedMap) verify() { ...@@ -316,7 +316,7 @@ func (M *RangedMap) verify() {
for i, e := range M.entryv { for i, e := range M.entryv {
hiPrev := hi_Prev + 1 hiPrev := hi_Prev + 1
if i > 0 { if i > 0 {
if (e.value == v_Prev) { if (e.Value == v_Prev) {
if !(hiPrev < e.Lo) { // NOTE not ≤ - adjacent ranges must be merged if !(hiPrev < e.Lo) { // NOTE not ≤ - adjacent ranges must be merged
badf("[%d]: same value: !(hiPrev < e.lo)", i) badf("[%d]: same value: !(hiPrev < e.lo)", i)
} }
...@@ -330,7 +330,7 @@ func (M *RangedMap) verify() { ...@@ -330,7 +330,7 @@ func (M *RangedMap) verify() {
badf("[%d]: !(e.lo ≤ e.hi_)", i) badf("[%d]: !(e.lo ≤ e.hi_)", i)
} }
hi_Prev = e.Hi_ hi_Prev = e.Hi_
v_Prev = e.value v_Prev = e.Value
} }
} }
...@@ -389,7 +389,7 @@ func (M RangedMap) String() string { ...@@ -389,7 +389,7 @@ func (M RangedMap) String() string {
func (e *RangedMapEntry) String() string { func (e *RangedMapEntry) String() string {
s := e.keycov.String() s := e.keycov.String()
v := fmt.Sprintf("%v", e.value) v := fmt.Sprintf("%v", e.Value)
if v != "" { // omit ":<v>" in the case of set if v != "" { // omit ":<v>" in the case of set
s += ":" + v s += ":" + v
} }
......
...@@ -118,7 +118,7 @@ func (S *RangedKeySet) verify() { ...@@ -118,7 +118,7 @@ func (S *RangedKeySet) verify() {
// Clone returns copy of the set. // Clone returns copy of the set.
func (orig *RangedKeySet) Clone() *RangedKeySet { func (orig *RangedKeySet) Clone() *RangedKeySet {
return &RangedKeySet{orig.m.Clone()} return &RangedKeySet{*orig.m.Clone()}
} }
// Empty returns whether the set is empty. // Empty returns whether the set is empty.
...@@ -128,7 +128,7 @@ func (S *RangedKeySet) Empty() bool { ...@@ -128,7 +128,7 @@ func (S *RangedKeySet) Empty() bool {
// Equal returns whether A == B. // Equal returns whether A == B.
func (A *RangedKeySet) Equal(B *RangedKeySet) bool { func (A *RangedKeySet) Equal(B *RangedKeySet) bool {
return A.m.Equal(B.m) return A.m.Equal(&B.m)
} }
// Clear removes all elements from the set. // Clear removes all elements from the set.
......
...@@ -101,7 +101,7 @@ func (M *_RangedMap_void) Get_(k Key) (v void, ok bool) { ...@@ -101,7 +101,7 @@ func (M *_RangedMap_void) Get_(k Key) (v void, ok bool) {
} }
// found // found
return e.value, true return e.Value, true
} }
// SetRange changes M to map key range r to value v. // SetRange changes M to map key range r to value v.
...@@ -172,7 +172,7 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) { ...@@ -172,7 +172,7 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
// and check if we should merge it with right/left neighbours // and check if we should merge it with right/left neighbours
if ilo+1 < len(M.entryv) { // right if ilo+1 < len(M.entryv) { // right
if M.entryv[ilo].Hi_+1 == M.entryv[ilo+1].Lo { // XXX && .value same if M.entryv[ilo].Hi_+1 == M.entryv[ilo+1].Lo { // XXX && .Value same
vReplaceSlice__RangedMap_void(&M.entryv, ilo,ilo+2, vReplaceSlice__RangedMap_void(&M.entryv, ilo,ilo+2,
KeyRange{M.entryv[ilo].Lo, M.entryv[ilo+1].Hi_}) KeyRange{M.entryv[ilo].Lo, M.entryv[ilo+1].Hi_})
debugf_RangedMap_void("\tmerge right\t-> %s\n", M) debugf_RangedMap_void("\tmerge right\t-> %s\n", M)
...@@ -180,7 +180,7 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) { ...@@ -180,7 +180,7 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
} }
if ilo > 0 { // left if ilo > 0 { // left
if M.entryv[ilo-1].Hi_+1 == M.entryv[ilo].Lo { // XXX && .value same if M.entryv[ilo-1].Hi_+1 == M.entryv[ilo].Lo { // XXX && .Value same
vReplaceSlice__RangedMap_void(&M.entryv, ilo-1,ilo+1, vReplaceSlice__RangedMap_void(&M.entryv, ilo-1,ilo+1,
KeyRange{M.entryv[ilo-1].Lo, M.entryv[ilo].Hi_}) KeyRange{M.entryv[ilo-1].Lo, M.entryv[ilo].Hi_})
debugf_RangedMap_void("\tmerge left\t-> %s\n", M) debugf_RangedMap_void("\tmerge left\t-> %s\n", M)
...@@ -318,7 +318,7 @@ func (M *_RangedMap_void) verify() { ...@@ -318,7 +318,7 @@ func (M *_RangedMap_void) verify() {
for i, e := range M.entryv { for i, e := range M.entryv {
hiPrev := hi_Prev + 1 hiPrev := hi_Prev + 1
if i > 0 { if i > 0 {
if (e.value == v_Prev) { if (e.Value == v_Prev) {
if !(hiPrev < e.Lo) { // NOTE not ≤ - adjacent ranges must be merged if !(hiPrev < e.Lo) { // NOTE not ≤ - adjacent ranges must be merged
badf("[%d]: same value: !(hiPrev < e.lo)", i) badf("[%d]: same value: !(hiPrev < e.lo)", i)
} }
...@@ -332,7 +332,7 @@ func (M *_RangedMap_void) verify() { ...@@ -332,7 +332,7 @@ func (M *_RangedMap_void) verify() {
badf("[%d]: !(e.lo ≤ e.hi_)", i) badf("[%d]: !(e.lo ≤ e.hi_)", i)
} }
hi_Prev = e.Hi_ hi_Prev = e.Hi_
v_Prev = e.value v_Prev = e.Value
} }
} }
...@@ -391,7 +391,7 @@ func (M _RangedMap_void) String() string { ...@@ -391,7 +391,7 @@ func (M _RangedMap_void) String() string {
func (e *_RangedMap_voidEntry) String() string { func (e *_RangedMap_voidEntry) String() string {
s := e.keycov.String() s := e.keycov.String()
v := fmt.Sprintf("%v", e.value) v := fmt.Sprintf("%v", e.Value)
if v != "" { // omit ":<v>" in the case of set if v != "" { // omit ":<v>" in the case of set
s += ":" + v s += ":" + v
} }
......
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