Exemplo n.º 1
0
            /*
             * Equals is only defined from the stored node, so we can use it to find
             * entries in the queue
             */
            public override bool Equals(object obj)
            {
                if (this == obj)
                {
                    return(true);
                }
                if (obj == null)
                {
                    return(false);
                }
                if (this.GetType() != obj.GetType())
                {
                    return(false);
                }
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final pathObject other = (pathObject) obj;
                pathObject other = ( pathObject )obj;

                if (NodeConflict == null)
                {
                    if (other.NodeConflict != null)
                    {
                        return(false);
                    }
                }
                else if (!NodeConflict.Equals(other.NodeConflict))
                {
                    return(false);
                }
                return(true);
            }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieve and remove
        /// </summary>
        public override Node ExtractMin()
        {
            pathObject po = Queue.poll();

            if (po == null)
            {
                return(null);
            }
            return(po.Node);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Retrieve without removing
        /// </summary>
        public override Node Peek()
        {
            pathObject po = Queue.peek();

            if (po == null)
            {
                return(null);
            }
            return(po.Node);
        }
Exemplo n.º 4
0
        public override void DecreaseValue(Node node, CostType newValue)
        {
            pathObject po = new pathObject(this, node, newValue);

            // Shake the queue
            // remove() will remove the old pathObject
            // BUT IT TAKES A LOT OF TIME FOR SOME REASON
            // queue.remove( po );
            Queue.add(po);
        }