1 /* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. 2 * 3 * This program and the accompanying materials are made available under 4 * the terms of the Common Public License v1.0 which accompanies this distribution, 5 * and is available at http://www.eclipse.org/legal/cpl-v10.html 6 * 7 * $Id: \044assert.java,v 1.1.1.1 2004/05/09 16:57:57 vlad_r Exp $ 8 */ 9 package com.vladium.util.asserts; 10 11 // ---------------------------------------------------------------------------- 12 /** 13 * @author Vlad Roubtsov, (C) 2001 14 */ 15 public 16 abstract class $assert 17 { 18 // public: ................................................................ 19 20 21 // TODO: set to false for release 22 23 /** 24 * Global compile time assertion flag. 25 */ 26 public static final boolean ENABLED = false; 27 28 /** 29 * 30 * @param condition 31 * @param msg 32 */ 33 public static void ASSERT (final boolean condition, final String msg) 34 { 35 if (ENABLED) 36 { 37 if (! condition) throw new RuntimeException (msg); 38 } 39 } 40 41 public static void ASSERT (final boolean condition) 42 { 43 if (ENABLED) 44 { 45 if (! condition) throw new RuntimeException ("ASSERTION FAILURE"); 46 } 47 } 48 49 50 // protected: ............................................................. 51 52 // package: ............................................................... 53 54 // private: ............................................................... 55 56 57 private $assert () {} // prevent subclassing 58 59 } // end of class 60 // ---------------------------------------------------------------------------- 61