/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public abstract class ImageWatched {
public ImageWatched() {
}
/*
* This class defines a node on a linked list of ImageObservers.
* The base class defines the dummy implementation used for the
* last link on all chains and a subsequent subclass then
* defines the standard implementation that manages a weak
* reference to a real ImageObserver.
*/
public static class Link {
/*
* Check if iw is the referent of this Link or any
* subsequent Link objects on this chain.
*/
return false; // No "iw" down here.
}
/*
* Remove this Link from the chain if its referent
* is the indicated target or if it has been nulled
* out by the garbage collector.
* Return the new remainder of the chain.
* The argument may be null which will trigger
* the chain to remove only the dead (null) links.
* This method is only ever called inside a
* synchronized block so Link.next modifications
* will be safe.
*/
return this; // Leave me as the end link.
}
/*
* Deliver the indicated image update information
* to the referent of this Link and return a boolean
* indicating whether or not some referent became
* null or has indicated a lack of interest in
* further updates to its imageUpdate() method.
* This method is not called inside a synchronized
* block so Link.next modifications are not safe.
*/
int x, int y, int w, int h)
{
return false; // No disinterested parties down here.
}
}
/*
* Standard Link implementation to manage a Weak Reference
* to an ImageObserver.
*/
}
}
// Remove me from the chain, but continue recursion.
}
// At this point myiw is not null so we know this test will
// never succeed if this is a pruning pass (iw == null).
// Remove me from the chain and end the recursion here.
return next;
}
// I am alive, but not the one to be removed, recurse
// and update my next link and leave me in the chain.
return this;
}
int x, int y, int w, int h)
{
// Note tail recursion because items are added LIFO.
// My referent is null so we must prune in a second pass.
ret = true;
// My referent has lost interest so clear it and ask
// for a pruning pass to remove it later.
ret = true;
}
return ret;
}
}
}
}
}
synchronized (this) {
}
if (watcherList == endlink) {
}
}
public boolean isWatcherListEmpty() {
synchronized (this) {
}
return (watcherList == endlink);
}
// Some Link returned true so we now need to prune dead links.
}
}
protected abstract void notifyWatcherListEmpty();
}