home *** CD-ROM | disk | FTP | other *** search
- package sun.net;
-
- import java.net.URL;
- import java.util.Observable;
-
- public class ProgressData extends Observable {
- public static ProgressData pdata = new ProgressData();
- public static final int NEW = 0;
- public static final int CONNECTED = 1;
- public static final int UPDATE = 2;
- public static final int DELETE = 3;
- private ProgressEntry[] streams = new ProgressEntry[20];
-
- public synchronized ProgressEntry[] getStreams() {
- return (ProgressEntry[])this.streams.clone();
- }
-
- public void register(ProgressEntry var1) {
- boolean var3 = false;
-
- for(int var2 = 0; var2 < this.streams.length; ++var2) {
- synchronized(this) {
- if (this.streams[var2] == null) {
- this.streams[var2] = var1;
- var1.what = 0;
- var1.index = var2;
- var3 = true;
- break;
- }
- }
- }
-
- if (var3) {
- ((Observable)this).setChanged();
- ((Observable)this).notifyObservers(var1);
- }
-
- }
-
- public void connected(URL var1) {
- }
-
- public void unregister(ProgressEntry var1) {
- synchronized(this) {
- int var3 = var1.index;
- if (var3 < 0 || var3 > this.streams.length || this.streams[var3] != var1) {
- return;
- }
-
- var1.what = 3;
- this.streams[var3] = null;
- ((Observable)this).setChanged();
- }
-
- ((Observable)this).notifyObservers(var1);
- }
-
- public void update(ProgressEntry var1) {
- synchronized(this) {
- int var3 = var1.index;
- if (var3 < 0 || var3 > this.streams.length || this.streams[var3] != var1) {
- return;
- }
-
- var1.what = 2;
- if (!var1.connected()) {
- var1.what = 1;
- }
-
- if (var1.read >= var1.need && var1.read != 0) {
- this.streams[var3] = null;
- var1.what = 3;
- }
-
- ((Observable)this).setChanged();
- }
-
- ((Observable)this).notifyObservers(var1);
- }
- }
-