*
* @param entities The list of parent entities to remove from the graph.
* @return Removed entities and associations.
*/
public EditResult removeEntitiesAndAssociations(List<AbstractFamixEntity> entities) {
EditResult editResult;
List<AbstractFamixEntity> involvedEntites = new ArrayList<AbstractFamixEntity>();
for (AbstractFamixEntity entity : entities) {
involvedEntites.addAll(getSnapshotAnalyzer().getDescendants(entity));
}
List<FamixAssociation> associations = getSnapshotAnalyzer().queryAssociationsBetweenEntities(involvedEntites, null);
List<FamixAssociation> associationsToOtherEntities = getAssociationsToOtherGraphEntities(involvedEntites, null);
associations.addAll(associationsToOtherEntities);
editResult = removeAssociations(associations);
List<AbstractFamixEntity> removedEntities = new ArrayList<AbstractFamixEntity>();
for (AbstractFamixEntity entity : involvedEntites) {
if (fGraph.removeFamixEntity(entity)) {
removedEntities.add(entity);
}
}
return new EditResult(removedEntities, editResult.getAssociations());
}