samples/codeinjection/src/org/apidesign/codeinjection/CountDownImplV1.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 10 Jan 2009 21:29:22 +0100
changeset 303 77b6002451c4
permissions -rw-r--r--
Initial version of sample to explain 'code injection'
jtulach@303
     1
/*
jtulach@303
     2
 * To change this template, choose Tools | Templates
jtulach@303
     3
 * and open the template in the editor.
jtulach@303
     4
 */
jtulach@303
     5
jtulach@303
     6
package org.apidesign.codeinjection;
jtulach@303
     7
jtulach@303
     8
/** The implementation of {@link CountDown} as of version 1.0.
jtulach@303
     9
 * The {@link #down()} method always decrements by one.
jtulach@303
    10
 *
jtulach@303
    11
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jtulach@303
    12
 * @since 1.0
jtulach@303
    13
 */
jtulach@303
    14
final class CountDownImplV1 extends CountDown {
jtulach@303
    15
    CountDownImplV1(int initial) {
jtulach@303
    16
        this.cnt = initial;
jtulach@303
    17
    }
jtulach@303
    18
    
jtulach@303
    19
// BEGIN: codeinjection.v1
jtulach@303
    20
    private int cnt;
jtulach@303
    21
    public void down() {
jtulach@303
    22
        cnt--;
jtulach@303
    23
    }
jtulach@303
    24
jtulach@303
    25
    public boolean isDown() {
jtulach@303
    26
        return cnt <= 0;
jtulach@303
    27
    }
jtulach@303
    28
// END: codeinjection.v1
jtulach@303
    29
}