@@ -0,0 +1,752 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage doublex.lib.locks;%0A%0A/**%0A *%0A * @author kenneth.lau%0A * @param %3CK%3E%0A */%0Apublic abstract class AbstractLock%3CK%3E implements ILockable%3CK%3E %7B%0A%0A    private boolean mIsLocked = false;%0A%0A    @Override%0A    public final boolean isLocked() %7B%0A        return mIsLocked;%0A    %7D%0A%0A    @Override%0A    public final void lock() %7B%0A        mIsLocked = true;%0A    %7D%0A%0A    @Override%0A    public final void tryUnlock(final K key) %7B%0A        if (isCorrectKey(key)) unlock();%0A    %7D%0A%0A    abstract boolean isCorrectKey(final K key);%0A%0A    private void unlock() %7B%0A        mIsLocked = false;%0A    %7D%0A%0A%7D;%0A

Create AbstractLock.java