/// <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();
            }
        }
Пример #2
0
 /// <summary>
 /// Returns left direction of current DirectionClass
 /// </summary>
 /// <returns>DirectionClass object</returns>
 public override DirectionClass GetLeftDirection()
 {
     return(North.GetInstance());
 }