/** * Adds the list of arcs to the graph model. All nodes included in the arc relationships are * also added to the model if necessary. * * @param arcs */ private void addArcsToModel(Collection<GraphArc> arcs, boolean removeOldNodes) { Set<GraphNode> newGraphNodes = new HashSet<GraphNode>(); for (GraphArc arc : arcs) { GraphArc createdArc = addArc((OWLEntity) arc.getSource().getUserObject(), (OWLEntity) arc.getDestination().getUserObject(), arc.getType().toString(), arc.getIcon()); if (createdArc != null) { newGraphNodes.add(createdArc.getSource()); newGraphNodes.add(createdArc.getDestination()); createdArc.setInverted(arc.isInverted()); //PNode n = (PNode)createdArc.getDestination(); //System.out.println(n.getRoot().getClass()); } } if (removeOldNodes) { // remove all old nodes GraphNode[] allNodes = getAllNodes().toArray(new GraphNode[getAllNodes().size()]); for (GraphNode node : allNodes) { if (!newGraphNodes.contains(node)) { removeNode(node.getUserObject()); } } } }