Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Q
query-conversion
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GraphPolaris
query-conversion
Commits
0d763185
Commit
0d763185
authored
3 years ago
by
Jonge,J. de (Joes)
Browse files
Options
Downloads
Patches
Plain Diff
belowappend changed with copy
parent
6129692e
No related branches found
No related tags found
1 merge request
!1
Big merge
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aql/hierarchy.go
+15
-12
15 additions, 12 deletions
aql/hierarchy.go
with
15 additions
and
12 deletions
aql/hierarchy.go
+
15
−
12
View file @
0d763185
...
...
@@ -395,7 +395,7 @@ func addOneFilter(filterPDict pdict, JSONQuery *entity.IncomingQueryJSON, p pdic
if
len
(
listoflists
)
>
l
+
1
&&
listoflists
[
l
+
1
][
0
]
.
typename
==
"filter"
{
listoflists
[
l
+
1
]
=
append
(
listoflists
[
l
+
1
],
filterPDict
)
}
else
{
BelowAppend
(
l
,
k
)
listoflists
=
BelowAppend
(
listoflists
,
l
,
k
)
}
(
*
filterDone
)[
filterPDict
.
pointer
]
=
true
}
else
if
p
.
typename
==
"filter"
{
...
...
@@ -409,7 +409,7 @@ func addOneFilter(filterPDict pdict, JSONQuery *entity.IncomingQueryJSON, p pdic
if
len
(
listoflists
)
>
l
+
1
&&
listoflists
[
l
+
1
][
0
]
.
typename
==
"filter"
{
listoflists
[
l
+
1
]
=
append
(
listoflists
[
l
+
1
],
filterPDict
)
}
else
{
BelowAppend
(
l
,
k
)
listoflists
=
BelowAppend
(
listoflists
,
l
,
k
)
}
(
*
filterDone
)[
filterPDict
.
pointer
]
=
true
}
else
{
...
...
@@ -418,28 +418,31 @@ func addOneFilter(filterPDict pdict, JSONQuery *entity.IncomingQueryJSON, p pdic
if
len
(
listoflists
)
>
l
+
1
&&
listoflists
[
l
+
1
][
0
]
.
typename
==
"filter"
{
listoflists
[
l
+
1
]
=
append
(
listoflists
[
l
+
1
],
filterPDict
)
}
else
{
BelowAppend
(
l
,
k
)
listoflists
=
BelowAppend
(
listoflists
,
l
,
k
)
}
(
*
filterDone
)[
filterPDict
.
pointer
]
=
true
}
}
// A function that appends 1 level above (if index is 0 this won't work)
func
AboveAppend
(
index
int
,
value
[]
pdict
)
[][]
pdict
{
func
AboveAppend
(
list
[][]
pdict
,
index
int
,
value
[]
pdict
)
[][]
pdict
{
if
index
==
0
{
return
prepend
(
list
oflists
,
value
)
return
prepend
(
list
,
value
)
}
return
BelowAppend
(
index
-
1
,
value
)
return
BelowAppend
(
list
,
index
-
1
,
value
)
}
// A function that appends 1 level below (thanks to wasmup on stackoverflow)
func
BelowAppend
(
index
int
,
value
[]
pdict
)
[][]
pdict
{
if
len
(
list
oflist
s
)
==
index
{
// nil or empty slice or after last element
return
append
(
listof
lists
,
value
)
func
BelowAppend
(
lists
[][]
pdict
,
index
int
,
value
[]
pdict
)
[][]
pdict
{
if
len
(
lists
)
-
1
==
index
{
// nil or empty slice or after last element
return
append
(
lists
,
value
)
}
listoflists
=
append
(
listoflists
[
:
index
+
1
],
listoflists
[
index
:
]
...
)
// index < len(a)
listoflists
[
index
]
=
value
return
listoflists
k
:=
make
([][]
pdict
,
len
(
lists
[
index
+
1
:
]))
copy
(
k
,
lists
[
index
+
1
:
])
l
:=
make
([][]
pdict
,
len
(
lists
[
:
index
+
1
]))
copy
(
l
,
lists
[
:
index
+
1
])
lists
=
append
(
l
,
value
)
// index < len(a)
return
append
(
lists
,
k
...
)
}
// A simple double-for loop that finds the layer in which an element resides in the hierarchy
...
...
This diff is collapsed.
Click to expand it.
Heijden,T.A.J. van der (Thijs)
@t.a.j.vanderheijden
mentioned in commit
82d6956b
·
3 years ago
mentioned in commit
82d6956b
mentioned in commit 82d6956b25f2a5a9942b9ef3014309c1aefed134
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment