A utility class to provide management for informing ChangeListeners of ChangeEvents.

Namespace:  BioSharp.Core.Utils
Assembly:  BioSharp.Core (in BioSharp.Core.dll) Version: 0.1.3191.26120 (0.1.0.0)

Syntax

C#
public class ChangeSupport

Remarks

This is loosely modelled after the standard PropertyChangeEvent objects.

For an object to correctly fire these events, they must follow a broad outline like this:

CopyC#
public void mutator(foo arg) throw ChangeVetoException {
  ChangeEvent cevt = new ChangeEvent(this, SOME_EVENT_TYPE, arg);
  synchronized(changeSupport) {
    changeSupport.firePreChangeEvent(cevt);
    // update our state using arg
    // ...
    changeSupport.firePostChangeEvent(cevt);
  }
}

The methods that delegate adding and removing listeners to a ChangeSupport must take responsibility for synchronizing on the delegate.

Original BioJava version by Matthew Pocock, Thomas Down, Keith James (docs), and Kalle Naslund (tiny bugfix). Port to C# by Doug Swisher.

Inheritance Hierarchy

System..::.Object
  BioSharp.Core.Utils..::.ChangeSupport

See Also