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; }
public int RemoveFromClosed(SeekingNode sn) { int index = this.closed.BinarySearch(sn); if (index >= 0) { this.closed.RemoveAt(index); } return(index); }
public int RemoveFromOpening(SeekingNode sn) { int index = this.opening.BinarySearch(sn); if (index >= 0) { this.opening.RemoveAt(index); } return(index); }
public int InsertIntoClosed(SeekingNode sn) { int index = this.closed.BinarySearch(sn); if (index < 0) { this.closed.Insert(~index, sn); return(~index); } return(-1); }
public int InsertIntoOpening(SeekingNode sn) { int index = this.opening.BinarySearch(sn); if (index < 0) { this.opening.Insert(~index, sn); return(~index); } return(-1); }
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); }
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); }
public bool IsInClosed(SeekingNode sn) { return(this.closed.BinarySearch(sn) >= 0); }
public bool IsInOpening(SeekingNode sn) { return(this.opening.BinarySearch(sn) >= 0); }