home *** CD-ROM | disk | FTP | other *** search
/ Popular Software (Premium Edition) / mycd.iso / INTERNET / NETSCAP4.06 / CP32E406.EXE / netcast.z / ncjava10.jar / netscape / palomar / util / WarningList.class (.txt) < prev   
Encoding:
Java Class File  |  1998-02-26  |  1.7 KB  |  46 lines

  1. package netscape.palomar.util;
  2.  
  3. import java.util.Enumeration;
  4. import java.util.Vector;
  5.  
  6. public class WarningList {
  7.    private Vector _warningList = new Vector();
  8.    public int _warningListSize;
  9.  
  10.    public WarningList(int newSize) {
  11.       this._warningListSize = newSize;
  12.    }
  13.  
  14.    public void addWarning(Warning newWarning) {
  15.       this._warningList.addElement(newWarning);
  16.  
  17.       while(this._warningList.size() > this._warningListSize) {
  18.          this._warningList.removeElementAt(0);
  19.       }
  20.  
  21.       System.out.println("------------------");
  22.       System.out.println(newWarning.toString());
  23.       System.out.println("------------------");
  24.    }
  25.  
  26.    public void addNewWarning(int id, Exception e) {
  27.       while(this._warningList.size() > this._warningListSize) {
  28.          this._warningList.removeElementAt(0);
  29.       }
  30.  
  31.       this._warningList.addElement(new Warning(id, e));
  32.    }
  33.  
  34.    public void removeWarning(Warning newWarning) {
  35.       this._warningList.removeElement(newWarning);
  36.    }
  37.  
  38.    public void removeAllWarnings() {
  39.       this._warningList.removeAllElements();
  40.    }
  41.  
  42.    public Enumeration getWarnings() {
  43.       return this._warningList.elements();
  44.    }
  45. }
  46.