ice.debug
Class Debug

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.RuntimeException
              extended byice.debug.Debug
All Implemented Interfaces:
Serializable

public class Debug
extends RuntimeException

Everybody should use this class (instead of System.ou) for printing out all debug info. Feel free to extend the API of this class.

See Also:
Serialized Form

Field Summary
static boolean all
          Activates all printings / checks
static boolean check
          Support for design by contract.
static boolean chk
          Triggers exception trowing on code errors
static boolean ex
          Should print exception stack traces
static boolean extra
          Enables various additional debug facilities.
static boolean trace
          Should print trace strings
 
Method Summary
static void bug()
          Throw RuntimeException to indicate broken arguments/state
static void checkOrderLE(int a, int b, int c)
          Check if a ≤ b ≤ c holds and throw excaprion if not
static void checkOrderLE(int a, int b, int c, int d)
          Check if a ≤ b ≤ c ≤ d holds and throw excaprion if not
static void ex(Throwable exception)
          Print exception stack.
static String getStackPrintoutAsString(Throwable ex)
           
static void p(String str)
          Print debug string.
static void s()
          Print stack trace.
static void s(String message)
          Print stack trace annotated with message.
static void trace(String s)
          Print trace text if in trace mode.
static void traceAsIs(String s)
           
static void traceStack(String title)
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

all

public static final boolean all
Activates all printings / checks


trace

public static final boolean trace
Should print trace strings


ex

public static final boolean ex
Should print exception stack traces


chk

public static final boolean chk
Triggers exception trowing on code errors


extra

public static final boolean extra
Enables various additional debug facilities. Currently used properties: ice.debug.ignore_window_decoration If set, script window.open would ignore GUI decoration specifications ice.debug.use_base_as_location Force scripts to see current base url as location value. Very useful to cheat locally saved scripts that tries to reload themselves from the original site. ice.debug.verbose_DElement_toString Put more information into DElement.toString() when called from script


check

public static final boolean check
Support for design by contract. If true, failed consistency/validity checks throw exception

See Also:
bug(), Constant Field Values
Method Detail

getStackPrintoutAsString

public static String getStackPrintoutAsString(Throwable ex)

p

public static void p(String str)
Print debug string. All calls to Debug.p should be commneted out/removed in the production code.


s

public static void s()
Print stack trace. All calls to Debug.s should be commneted out/removed in the production code.


s

public static void s(String message)
Print stack trace annotated with message. All calls to Debug.s should be commneted out/removed in the production code.


trace

public static void trace(String s)
Print trace text if in trace mode. This should be used to monitor important events code/points that useful to analyze bug reports. The output will include method name that calls Debug.trace(...). Usage should always be like:
                if (Debug.trace) Debug.trace(...)


traceAsIs

public static void traceAsIs(String s)

traceStack

public static void traceStack(String title)

ex

public static void ex(Throwable exception)
Print exception stack. Possible usage:
                try {
                        some code
                } catch (IOException ex) {
                        if (Debug.ex) Debug.ex(ex);
                        if (Debug.trace) Debug.trace("Unexpected IO error: "+ex);
                }


bug

public static void bug()
Throw RuntimeException to indicate broken arguments/state
        void setWisth(int width) {
                if (Debug.check && width < 0) Debug.bug();
                ...
        }

See Also:
check

checkOrderLE

public static void checkOrderLE(int a,
                                int b,
                                int c)
Check if a ≤ b ≤ c holds and throw excaprion if not


checkOrderLE

public static void checkOrderLE(int a,
                                int b,
                                int c,
                                int d)
Check if a ≤ b ≤ c ≤ d holds and throw excaprion if not