    001    package calhoun.util;
    002
    003    /** Assertion class.  Like Java assert except it can't be shut off.
    004     * Assert.a(condition) or Assert.a(condition, msg)
    005     * Some take multiple objects.  The advantage is that the string is only concatenated if the assert is fired.
    006    */
    007    public final class Assert {
    008            private Assert() { }
    009
    010            public static final void a(final boolean bool) {
    011                    if(!bool)
    012                            throw new CheckException();
    013            }
    014
    015            public static final void a(final boolean bool, final String message) {
    016                    if(!bool)
    017                            throw new CheckException(message);
    018            }
    019
    020            public static final void a(final boolean bool, final Object obj1, final Object obj2) {
    021                    if(!bool)
    022                            throw new CheckException("" + obj1 + obj2);
    023            }
    024
    025            public static final void a(final boolean bool, final Object obj1, final Object obj2, final Object obj3) {
    026                    if(!bool)
    027                            throw new CheckException("" + obj1 + obj2 + obj3);
    028            }
    029
    030            public static final void a(final boolean bool, final Object obj1, final Object obj2, final Object obj3, final Object obj4) {
    031                    if(!bool)
    032                            throw new CheckException("" + obj1 + obj2 + obj3 + obj4);
    033            }
    034
    035            public static final void a(final boolean bool, final Object obj1, final Object obj2, final Object obj3, final Object obj4, final Object obj5) {
    036                    if(!bool)
    037                            throw new CheckException("" + obj1 + obj2 + obj3 + obj4 + obj5);
    038            }
    039
    040            public static final void a(final boolean bool, final Object obj1, final Object obj2, final Object obj3, final Object obj4, final Object obj5, final Object obj6) {
    041                    if(!bool)
    042                            throw new CheckException("" + obj1 + obj2 + obj3 + obj4 + obj5 + obj6);
    043            }
    044
    045            public static final void a(final boolean bool, final Object obj1, final Object obj2, final Object obj3, final Object obj4, final Object obj5, final Object obj6, final Object obj7) {
    046                    if(!bool)
    047                            throw new CheckException("" + obj1 + obj2 + obj3 + obj4 + obj5 + obj6 + obj7);
    048            }
    049
    050            public static final void a(final boolean bool, final Object obj1, final Object obj2, final Object obj3, final Object obj4, final Object obj5, final Object obj6, final Object obj7, final Object obj8) {
    051                    if(!bool)
    052                            throw new CheckException("" + obj1 + obj2 + obj3 + obj4 + obj5 + obj6 + obj7 + obj8);
    053            }
    054
    055            public static final void a(final boolean bool, final Object obj1, final Object obj2, final Object obj3, final Object obj4, final Object obj5, final Object obj6, final Object obj7, final Object obj8, final Object obj9) {
    056                    if(!bool)
    057                            throw new CheckException("" + obj1 + obj2 + obj3 + obj4 + obj5 + obj6 + obj7 + obj8 + obj9);
    058            }
    059
    060            public static final void a(final boolean bool, final Object obj1, final Object obj2, final Object obj3, final Object obj4, final Object obj5, final Object obj6, final Object obj7, final Object obj8, final Object obj9, final Object obj10) {
    061                    if(!bool)
    062                            throw new CheckException("" + obj1 + obj2 + obj3 + obj4 + obj5 + obj6 + obj7 + obj8 + obj9 + obj10);
    063            }
    064    }