Strategy design pattern implemented in JAVA