Last active
December 10, 2015 08:18
-
-
Save egonelbre/4406978 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Battle<LionPlayer, BearPlayer> { | |
| private LionPlayer Lion; | |
| private BearPlayer Bear; | |
| private void Lion$fight(){ | |
| System.out.println(Lion.getName() + ": meow..."); | |
| }; | |
| private void Bear$fight(){ | |
| System.out.println(Bear.getName() + ": grrr..."); | |
| } | |
| private void Bear$touch(){ | |
| Bear$fight(); | |
| Bear.say(); | |
| Bear.say(); | |
| Lion$fight(); | |
| } | |
| public Battle(LionPlayer lionPlayer, BearPlayer bearPlayer) { | |
| Lion = lionPlayer; | |
| Bear = bearPlayer; | |
| Bear$touch(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Context | |
| public class Battle<LionPlayer, BearPlayer> { | |
| @Role(LionPlayer) | |
| private class Lion { | |
| void fight(){ | |
| System.out.println(this.getName() + ": meow..."); | |
| } | |
| } | |
| @Role(BearPlayer) | |
| private class Bear { | |
| void fight(){ | |
| System.out.println(this.getName() + ": grrr..."); | |
| } | |
| void touch(){ | |
| Bear.fight(); | |
| Bear.say(); | |
| this.say(); | |
| Lion.fight(); | |
| } | |
| } | |
| public Battle(LionPlayer lionPlayer, BearPlayer bearPlayer) { | |
| Lion = lionPlayer; | |
| Bear = bearPlayer; | |
| Bear.touch(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment