Map<CmpVertex,DeterministicVertex> oldToNew = new HashMap<CmpVertex,DeterministicVertex>();
// add states
for(Entry<CmpVertex,Map<CmpVertex,Set<String>>> entry:coregraph.learnerCache.getFlowgraph().entrySet())
{
CmpVertex source = entry.getKey();
DeterministicVertex vert = (DeterministicVertex)LearnerGraph.cloneCmpVertex(source,cloneConfig);
if (coregraph.init == source)
vert.addUserDatum(JUConstants.INITIAL, true, UserData.SHARED);
result.addVertex(vert);
oldToNew.put(source,vert);
}
// now add transitions
for(Entry<CmpVertex,Map<CmpVertex,Set<String>>> entry:coregraph.learnerCache.getFlowgraph().entrySet())
{
DeterministicVertex source = oldToNew.get(entry.getKey());
for(Entry<CmpVertex,Set<String>> tgtEntry:entry.getValue().entrySet())
{
CmpVertex targetOld = tgtEntry.getKey();
assert coregraph.findVertex(targetOld.getID()) == targetOld : "was looking for vertex with name "+targetOld.getID()+", got "+coregraph.findVertex(targetOld.getID());
DeterministicVertex target = oldToNew.get(targetOld);
DeterministicEdge e = new DeterministicEdge(source,target);
e.addUserDatum(JUConstants.LABEL, tgtEntry.getValue(), UserData.CLONE);
result.addEdge(e);
}
}