예제 #1
0
        public static List <CardinalPoint> ToList()
        {
            var           result = new List <CardinalPoint>();
            CardinalPoint temp   = _start;

            do
            {
                result.Add(temp);
                temp = temp.Right;
            } while (!temp.Equals(_start));

            return(result);
        }
예제 #2
0
        private static void Insert(string value, Point direction)
        {
            CardinalPoint newCardinalPoint;

            if (_start == null)
            {
                newCardinalPoint = new CardinalPoint {
                    Value = value, Direction = direction
                };
                newCardinalPoint.Right = newCardinalPoint.Left = newCardinalPoint;
                _start = newCardinalPoint;

                return;
            }

            var last = _start.Left;

            newCardinalPoint = new CardinalPoint {
                Value = value, Direction = direction, Right = _start
            };
            _start.Left           = newCardinalPoint;
            newCardinalPoint.Left = last;
            last.Right            = newCardinalPoint;
        }