home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / unuy2wen / cybcerone / main / tsolexception.java < prev    next >
Encoding:
Java Source  |  1996-08-14  |  1.1 KB  |  53 lines

  1. // TsolException.java
  2. // 22.03.96
  3. //
  4. // on one of these days, use Sunday hours
  5.  
  6. package cybcerone.main;
  7.  
  8. import java.io.DataInputStream;
  9. import java.io.IOException;
  10.  
  11. import cybcerone.utils.Date;
  12. import cybcerone.utils.Literate;
  13.  
  14. /** 
  15.  * These are holidays where the metro runs according to Sunday hours.
  16.  */
  17. class TsolException implements Literate {
  18.   private Date theDate;
  19.  
  20.   private String line;  /* for reading */
  21.  
  22.   public TsolException (Date theDate) {
  23.     this.theDate = theDate;
  24.   }
  25.  
  26.   /* for reading */
  27.   public TsolException () {
  28.   }
  29.  
  30.   public Object read (DataInputStream inStream) throws IOException {
  31.     line = inStream.readLine ();
  32.  
  33.     if (line != null)
  34.       return new TsolException 
  35.     (new Date (Integer.parseInt (line.substring (6)) - 1900,
  36.            Integer.parseInt (line.substring (3, 5)),
  37.            Integer.parseInt (line.substring (0, 2))));
  38.     else
  39.       return null;
  40.   }
  41.  
  42.   public String toString () {
  43.     return ("TsolException[" + theDate + "]");
  44.   }
  45.  
  46.   public boolean contains (Date aDate) {
  47.     return (aDate.getDate () == theDate.getDate () &&
  48.         aDate.getMonth () == theDate.getMonth () &&
  49.         aDate.getYear () == theDate.getYear ());
  50.   }
  51.  
  52. }
  53.