private void removeEdge(Vertex v) { Set<Edge> edges = UMLG.get().getEdgesBetween(this.vertex, v, this.getLabel()); for (Edge edge : edges) { Vertex associationClassVertex = UMLG.get().v(edge.value(UmlgCollection.ASSOCIATION_CLASS_VERTEX_ID)); // The remove code will delete all in and out edges associationClassVertex.remove(); } }
@Override public boolean remove(Object o) { maybeLoad(); Vertex v; if (o instanceof UmlgNode) { UmlgNode node = (UmlgNode) o; v = node.getVertex(); removeEdge(v); } else if (o.getClass().isEnum()) { v = removeFromInternalMap(o); removeEdge(v); v.remove(); } else if (isOnePrimitive() || getDataTypeEnum() != null) { throw new IllegalStateException( "one primitive or data type can not have an association class."); } else { v = removeFromInternalMap(o); removeEdge(v); v.remove(); } return super.remove(o); }