User:Jdev/Code/DebugCode

From Robowiki
< User:Jdev
Revision as of 17:14, 23 December 2012 by Jdev (talk | contribs) (It's a technique for inject into robots permanent debugging code without impact on "production". Feel free to adopt and/or use it)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

It's a technique for inject into robots permanent debugging code without impact on "production". Feel free to adopt and/or use it

DebugCode:

public class DebugCode {

    public boolean e() { return true;}

}

Usage:

assert new DebugCode() {{
    // this code will be executed only if JVM are runned with "-ea" flag
    dangers.addValue(cmo.danger);
    dangers.addValue(smo.danger);
    dangers.addValue(ccmo.danger);
}}.e();