Beispiel #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();
 }
Beispiel #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);
 }
Beispiel #3
0
 /**
  * Add <code>var</code> into union find
  *
  * @param var
  */
 void add(VarImpl var) {
   uf.add(var, var.getECR());
 }
Beispiel #4
0
 Collection<IRVar> getEquivClass(ECR key) {
   return uf.getEquivClass(key);
 }
Beispiel #5
0
 void reset() {
   uf.reset();
 }
Beispiel #6
0
 private UnionFindECR() {
   uf = UnionFind.create();
 }