Entry<Link, RuleGraph> entry1 = children.next();
Entry<Link, RuleGraph> entry2 = children.next();
Node a = entry1.getValue().getRoot();
Node b = entry2.getValue().getRoot();
get(rhs,a).add(new Site(a.getName(), entry1.getKey().getDst(), null, ""+i));
get(rhs,b).add(new Site(b.getName(), entry2.getKey().getDst(), null, ""+i));
i++;
q.add(entry1.getValue());
q.add(entry2.getValue());
} else {
ordering.add(root);
String agent = root.getName();
List<Site> sitesL = get(lhs, root);
List<Site> sitesR = get(rhs, root);
addAll(sitesL, root.getSitesL());
addAll(sitesR, root.getSitesR());
for(Entry<Link, RuleGraph> e : sorted(graph.getChildren())){
if (e.getValue() == null){
String siteName = e.getKey().getSrc();
sitesL.add(new Site(agent, siteName, null, "_"));
sitesR.add(new Site(agent, siteName, null, "_"));
} else {
if (!lhs.containsKey(e.getValue().getRoot())){
q.add(e.getValue());
}
String src = e.getKey().getSrc();
sitesL.add(new Site(agent, src, null, ""+i));
sitesR.add(new Site(agent, src, null, ""+i));
Node root2 = e.getValue().getRoot();
String dst = e.getKey().getDst();
get(lhs, root2).add(new Site(root2.getName(), dst, null, ""+i));
get(rhs, root2).add(new Site(root2.getName(), dst, null, ""+i));
i++;
}
}
}
}