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