home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 25 / IOPROG_25.ISO / SOFT / JavaS / javastar-eval.exe / data1.cab / Program_Files / examples / namedb / gjt / Assert.java < prev    next >
Encoding:
Java Source  |  1999-02-11  |  1002 b   |  33 lines

  1. package gjt;
  2. /**
  3.  * A simple assertion mechanism for asserting validity of
  4.  * arguments.<p>
  5.  *
  6.  * @version 1.0, Apr 1 1996
  7.  * @author  David Geary
  8.  */
  9. class Assert {
  10.     static public void notFalse(boolean b) 
  11.                        throws IllegalArgumentException {
  12.         if(b == false) 
  13.             throw new IllegalArgumentException(
  14.                             "boolean expression false");
  15.     }
  16.     static public void notNull(Object obj) 
  17.                        throws IllegalArgumentException {
  18.         if(obj == null) 
  19.             throw new IllegalArgumentException("null argument");
  20.     }
  21.  
  22.     static public void notFalse(boolean b, String s) 
  23.                                throws IllegalArgumentException {
  24.         if(b == false)
  25.             throw new IllegalArgumentException(s);
  26.     }
  27.     static public void notNull(Object obj, String s) 
  28.                                throws IllegalArgumentException {
  29.         if(obj == null) 
  30.             throw new IllegalArgumentException(s);
  31.     }
  32. }
  33.