/*
 * Assert.java
 *
 * Copyright (C) 2002-2006 Alexei Drummond and Andrew Rambaut
 *
 * This file is part of BEAST.
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership and licensing.
 *
 * BEAST is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 *  BEAST is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with BEAST; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */

package dr.util;



/**
 * Simple Static class for assertions. This may be replaced in future
 * with Java 1.4's assertion mechanism.
 *
 * @version $Id: Assert.java,v 1.7 2005/07/08 12:15:50 rambaut Exp $
 *
 * @author Andrew Rambaut
 */
public class Assert {

	/* not sure about exactly what this function should display */
	private static void fail(String msg)
	{
		System.err.println("Assertion failed: " + msg);

		Throwable e = new Throwable();
		e.printStackTrace();
	}

	public static void test(boolean b)
	{
		if (!b)
			fail("Statement false");
	}

	public static void test(long lng)
	{
		if (lng == 0L)
			fail("Zero integer");
	}

	public static void test(double dbl)
	{
		if (dbl == 0.0)
			fail("Zero double");
	}

	public static void test(Object ref)
	{
		if (ref == null)
			fail("Null reference");
	}
}

@@ -1203,16 +1203,18 @@
 aut%0A */%0A
+//
 public c
@@ -1227,17 +1227,21 @@
 ssert %7B%0A
-%0A
+//%0A//
 %09/* not 
@@ -1296,16 +1296,18 @@
 play */%0A
+//
 %09private
@@ -1336,19 +1336,23 @@
 ng msg)%0A
+//
 %09%7B%0A
+//
 %09%09System
@@ -1393,17 +1393,21 @@
 + msg);%0A
-%0A
+//%0A//
 %09%09Throwa
@@ -1431,16 +1431,18 @@
 able();%0A
+//
 %09%09e.prin
@@ -1456,20 +1456,26 @@
 race();%0A
+//
 %09%7D%0A
-%0A
+//%0A//
 %09public 
@@ -1502,19 +1502,23 @@
 lean b)%0A
+//
 %09%7B%0A
+//
 %09%09if (!b
@@ -1519,16 +1519,18 @@
 if (!b)%0A
+//
 %09%09%09fail(
@@ -1545,28 +1545,34 @@
 nt false%22);%0A
+//
 %09%7D%0A
-%0A
+//%0A//
 %09public stat
@@ -1594,19 +1594,23 @@
 ng lng)%0A
+//
 %09%7B%0A
+//
 %09%09if (ln
@@ -1618,16 +1618,18 @@
  == 0L)%0A
+//
 %09%09%09fail(
@@ -1641,28 +1641,34 @@
  integer%22);%0A
+//
 %09%7D%0A
-%0A
+//%0A//
 %09public stat
@@ -1692,19 +1692,23 @@
 le dbl)%0A
+//
 %09%7B%0A
+//
 %09%09if (db
@@ -1717,16 +1717,18 @@
 == 0.0)%0A
+//
 %09%09%09fail(
@@ -1747,12 +1747,18 @@
 %22);%0A
+//
 %09%7D%0A
-%0A
+//%0A//
 %09pub
@@ -1790,19 +1790,23 @@
 ct ref)%0A
+//
 %09%7B%0A
+//
 %09%09if (re
@@ -1816,16 +1816,18 @@
 = null)%0A
+//
 %09%09%09fail(
@@ -1845,13 +1845,17 @@
 ence%22);%0A
+//
 %09%7D%0A
+//
 %7D%0A

comment out unused code