Enum Direction

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Direction>, java.lang.constant.Constable

    public enum Direction
    extends java.lang.Enum<Direction>
    Une Direction est une énumération qui représente les directions cardinales.
    • NORTH
    • EAST
    • SOUTH
    • WEST
    Des méthodes publiques nous permet de trouver les directions à gauche, droite et derrière une direction courante. Une dernière méthode shuffled permet d'avoir un tableau de directions mélangé de manière aléatoire.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Enum

        java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      EAST  
      NORTH  
      SOUTH  
      WEST  
    • Method Summary

      Modifier and Type Method Description
      int getCol()  
      int getRow()  
      static void main​(java.lang.String[] args)  
      static Direction[] shuffled()
      Mélange les directions aléatoirement.
      java.lang.String toString()  
      Direction turnAround()
      Tourne sur lui-même
      Direction turnLeft()
      Tourne vers la gauche.
      Direction turnRight()
      Tourne vers la droite.
      static Direction valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Direction[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • values

        public static Direction[] values()
        Returns an array containing the constants of this enum type, in the order they are declared.
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Direction valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • turnRight

        public Direction turnRight()
        Tourne vers la droite.
        Returns:
        La direction à droite de la direction courante.
      • turnAround

        public Direction turnAround()
        Tourne sur lui-même
        Returns:
        La direction derrière la direction courante.
      • turnLeft

        public Direction turnLeft()
        Tourne vers la gauche.
        Returns:
        La direction à gauche de la direction courante.
      • getRow

        public int getRow()
      • getCol

        public int getCol()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<Direction>
      • shuffled

        public static Direction[] shuffled()
        Mélange les directions aléatoirement.
        Returns:
        Tableau des 4 directions mélangées aléatoirement.
      • main

        public static void main​(java.lang.String[] args)