Latest News

 










Observer Example (3/4)

Previous slide Next slide Back to first slide View graphic version


Observer Example (3/4)


 
My other sites

Latest News

 










Observer Example (3/4)

    import java.util.*;


    public class FileSystemMonitor {

    private Vector myApps = new Vector();

    public void addApplication(int app) {

    myApps.addElement(new Integer(app));

    }

    public void removeApplication(int app) {

    myApps.removeElement(new Integer(app));

    }

    public void refresh(int application) {

    for (Enumeration e = myApps.elements(); e.hasMoreElements();) {

    Integer tempApp = (Integer)e.nextElement();

    if (tempApp.intValue() == application) {

    System.out.println("Sending refresh message to application " + application);

    }

    }

    }

    }

Previous slide Next slide Back to first slide View graphic version