Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
e1040cc9
Commit
e1040cc9
authored
Dec 18, 2014
by
Ioannis Papagiannopoulos
Committed by
Jérome Perrin
Feb 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edges updated following the new schema
parent
156dbf4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+12
-7
No files found.
dream/simulation/LineGenerationJSON.py
View file @
e1040cc9
...
...
@@ -85,12 +85,17 @@ def createObjectResourcesAndCoreObjects():
list of object with ID = id
XXX slow implementation
'''
def
getSuccessorList
(
node_id
,
predicate
=
lambda
source
,
destination
,
edge_data
:
True
):
def
getSuccessorList
(
node_id
,
predicate
=
lambda
source
,
destination
,
edge_
class
,
edge_
data
:
True
):
successor_list
=
[]
# dummy variable that holds the list to be returned
for
source
,
destination
,
edge_data
in
edges
.
values
():
# for all the values in the dictionary edges
if
source
==
node_id
:
# for the node_id argument
if
predicate
(
source
,
destination
,
edge_data
):
# find its 'destinations' and
successor_list
.
append
(
destination
)
# append it to the successor list
for
edge
in
edges
.
values
():
source
=
edge
[
"source"
]
destination
=
edge
[
"destination"
]
edge_class
=
edge
[
"_class"
]
edge_data
=
edge
.
get
(
"data"
,
{})
if
source
==
node_id
:
# for the node_id argument
if
predicate
(
source
,
destination
,
edge_class
,
edge_data
):
# find its 'destinations' and
successor_list
.
append
(
destination
)
# append it to the successor list
# XXX We should probably not need to sort, but there is a bug that
# prevents Topology10 to work if this sort is not used.
successor_list
.
sort
()
...
...
@@ -215,9 +220,9 @@ def createObjectResourcesAndCoreObjects():
coreObject
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
# (Below is only for Dismantle for now)
# get the successorList for the 'Parts'
coreObject
.
nextPartIds
=
getSuccessorList
(
element
[
'id'
],
lambda
source
,
destination
,
edge_
data
:
edge_data
.
get
(
'entity'
)
==
'Part'
)
coreObject
.
nextPartIds
=
getSuccessorList
(
element
[
'id'
],
lambda
source
,
destination
,
edge_
class
,
edge_data
:
edge_data
.
get
(
'entity'
,{}
)
==
'Part'
)
# get the successorList for the 'Frames'
coreObject
.
nextFrameIds
=
getSuccessorList
(
element
[
'id'
],
lambda
source
,
destination
,
edge_
data
:
edge_data
.
get
(
'entity'
)
==
'Frame'
)
coreObject
.
nextFrameIds
=
getSuccessorList
(
element
[
'id'
],
lambda
source
,
destination
,
edge_
class
,
edge_data
:
edge_data
.
get
(
'entity'
,{}
)
==
'Frame'
)
# loop through all the core objects
# to read predecessors
...
...
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