public void setCurrentDirection(Direction desiredDirection) {
        switch (desiredDirection) {
            case UPARROW:
                if (this.currentDirection != DOWNARROW) {
                    this.desiredDirection = UPARROW;
                }
                break;
            case DOWNARROW:
                if (this.currentDirection != UPARROW) {
                    this.desiredDirection = DOWNARROW;
                }
                break;
            case LEFTARROW:
                if (this.currentDirection != RIGHTARROW) {
                    this.desiredDirection = LEFTARROW;
                }
                break;
            case RIGHTARROW:
                if (this.currentDirection != LEFTARROW) {
                    this.desiredDirection = RIGHTARROW;
                }
                break;
        }
    }