Example #1
0
  /** Removes all elements that have no relationships to other elements in this view. */
  public void removeElementsWithNoRelationships() {
    Set<RelationshipView> relationships = getRelationships();

    Set<String> elementIds = new HashSet<>();
    relationships.forEach(rv -> elementIds.add(rv.getRelationship().getSourceId()));
    relationships.forEach(rv -> elementIds.add(rv.getRelationship().getDestinationId()));

    for (ElementView elementView : getElements()) {
      if (!elementIds.contains(elementView.getId())) {
        removeElement(elementView.getElement());
      }
    }
  }
Example #2
0
 public void remove(Element element) {
   removeElement(element);
 }