FileDocCategorySizeDatePackage
Observable.javaAPI DocAndroid 1.5 API2123Wed May 06 22:42:46 BST 2009com.android.mms.transaction

Observable

public abstract class Observable extends Object
An interface to represent the state of an observable Transaction.

Fields Summary
private final ArrayList
mObservers
private Iterator
mIterator
Constructors Summary
public Observable()

        mObservers = new ArrayList<Observer>();
    
Methods Summary
public voidattach(Observer observer)
Attach an observer to this object.

param
observer The observer object to be attached to.

        mObservers.add(observer);
    
public voiddetach(Observer observer)
Detach an observer from this object.

param
observer The observer object to be detached from.

        if (mIterator != null) {
            mIterator.remove();
        } else {
            mObservers.remove(observer);
        }
    
public abstract TransactionStategetState()
This method is implemented by the observable to represent its current state.

return
A TransactionState object.

public voidnotifyObservers()
Notify all observers that a status change has occurred.

        mIterator = mObservers.iterator();
        try {
            while (mIterator.hasNext()) {
                mIterator.next().update(this);
            }
        } finally {
            mIterator = null;
        }