示例#1
0
 public IEnumerable <IColorable> GetNotNullInput()
 {
     return
         (Input.Where(
              inPoint =>
              (inPoint != null) && (inPoint.GetCurrentColor() != null) && (!InvisiblePoints.Contains(inPoint))));
 }
示例#2
0
        protected void Traverse(IEnumerable <ColorableClass> start, Func <IColorable, IEnumerable <IColorable> > nextFunc, Action <IColorable> traverseEveryProc, Action <IColorable> traverseLastProc)
        {
            var visited = new ZSortedList <IColorable>();

            var queue = new Queue <IColorable>(start.Select(el => (IColorable)el));

            while (queue.Count != 0)
            {
                IColorable current = queue.Dequeue();
                if (visited.Contains(current))
                {
                    continue;
                }
                visited.Add(current);
                if (traverseEveryProc != null)
                {
                    traverseEveryProc(current);
                }
                IEnumerable <IColorable> outConnections = nextFunc(current);
                int added = 0;
                foreach (var outConn in outConnections)
                {
                    queue.Enqueue(outConn);
                    added++;
                }
                if (traverseLastProc != null && added == 0 && (current is ColorableClass))
                {
                    traverseLastProc(current);
                }
            }
        }