From 1e2eff1e9829f8ffa694f3258433c91c804ab473 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Thu, 26 Nov 2015 10:00:43 +0100 Subject: Improve choice filtering --- src/ch/epfl/maze/util/Direction.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/ch/epfl/maze/util') diff --git a/src/ch/epfl/maze/util/Direction.java b/src/ch/epfl/maze/util/Direction.java index ac172cb..b3f2e9c 100644 --- a/src/ch/epfl/maze/util/Direction.java +++ b/src/ch/epfl/maze/util/Direction.java @@ -1,5 +1,9 @@ package ch.epfl.maze.util; +import java.util.Collections; +import java.util.EnumSet; +import java.util.Set; + /** * Directions that an animal can take to move. They represent the four cardinal * points ({@code DOWN, UP, RIGHT, LEFT}) from the frame of reference of the @@ -12,14 +16,14 @@ public enum Direction { DOWN, UP, RIGHT, LEFT, NONE; /** - * An array of all the possible directions that can be taken. + * A set of all the possible directions that can be taken. */ - public static final Direction[] POSSIBLE_DIRECTIONS = new Direction[]{ + public static final Set MOVING_DIRECTIONS = Collections.unmodifiableSet(EnumSet.of( Direction.DOWN, Direction.UP, Direction.RIGHT, Direction.LEFT - }; + )); /** * Returns the integer value of the direction -- cgit v1.2.3