Condition is used to define custom {@link AdvancedRobot#waitFor(Condition) waitFor(Condition)} and custom events for an {@link AdvancedRobot}. The code below is taken from the sample robot named {@code sample.Target}. See the {@code sample/Target.java} for details.
addCustomEvent( new Condition("triggerhit") { public boolean test() { return (getEnergy() <= trigger); }; } );
You should note that by extending Condition this way, you are actually creating an inner class -- so if you distribute your robot, there will be multiple class files. (i.e. {@code Target$1.class})
@see AdvancedRobot#waitFor(Condition)
@see AdvancedRobot#addCustomEvent(Condition)
@see AdvancedRobot#removeCustomEvent(Condition)
@see AdvancedRobot#onCustomEvent(CustomEvent)
@author Mathew A. Nelson (original)
@author Flemming N. Larsen (contributor)
@author Nathaniel Troutman (contributor)