/// <summary>
        /// Factory method that returns direction according to given directionCode char
        /// </summary>
        /// <param name="directionCode">directionCode char</param>
        /// <returns>Direction object</returns>
        public static DirectionClass GetDirection(char directionCode)
        {
            switch (directionCode)
            {
            case (char)Directions.North:
                return(North.GetInstance());

            case (char)Directions.East:
                return(East.GetInstance());

            case (char)Directions.South:
                return(South.GetInstance());

            case (char)Directions.West:
                return(West.GetInstance());

            default:
                throw new InvalidDirectionException();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Returns right direction of current DirectionClass
 /// </summary>
 /// <returns>DirectionClass object</returns>
 public override DirectionClass GetRightDirection()
 {
     return(South.GetInstance());
 }