Background to the problem:
Im currently working on a pathfinder. My lastest implementation was the ability to load in different mapfiles instead of only using one array containing the map. So before it looked like this:
Node[] mMatrix;
However since I want to load in different segments of nodes. I made this:
List<Node[]>
The class, Node simply contains an int declared as F.
And now to the issue!
To be short, the specific question is how would you compare an object of type : List< Node[] > in the IComparer Members Compare method.
I have been using a priorityQueue for speeding up the pathfinder algorithm but now Im having issues with comparing this new "2 dimensional" datastructure. For my old working implementation i used this:
internal class ComparePFNodeMatrix : IComparer<int>
{
//Variables Declaration
Node[] mMatrix;
//Constructors
public ComparePFNodeMatrix(Node[] matrix)
{
mMatrix = matrix;
}
//IComparer Members
public int Compare(int a, int b)
{
if (mMatrix[a].F > mMatrix[b].F)
return 1;
else if (mMatrix[a].F < mMatrix[b].F)
return -1;
return 0;
}
}
Anyone knowing how to make a comparer with the new datastructure Im using? Thanks on advance!