Exemple #1
0
        public void dequeue()
        {
            if (front != null)
            {
                front = front.getNext();
            }

            else
            {
                rear = null;
            }
        }
Exemple #2
0
        public String display()
        {
            String    nodes = "";
            AStarNode temp  = front;

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

            return(nodes);
        }
Exemple #3
0
        public double getHeuristic(int data)
        {
            double    heuristic = 0;
            AStarNode temp      = front;

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

            return(heuristic);
        }
Exemple #4
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);
        }
Exemple #5
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);
        }