}
- public void bindingGroupChanged(BindingGroup newBindingGroup_) {
-
- BindingGroup<E> newBindingGroup = (BindingGroup<E>)newBindingGroup_;
- if (newBindingGroup==null) return;
- //if (this==newBindingGroup.getMaster()) return;
+ public void bindingGroupChanged() {
HashSet<E> nbg = new HashSet<E>();
- for(E eother : (Iterable<E>)newBindingGroup) nbg.add(eother);
+ for(E eother : (Iterable<E>)getBoundPeers()) nbg.add(eother);
for(E eother : nbg) {
if (next==null || prev==null) continue;
if (eother.next==null || eother.prev==null) continue;
import javax.media.opengl.*;
import java.util.*;
-/** tracks an equivalence class of geometric objects which are related to each other by transformation matrices */
-public class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
+/**
+ * An equivalence class of geometric objects whose positions are
+ * related by affine transformation matrices and are constrained by
+ * an affine constraint.
+ */
+class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
private T master = null;
private AffineConstraint constraint = new AffineConstraint.All();
matrices.put(master, Matrix.ONE);
}
- public int size() { return matrices.size(); }
+ int size() { return matrices.size(); }
- public void merge(BindingGroup<T> bg, Matrix m) {
+ /** merge another binding group with this one */
+ void merge(BindingGroup<T> bg, Matrix m) {
if (bg==this) {
if (m.equalsModuloEpsilon(Matrix.ONE, 0.001f)) return;
constraint = constraint.intersect(m.getAffineConstraint(0.001f), 0.001f);
bg.matrices.clear();
bg.master = null;
for(HasBindingGroup hbg : stuff)
- hbg.bindingGroupChanged(this);
+ hbg.bindingGroupChanged();
}
public Matrix getMatrix(T t) { return matrices.get(t); }
if (bindingGroup==null) return;
bindingGroup.unbind(this);
bindingGroup = null;
- bindingGroupChanged(bindingGroup);
+ bindingGroupChanged();
}
public boolean isBoundTo(HasBindingGroup t) {
if (bindingGroup==null) bindingGroup = new BindingGroup(this);
return bindingGroup;
}
- public void bindingGroupChanged(BindingGroup newBindingGroup) { }
+ public void bindingGroupChanged() { }
}