package LockAPPC; public abstract class LockComponent { boolean lock; // classes to be defined by the extending inner class public abstract Object get_host(); public abstract void actualOp(Object passed); public abstract void actualOp(Object passed, Object passed2); public abstract Object actualOp(); // real component methods public void pushOp(Object passed) { if (!lock) { System.out.println("Locking"); actualOp(passed); System.out.println("Unlocking"); } } public void pushOp(Object passed, Object passed2) { if (!lock) { System.out.println("Locking"); actualOp(passed, passed2); System.out.println("Unlocking"); } } public Object popOp() { if (!lock) { System.out.println("Locking"); Object pop = actualOp(); System.out.println("Unlocking"); return pop; } return null; } }