Skip to content

Commit

Permalink
Merge pull request #859 from jecisc/speedup-isRoot
Browse files Browse the repository at this point in the history
Speedup #isRoot
  • Loading branch information
jecisc authored Dec 6, 2024
2 parents 0f8d805 + b9bcc69 commit f5200e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Moose-Query/TEntityMetaLevelDependency.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -707,12 +707,15 @@ TEntityMetaLevelDependency >> isQueryable [

{ #category : #testing }
TEntityMetaLevelDependency >> isRoot [
"Old implementation: self parents isEmpty
This implementation is faster."

<FMProperty: #isRoot type: #Boolean>
<derived>
<FMComment:
'An entity is root if it has no parent in the model. This is useful for example to be able to build visualization where the displayed elements are the roots of the model and to let those elements be expanded to display their children.'>
^ self parents isEmpty
self parentsDo: [ :parent | ^ false ].
^ true
]

{ #category : #accessing }
Expand Down

0 comments on commit f5200e7

Please sign in to comment.