Exemplo n.º 1
0
 /** Get the snapshot of union find */
 ImmutableMap<ECR, Collection<IRVar>> snapshot() {
   SetMultimap<Partition, IRVar> map = uf.snapshot();
   ImmutableMap.Builder<ECR, Collection<IRVar>> builder = ImmutableMap.builder();
   for (Partition ecr : map.asMap().keySet()) {
     builder.put(findRoot((ECR) ecr), ImmutableSet.copyOf(map.asMap().get(ecr)));
   }
   return builder.build();
 }
Exemplo n.º 2
0
 /**
  * ECR-union e1 and e2, return the updated root
  *
  * @param e1
  * @param e2
  * @return
  */
 private ECR union(ECR e1, ECR e2) {
   uf.union(e1, e2);
   return findRoot(e1);
 }
Exemplo n.º 3
0
 /**
  * Add <code>var</code> into union find
  *
  * @param var
  */
 void add(VarImpl var) {
   uf.add(var, var.getECR());
 }
Exemplo n.º 4
0
 Collection<IRVar> getEquivClass(ECR key) {
   return uf.getEquivClass(key);
 }
Exemplo n.º 5
0
 void reset() {
   uf.reset();
 }
Exemplo n.º 6
0
 private UnionFindECR() {
   uf = UnionFind.create();
 }