checkpoint i think it works!
[anneal.git] / src / edu / berkeley / qfat / geom / BindingGroup.java
index 8ea271e..5f6bf2b 100644 (file)
@@ -12,11 +12,16 @@ public class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
         matrices.put(master, Matrix.ONE);
     }
 
+    public int size() { return matrices.size(); }
+
     public void merge(BindingGroup<T> bg, Matrix m) {
+        if (bg==this) throw new Error();
         for(HasBindingGroup hbg : bg.matrices.keySet()) {
             matrices.put((T)hbg, bg.matrices.get(hbg).times(m));
             hbg.bindingGroup = this;
         }
+        for(HasBindingGroup hbg : bg.matrices.keySet())
+            hbg.bindingGroupChanged(this);
         bg.matrices.clear();
         bg.master = null;
     }