Skip to content

Commit

Permalink
getAllChildren()
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellifTelus committed Oct 25, 2022
1 parent 13363d7 commit 7149f63
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ abstract class Aggregate(private val aggregateName: String) {
return children.filter { it is T && key == it.key }[0] as T
}

inline fun <reified T> getAllChildren(): Set<T> {
return children.filter { it is T }.toSet() as Set<T>
}

open fun getChildIndex(aggregate: Aggregate): Int {
return children.subList(0, children.indexOf(aggregate)).count { aggregate::class.isInstance(it) }
}
Expand Down

0 comments on commit 7149f63

Please sign in to comment.