Exemplo n.º 1
0
        /// <summary>
        /// See base class description; visits predecessors
        /// </summary>
        /// <param name="vertex">The vertex to get the next vertices from</param>
        /// <param name="wl">The work list to add the next vertices to</param>
        /// <returns>True if it's possible to navigate further, false if not</returns>
        public override bool GetNext(
            object vertex,
            Queue <EdgeItem> wl)
        {
            foreach (Edge edge in Graph.Predecessors(vertex))
            {
                EdgeItem item = new EdgeItem(edge, CurrentEdgeItem);

                if (!CheckConstraints(edge.Source) ||
                    item == CurrentEdgeItem ||
                    wl.Contains(item) ||
                    HasTraversedInCurrentEdgeStack(edge))
                {
                    continue;
                }

                wl.Enqueue(item);
            }

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// See base class
        /// </summary>
        /// <param name="obj">See base class</param>
        /// <returns>See base class</returns>
        public override bool Equals(object obj)
        {
            EdgeItem other      = obj as EdgeItem;
            bool     matchFound = false;

            if (other != null)
            {
                if ((ParentEdgeItem != null &&
                     other.ParentEdgeItem != null))
                {
                    matchFound = ParentEdgeItem.Edge == other.ParentEdgeItem.Edge;
                }
                else if ((ParentEdgeItem == null &&
                          other.ParentEdgeItem == null))
                {
                    matchFound = true;
                }

                matchFound = matchFound && other.Edge == Edge;
            }

            return(matchFound);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes the edge item
 /// </summary>
 /// <param name="edge">The edge to associate with</param>
 /// <param name="parentEdgeItem">The edge item's parent</param>
 public EdgeItem(Edge edge, EdgeItem parentEdgeItem)
 {
     this.edge           = edge;
     this.parentEdgeItem = parentEdgeItem;
 }