public static IAssociationListener Remove(IAssociationListener l, IAssociationListener oldl) { if (l == oldl || l == null) { return null; } if (l is Multicaster) { return ((Multicaster) l).Remove(oldl); } return null; }
public static IAssociationListener add(IAssociationListener a, IAssociationListener b) { if (a == null) { return b; } if (b == null) { return a; } return new Multicaster(a, b); }
public void RemoveAssociationListener(IAssociationListener l) { fsm.RemoveAssociationListener(l); }
public void AddAssociationListener(IAssociationListener l) { fsm.AddAssociationListener(l); }
public Multicaster(IAssociationListener a, IAssociationListener b) { this.a = a; this.b = b; }
private IAssociationListener Remove(IAssociationListener oldl) { if (oldl == a) { return b; } if (oldl == b) { return a; } IAssociationListener a2 = Remove(a, oldl); IAssociationListener b2 = Remove(b, oldl); if (a2 == a && b2 == b) { return this; } return add(a2, b2); }
public void RemoveAssociationListener(IAssociationListener l) { lock (this) { assocListener = Multicaster.Remove(assocListener, l); } }
public void AddAssociationListener(IAssociationListener l) { lock (this) { assocListener = Multicaster.add(assocListener, l); } }