Vertex q = pair.getQ();
Vertex qDash = pair.getR();
Iterator<DirectedSparseEdge> inEdges = q.getInEdges().iterator();
Set<DirectedSparseEdge> removeEdges = new HashSet<DirectedSparseEdge>();
while(inEdges.hasNext()){
DirectedSparseEdge e = inEdges.next();
DirectedSparseEdge eDash = new DirectedSparseEdge(e.getSource(), qDash);
eDash.addUserDatum(JUConstants.LABEL, e.getUserDatum(JUConstants.LABEL), UserData.CLONE);
if(!e.getSource().getSuccessors().contains(qDash))
model.addEdge(eDash);
else{
Edge existing = findEdge(e.getSource(), qDash);
Set<String> labels = (Set<String>)existing.getUserDatum(JUConstants.LABEL);// KIRR: if you use UserData.SHARED, you do not need to copy the result back using put
labels.addAll((Set<String>)e.getUserDatum(JUConstants.LABEL));
existing.setUserDatum(JUConstants.LABEL, labels, UserData.CLONE);
}
removeEdges.add(e);
}
Iterator<DirectedSparseEdge> outEdges = q.getOutEdges().iterator();
while(outEdges.hasNext()){
DirectedSparseEdge e = outEdges.next();
DirectedSparseEdge eDash = new DirectedSparseEdge(qDash, e.getDest());
eDash.addUserDatum(JUConstants.LABEL, e.getUserDatum(JUConstants.LABEL), UserData.CLONE);
if(!qDash.getSuccessors().contains(e.getDest()))
model.addEdge(eDash);
else{
Edge existing = findEdge(qDash, e.getDest());
Set<String> labels = (Set<String>)existing.getUserDatum(JUConstants.LABEL);