Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
1c847f19
Commit
1c847f19
authored
Sep 27, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
21b2dc8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
wcfs/internal/xbtree/blib/rangemap.go.in
wcfs/internal/xbtree/blib/rangemap.go.in
+11
-16
No files found.
wcfs/internal/xbtree/blib/rangemap.go.in
View file @
1c847f19
...
...
@@ -68,11 +68,6 @@ func (M *RangedMap) Get(k Key) VALUE {
//
HasRange
returns
whether
all
keys
from
range
r
belong
to
the
map
.
func
(
M
*
RangedMap
)
HasRange
(
r
KeyRange
)
bool
{
panic
(
"TODO"
)
//
XXX
}
//
Get_
is
comma
-
ok
version
of
Get
.
func
(
M
*
RangedMap
)
Get_
(
k
Key
)
(
VALUE
,
bool
)
{
panic
(
"TODO"
)
//
XXX
...
...
@@ -84,7 +79,7 @@ func (M *RangedMap) Get_(k Key) (VALUE, bool) {
//
SetRange
changes
M
to
map
key
range
r
to
value
v
.
func
(
M
*
RangedMap
)
SetRange
(
r
KeyRange
,
v
VALUE
)
{
e
:=
mapEntry
{
r
,
v
}
if
traceRange
Set
{
if
traceRange
Map
{
fmt
.
Printf
(
"
\n\n
SetRange:
\n
"
)
fmt
.
Printf
(
" M: %s
\n
"
,
M
)
fmt
.
Printf
(
" e: %s
\n
"
,
e
)
...
...
@@ -169,7 +164,7 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
//
DelRange
removes
range
r
from
the
map
.
func
(
M
*
RangedMap
)
DelRange
(
r
KeyRange
)
{
if
traceRange
Set
{
if
traceRange
Map
{
fmt
.
Printf
(
"
\n\n
DelRange:
\n
"
)
fmt
.
Printf
(
" M: %s
\n
"
,
M
)
fmt
.
Printf
(
" r: %s
\n
"
,
r
)
...
...
@@ -237,23 +232,23 @@ func (M *RangedMap) DelRange(r KeyRange) {
//
done
}
//
HasRange
returns
whether
all
keys
from
range
r
belong
to
the
set
.
func
(
S
*
RangedMap
)
HasRange
(
r
KeyRange
)
(
yes
bool
)
{
if
traceRange
Set
{
//
HasRange
returns
whether
all
keys
from
range
r
belong
to
the
map
.
func
(
M
*
RangedMap
)
HasRange
(
r
KeyRange
)
(
yes
bool
)
{
if
traceRange
Map
{
fmt
.
Printf
(
"
\n\n
HasRange:
\n
"
)
fmt
.
Printf
(
"
S: %s
\n
"
,
S
)
fmt
.
Printf
(
"
M: %s
\n
"
,
M
)
fmt
.
Printf
(
" r: %s
\n
"
,
r
)
defer
func
()
{
fmt
.
Printf
(
"->·: %v
\n
"
,
yes
)
}()
}
S
.
verify
()
M
.
verify
()
//
find
first
ilo
:
r
.
lo
<
[
ilo
].
hi
l
:=
len
(
S
.
rangev
)
l
:=
len
(
M
.
rangev
)
ilo
:=
sort
.
Search
(
l
,
func
(
i
int
)
bool
{
return
r
.
Lo
<=
S
.
rangev
[
i
].
Hi_
return
r
.
Lo
<=
M
.
rangev
[
i
].
Hi_
})
debugfRMap
(
"
\t
ilo: %d
\n
"
,
ilo
)
...
...
@@ -261,8 +256,8 @@ func (S *RangedMap) HasRange(r KeyRange) (yes bool) {
return
false
}
//
all
keys
from
r
are
in
S
if
r
∈
[
ilo
]
return
(
S
.
rangev
[
ilo
].
Lo
<=
r
.
Lo
&&
r
.
Hi_
<=
S
.
rangev
[
ilo
].
Hi_
)
//
all
keys
from
r
are
in
M
if
r
∈
[
ilo
]
XXX
not
in
case
of
different
values
return
(
M
.
rangev
[
ilo
].
Lo
<=
r
.
Lo
&&
r
.
Hi_
<=
M
.
rangev
[
ilo
].
Hi_
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment