diff options
| author | Benjamin Culkin <scorpress@gmail.com> | 2024-05-20 17:58:16 -0400 |
|---|---|---|
| committer | Benjamin Culkin <scorpress@gmail.com> | 2024-05-20 17:58:16 -0400 |
| commit | 40a9d99496e098562f090fb7ffce9e749011b131 (patch) | |
| tree | 437df24d65470582e943e494a52db8ed65a881ae /projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EODelayedObserver.java | |
| parent | ff072dfe782f6f22123cd4ba050828d35c0d0fbd (diff) | |
Formatting pass
Diffstat (limited to 'projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EODelayedObserver.java')
| -rw-r--r-- | projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EODelayedObserver.java | 209 |
1 files changed, 93 insertions, 116 deletions
diff --git a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EODelayedObserver.java b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EODelayedObserver.java index 758fb40..b947a82 100644 --- a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EODelayedObserver.java +++ b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EODelayedObserver.java @@ -22,131 +22,108 @@ import java.util.Observable; import java.util.Observer; /** -* This is an abstract class for receiving coalesced -* notifications of changes from objects. -* This class also implements Observer for greater -* compatibility. -* The point of EODelayedObservers is that when -* they receive a willChange message, they -* queue themselves with a EODelayedObserverQueue -* so they can receive a single subjectChanged() -* after all changes from an observed object take -* place. -* -* @author michael@mpowers.net -* @author $Author: cgruber $ -* @version $Revision: 894 $ -*/ -public abstract class EODelayedObserver - implements EOObserving, Observer -{ - /** - * Notified immediately. - */ - public static final int ObserverPriorityImmediate = 0; - public static final int ObserverPriorityFirst = 1; - public static final int ObserverPrioritySecond = 2; - public static final int ObserverPriorityThird = 3; - public static final int ObserverPriorityFourth = 4; - public static final int ObserverPriorityFifth = 5; - public static final int ObserverPrioritySixth = 6; - public static final int ObserverPriorityLater = 7; - public static final int ObserverNumberOfPriorities = 8; - - /** - * Default constructor. - */ - public EODelayedObserver () - { - } - - /** - * Removes this observer from the observer queue - * for a currently pending notification. - */ - public void discardPendingNotification () - { - observerQueue().dequeueObserver( this ); - } - - /** - * Returns the observer queue to which this observer - * belongs. This implementation returns the default - * EODelayedObserverQueue. - * Override to use a different one. - */ - public EODelayedObserverQueue observerQueue () - { - return EODelayedObserverQueue.defaultObserverQueue(); - } - - /** - * Returns the priority of this observer in the queue. - * This implementation returns ObserverPriorityThird. - * Override to be notified before other observers. - */ - public int priority () - { - return ObserverPriorityThird; - } - - /** - * Notifies observer that one or more objects that - * it is observing have changed. The observer should - * check all objects it is observing for changes. - */ - public abstract void subjectChanged (); - - // interface EOObserving - - /** - * Called when the specified object is about to change. - * This implementation puts this observer on a - * notification queue. - */ - public void objectWillChange ( Object anObject ) - { - observerQueue().enqueueObserver( this ); - } - - // interface Observer - - /** - * Called when the specified object has changed, - * with the specified argument. - * This method is included for interacting with - * the java.lang.Observer pattern. - * This implementation simply objectWillChange(anObject) - * so that the observer still gets a single subjectChanged - * call in response to multiple changes. - */ - public void update ( Observable anObject, Object aValue ) - { - objectWillChange( anObject ); - } + * This is an abstract class for receiving coalesced notifications of changes + * from objects. This class also implements Observer for greater compatibility. + * The point of EODelayedObservers is that when they receive a willChange + * message, they queue themselves with a EODelayedObserverQueue so they can + * receive a single subjectChanged() after all changes from an observed object + * take place. + * + * @author michael@mpowers.net + * @author $Author: cgruber $ + * @version $Revision: 894 $ + */ +public abstract class EODelayedObserver implements EOObserving, Observer { + /** + * Notified immediately. + */ + public static final int ObserverPriorityImmediate = 0; + public static final int ObserverPriorityFirst = 1; + public static final int ObserverPrioritySecond = 2; + public static final int ObserverPriorityThird = 3; + public static final int ObserverPriorityFourth = 4; + public static final int ObserverPriorityFifth = 5; + public static final int ObserverPrioritySixth = 6; + public static final int ObserverPriorityLater = 7; + public static final int ObserverNumberOfPriorities = 8; + + /** + * Default constructor. + */ + public EODelayedObserver() { + } + + /** + * Removes this observer from the observer queue for a currently pending + * notification. + */ + public void discardPendingNotification() { + observerQueue().dequeueObserver(this); + } + + /** + * Returns the observer queue to which this observer belongs. This + * implementation returns the default EODelayedObserverQueue. Override to use a + * different one. + */ + public EODelayedObserverQueue observerQueue() { + return EODelayedObserverQueue.defaultObserverQueue(); + } + + /** + * Returns the priority of this observer in the queue. This implementation + * returns ObserverPriorityThird. Override to be notified before other + * observers. + */ + public int priority() { + return ObserverPriorityThird; + } + + /** + * Notifies observer that one or more objects that it is observing have changed. + * The observer should check all objects it is observing for changes. + */ + public abstract void subjectChanged(); + + // interface EOObserving + + /** + * Called when the specified object is about to change. This implementation puts + * this observer on a notification queue. + */ + public void objectWillChange(Object anObject) { + observerQueue().enqueueObserver(this); + } + + // interface Observer + + /** + * Called when the specified object has changed, with the specified argument. + * This method is included for interacting with the java.lang.Observer pattern. + * This implementation simply objectWillChange(anObject) so that the observer + * still gets a single subjectChanged call in response to multiple changes. + */ + public void update(Observable anObject, Object aValue) { + objectWillChange(anObject); + } } /* - * $Log$ - * Revision 1.2 2006/02/16 16:47:14 cgruber - * Move some classes in to "internal" packages and re-work imports, etc. + * $Log$ Revision 1.2 2006/02/16 16:47:14 cgruber Move some classes in to + * "internal" packages and re-work imports, etc. * - * Also use UnsupportedOperationExceptions where appropriate, instead of WotonomyExceptions. + * Also use UnsupportedOperationExceptions where appropriate, instead of + * WotonomyExceptions. * - * Revision 1.1 2006/02/16 13:19:57 cgruber - * Check in all sources in eclipse-friendly maven-enabled packages. + * Revision 1.1 2006/02/16 13:19:57 cgruber Check in all sources in + * eclipse-friendly maven-enabled packages. * - * Revision 1.2 2001/10/26 18:38:10 mpowers - * Reordered priorities. + * Revision 1.2 2001/10/26 18:38:10 mpowers Reordered priorities. * - * Revision 1.1.1.1 2000/12/21 15:46:38 mpowers - * Contributing wotonomy. + * Revision 1.1.1.1 2000/12/21 15:46:38 mpowers Contributing wotonomy. * - * Revision 1.3 2000/12/20 16:25:35 michael - * Added log to all files. + * Revision 1.3 2000/12/20 16:25:35 michael Added log to all files. * * */ - - |
