public static Direction gridToDirection(GridCoordinate coordinateDirection) { if (GridCoordinate.equals(up, coordinateDirection)) { return(Direction.UP); } if (GridCoordinate.equals(upright, coordinateDirection)) { return(Direction.UPRIGHT); } if (GridCoordinate.equals(right, coordinateDirection)) { return(Direction.RIGHT); } if (GridCoordinate.equals(downright, coordinateDirection)) { return(Direction.DOWNRIGHT); } if (GridCoordinate.equals(down, coordinateDirection)) { return(Direction.DOWN); } if (GridCoordinate.equals(downleft, coordinateDirection)) { return(Direction.DOWNLEFT); } if (GridCoordinate.equals(left, coordinateDirection)) { return(Direction.LEFT); } else { return(Direction.UPLEFT); } }