Ejemplo n.º 1
0
        public int peek()
        {
            int temp = 0;

            if (front != null)
            {
                temp = front.getData();
            }

            return(temp);
        }
Ejemplo n.º 2
0
        public String display()
        {
            String    nodes = "";
            AStarNode temp  = front;

            while (temp != null)
            {
                nodes += temp.getData() + " ";
                temp   = temp.getNext();
            }

            return(nodes);
        }
Ejemplo n.º 3
0
        public bool isVisited(int data)
        {
            bool      flag = false;
            AStarNode temp = front;

            while (temp != null)
            {
                if (data == temp.getData())
                {
                    flag = true;
                    break;
                }
                else
                {
                    temp = temp.getNext();
                }
            }

            return(flag);
        }
Ejemplo n.º 4
0
        public int compare()
        {
            int    node     = 0;
            double function = 0;

            if (front != null)
            {
                AStarNode temp = front.getNext();

                function = front.getFunction();
                node     = front.getData();
                while (temp != null)
                {
                    if (temp.getFunction() < function)
                    {
                        function = temp.getFunction();
                        node     = temp.getData();
                    }

                    temp = temp.getNext();
                }
            }
            return(node);
        }