From 767b5648bad2100b7ba231d1d0f97b20fae7cd9a Mon Sep 17 00:00:00 2001 From: anneetien Date: Fri, 23 Aug 2024 16:23:47 +0200 Subject: [PATCH] adding the ability to ask to an entity all its tagged entities and same for a mooseGroup. tests are missing --- src/Famix-Tagging/MooseEntity.extension.st | 17 +++++++++++++++++ src/Famix-Tagging/MooseGroup.extension.st | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/src/Famix-Tagging/MooseEntity.extension.st b/src/Famix-Tagging/MooseEntity.extension.st index 70892b2..31f14b5 100644 --- a/src/Famix-Tagging/MooseEntity.extension.st +++ b/src/Famix-Tagging/MooseEntity.extension.st @@ -20,6 +20,23 @@ MooseEntity >> allTagAssociations: aCollection [ self allTagAssociations value: aCollection ] +{ #category : #'*Famix-Tagging' } +MooseEntity >> allTaggedEntities [ + | taggedEntities | + + taggedEntities := OrderedCollection new. + self allTaggedEntitiesIn: taggedEntities . + ^ taggedEntities . + +] + +{ #category : #'*Famix-Tagging' } +MooseEntity >> allTaggedEntitiesIn: anOrderedCollection [ + self isTagged ifTrue: [ anOrderedCollection add: self ]. + self children do: [ :c | c allTaggedEntitiesIn: anOrderedCollection ]. + ^anOrderedCollection +] + { #category : #'*Famix-Tagging' } MooseEntity >> allTags [ "all tags on me" diff --git a/src/Famix-Tagging/MooseGroup.extension.st b/src/Famix-Tagging/MooseGroup.extension.st index 393d57a..0c8ced1 100644 --- a/src/Famix-Tagging/MooseGroup.extension.st +++ b/src/Famix-Tagging/MooseGroup.extension.st @@ -1,5 +1,10 @@ Extension { #name : #MooseGroup } +{ #category : #'*Famix-Tagging' } +MooseGroup >> allTaggedEntities [ + self entities flatCollectAsSet: #allTaggedEntities. +] + { #category : #'*Famix-Tagging' } MooseGroup >> tagEntitiesWith: aTag [