infosapient.system
Class ObservableImpl

java.lang.Object
  |
  +--infosapient.system.ObservableImpl
Direct Known Subclasses:
FzySystemComponent, InfoSapientController, InfoSapientRuleEditor.RuleEditorObservable

public class ObservableImpl
extends java.lang.Object
implements Observable

This class represents an observable object, or "data" in the model-view paradigm.

An observable object can have one or more observers. After an observable instance changes, an application calling the Observable's notifyObservers method causes all of its observers to be notified of the change by a call to their update method.

Version:
$Revision: 1.1.1.1 $
See Also:
Serialized Form

Field Summary
private  Observer[] arr
           
private  boolean changed
           
private  java.util.Vector obs
           
(package private) static long serialVersionUID
           
 
Constructor Summary
ObservableImpl()
          Construct an Observable with zero Observers
 
Method Summary
 void addObserver(Observer o)
          Adds an observer to the set of observers for this object.
 void clearChanged()
          Indicates that this object has no longer changed, or that it has already notified all of its observers of its most recent change.
 boolean containsObserver(Observer o)
          Test if the Observer exists within the list of observers of this object.
 int countObservers()
          Returns the number of observers of this object.
 void deleteObserver(Observer o)
          Deletes an observer from the set of observers of this object.
 void deleteObservers()
          Clears the observer list so that this object no longer has any observers.
 boolean hasChanged()
          Tests if this object has changed.
 void notifyObservers()
          If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.
 void notifyObservers(java.lang.Object arg)
          If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.
 void setChanged()
          Indicates that this object has changed.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID

changed

private boolean changed

obs

private java.util.Vector obs

arr

private Observer[] arr
Constructor Detail

ObservableImpl

public ObservableImpl()
Construct an Observable with zero Observers
Method Detail

addObserver

public void addObserver(Observer o)
Adds an observer to the set of observers for this object.
Specified by:
addObserver in interface Observable
Parameters:
o - an observer to be added.
Since:
JDK1.0

clearChanged

public void clearChanged()
Indicates that this object has no longer changed, or that it has already notified all of its observers of its most recent change. This method is called automatically by the notifyObservers methods.
Specified by:
clearChanged in interface Observable
Since:
JDK1.0
See Also:
infosapient.system.Observable#notifyObservers(), Observable.notifyObservers(java.lang.Object)

containsObserver

public boolean containsObserver(Observer o)
Test if the Observer exists within the list of observers of this object.
Specified by:
containsObserver in interface Observable
Parameters:
the - object to be tested.
Returns:
true if the object exists within the list of observers; else false
Since:
JDK1.0

countObservers

public int countObservers()
Returns the number of observers of this object.
Specified by:
countObservers in interface Observable
Returns:
the number of observers of this object.
Since:
JDK1.0

deleteObserver

public void deleteObserver(Observer o)
Deletes an observer from the set of observers of this object.
Specified by:
deleteObserver in interface Observable
Parameters:
o - the observer to be deleted.
Since:
JDK1.0

deleteObservers

public void deleteObservers()
Clears the observer list so that this object no longer has any observers.
Specified by:
deleteObservers in interface Observable
Since:
JDK1.0

hasChanged

public boolean hasChanged()
Tests if this object has changed.
Specified by:
hasChanged in interface Observable
Returns:
true if the setChanged method has been called more recently than the clearChanged method on this object; false otherwise.
Since:
JDK1.0
See Also:
Observable.clearChanged(), Observable.setChanged()

notifyObservers

public void notifyObservers()
If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.

Each observer has its update method called with two arguments: this observable object and null.

Since:
JDK1.0
See Also:
Observable.clearChanged(), Observable.hasChanged(), Observer.update(infosapient.system.Observable, java.lang.Object)

notifyObservers

public void notifyObservers(java.lang.Object arg)
If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.

Each observer has its update method called with two arguments: this observable object and the arg argument.

Specified by:
notifyObservers in interface Observable
Parameters:
arg - any object.
Since:
JDK1.0
See Also:
Observable.clearChanged(), Observable.hasChanged(), Observer.update(infosapient.system.Observable, java.lang.Object)

setChanged

public void setChanged()
Indicates that this object has changed.
Specified by:
setChanged in interface Observable
Since:
JDK1.0

License to use this program is provided under the TERMS OF THE COMMON PUBLIC LICENSE 0.5. ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.

Copyright (c) 2001, Workplace Performance Tools, All Rights Reserved