示例#1
0
 public SeekingNode(int id, float g, float h, SeekingNode parent, object data)
 {
     this.ID     = id;
     this.G      = g;
     this.H      = h;
     this.Parent = parent;
     this.Data   = data;
 }
示例#2
0
        public int RemoveFromClosed(SeekingNode sn)
        {
            int index = this.closed.BinarySearch(sn);

            if (index >= 0)
            {
                this.closed.RemoveAt(index);
            }
            return(index);
        }
示例#3
0
        public int RemoveFromOpening(SeekingNode sn)
        {
            int index = this.opening.BinarySearch(sn);

            if (index >= 0)
            {
                this.opening.RemoveAt(index);
            }
            return(index);
        }
示例#4
0
        public int InsertIntoClosed(SeekingNode sn)
        {
            int index = this.closed.BinarySearch(sn);

            if (index < 0)
            {
                this.closed.Insert(~index, sn);
                return(~index);
            }
            return(-1);
        }
示例#5
0
        public int InsertIntoOpening(SeekingNode sn)
        {
            int index = this.opening.BinarySearch(sn);

            if (index < 0)
            {
                this.opening.Insert(~index, sn);
                return(~index);
            }
            return(-1);
        }
示例#6
0
        public SeekingNode PopLowestWeightInOpening()
        {
            int index = 0;

            for (int i = 1; i < this.opening.Count; i++)
            {
                if (this.opening[i].F < this.opening[index].F)
                {
                    index = i;
                }
            }
            SeekingNode sn = this.opening[index];

            InsertIntoClosed(sn);
            RemoveFromOpening(index);
            return(sn);
        }
示例#7
0
            public int CompareTo(object obj)
            {
                int result = -1;

                try
                {
                    SeekingNode sn = obj as SeekingNode;
                    if (sn != null)
                    {
                        result = this.ID - sn.ID;
                    }
                    else
                    {
                        result = this.ID - (int)obj;
                    }
                }
                catch (Exception ex)
                {
                    XxdwDebugger.Log(ex.Message);
                }
                return(result);
            }
示例#8
0
 public bool IsInClosed(SeekingNode sn)
 {
     return(this.closed.BinarySearch(sn) >= 0);
 }
示例#9
0
 public bool IsInOpening(SeekingNode sn)
 {
     return(this.opening.BinarySearch(sn) >= 0);
 }