From d14ce39ee11871384ae55744f038bbd42a6af3f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bokros=20B=C3=A1lint?= Date: Fri, 13 May 2016 20:26:02 +0200 Subject: [PATCH] Added invert to Direction --- cicaprojekt/Direction.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cicaprojekt/Direction.java b/cicaprojekt/Direction.java index e5a0a3e..5b0e96f 100644 --- a/cicaprojekt/Direction.java +++ b/cicaprojekt/Direction.java @@ -2,4 +2,19 @@ package cicaprojekt; public enum Direction { NORTH, SOUTH, EAST, WEST; + + public static Direction invert(Direction direction) { + switch (direction) { + case NORTH: + return SOUTH; + case EAST: + return WEST; + case SOUTH: + return NORTH; + case WEST: + return EAST; + default: + return NORTH; + } + } }