From d9e4873741cce77b5b7b5c46995c27330a354634 Mon Sep 17 00:00:00 2001 From: Siket Melinda Tekla Date: Mon, 16 May 2016 20:46:28 +0200 Subject: [PATCH] Comments added to Direction.java --- cicaprojekt/Direction.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cicaprojekt/Direction.java b/cicaprojekt/Direction.java index c0bdc8e..fac7ffe 100644 --- a/cicaprojekt/Direction.java +++ b/cicaprojekt/Direction.java @@ -2,9 +2,21 @@ package cicaprojekt; import java.util.Random; +/** + * A játékban előforduló irányokat definiáló enumerátor. + */ public enum Direction { + /** + * Az irányok felsorolása. + */ NORTH, SOUTH, EAST, WEST; + /** + * A kapott irány megfordítottjával visszatérő függvény. + * + * @param direction a kapott irány + * @return az irány fordítottja + */ public static Direction invert(Direction direction) { switch (direction) { case NORTH: @@ -20,6 +32,11 @@ public enum Direction { } } + /** + * Egy véletlenszerű iránnyal tér vissza. + * + * @return véletlen irány + */ public static Direction getRandom() { return Direction.values()[new Random().nextInt(Direction.values().length)]; }