allModelElements property

Iterable<ModelElement> allModelElements

Implementation

Iterable<ModelElement> get allModelElements {
  assert(allLibrariesAdded);
  if (_allModelElements == null) {
    _allModelElements = [];
    var packagesToDo = packages.toSet();
    var completedPackages = <Package>{};
    while (packagesToDo.length > completedPackages.length) {
      packagesToDo.difference(completedPackages).forEach((Package p) {
        var librariesToDo = p.allLibraries.toSet();
        var completedLibraries = <Library>{};
        while (librariesToDo.length > completedLibraries.length) {
          librariesToDo
              .difference(completedLibraries)
              .forEach((Library library) {
            _allModelElements.addAll(library.allModelElements);
            completedLibraries.add(library);
          });
          librariesToDo.addAll(p.allLibraries);
        }
        completedPackages.add(p);
      });
      packagesToDo.addAll(packages);
    }
  }
  return _allModelElements;
}