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
b4e2d678
Commit
b4e2d678
authored
3 years ago
by
Kieran van Gaalen
Browse files
Options
Downloads
Patches
Plain Diff
Implemented aboveappend and belowappend
parent
98cd78b5
No related branches found
Branches containing commit
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
+14
-8
14 additions, 8 deletions
aql/hierarchy.go
with
14 additions
and
8 deletions
aql/hierarchy.go
+
14
−
8
View file @
b4e2d678
...
...
@@ -369,16 +369,22 @@ func FuncToAllRel(JSONQuery *entity.IncomingQueryJSON, function pdict) {
}
}
// TODO
// Write a function that appends 1 level above
func
AboveAppend
()
{
// A function that appends 1 level above (if index is 0 this won't work)
func
AboveAppend
(
index
int
,
value
[]
pdict
)
[][]
pdict
{
if
index
==
0
{
return
prepend
(
listoflists
,
value
)
}
return
BelowAppend
(
index
-
1
,
value
)
}
// TODO
// Write a function that appends 1 level below
func
BelowAppend
()
{
// A function that appends 1 level below (thanks to wasmup on stackoverflow)
func
BelowAppend
(
index
int
,
value
[]
pdict
)
[][]
pdict
{
if
len
(
listoflists
)
==
index
{
// nil or empty slice or after last element
return
append
(
listoflists
,
value
)
}
listoflists
=
append
(
listoflists
[
:
index
+
1
],
listoflists
[
index
:
]
...
)
// index < len(a)
listoflists
[
index
]
=
value
return
listoflists
}
// 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