jtulach@303: /* jtulach@303: * To change this template, choose Tools | Templates jtulach@303: * and open the template in the editor. jtulach@303: */ jtulach@303: jtulach@303: package org.apidesign.codeinjection; jtulach@303: jtulach@303: /** API class that can counts a count down. jtulach@303: * jtulach@303: * @author Jaroslav Tulach jtulach@303: * @since 1.0 jtulach@303: */ jtulach@303: // BEGIN: codeinjection.CountDown jtulach@303: public abstract class CountDown { jtulach@303: CountDown() { jtulach@303: } jtulach@303: jtulach@303: public static CountDown create(int initial) { jtulach@398: return createSimpleImplementation(initial); jtulach@303: } jtulach@303: jtulach@303: /** Decrements the counter */ jtulach@303: public abstract void down(); jtulach@303: /** @return true if the counter is 0 or less */ jtulach@303: public abstract boolean isDown(); jtulach@398: // FINISH: codeinjection.CountDown jtulach@398: jtulach@398: private static CountDown createSimpleImplementation(int initial) { jtulach@398: return new CountDownImplV1(initial); jtulach@398: } jtulach@303: }