Changed protection of Graph.nodes to private
This commit is contained in:
parent
6d338018b5
commit
3498fe5ae3
@ -13,8 +13,8 @@ do
|
||||
{
|
||||
do
|
||||
{
|
||||
n1 = graph.nodes[r.Next(0, graph.nodes.Count - 1)];
|
||||
n2 = graph.nodes[r.Next(0, graph.nodes.Count - 1)];
|
||||
n1 = graph.GetNodeAtIndex(r.Next(0, graph.GetNodeCount() - 1));
|
||||
n2 = graph.GetNodeAtIndex(r.Next(0, graph.GetNodeCount() - 1));
|
||||
_route = new Astar().FindPath(graph, n1, n2, logger);
|
||||
} while (!_route.routeFound);
|
||||
} while (Console.ReadKey().Key.Equals(ConsoleKey.Enter));
|
@ -3,7 +3,7 @@ namespace Graph
|
||||
{
|
||||
public class Graph
|
||||
{
|
||||
public List<Node> nodes { get; }
|
||||
private List<Node> nodes { get; }
|
||||
|
||||
public Graph()
|
||||
{
|
||||
@ -23,6 +23,16 @@ namespace Graph
|
||||
}
|
||||
}
|
||||
|
||||
public Node GetNodeAtIndex(int i)
|
||||
{
|
||||
return this.nodes[i];
|
||||
}
|
||||
|
||||
public int GetNodeCount()
|
||||
{
|
||||
return this.nodes.Count;
|
||||
}
|
||||
|
||||
public Node? GetNode(ulong id)
|
||||
{
|
||||
foreach(Node n in this.nodes)
|
||||
|
@ -34,7 +34,7 @@ namespace OpenStreetMap_Importer
|
||||
mapData.Position = 0;
|
||||
logger?.Log(LogLevel.INFO, "Importing Graph...");
|
||||
Graph.Graph _graph = CreateGraph(mapData, occuranceCount, onlyJunctions, logger);
|
||||
logger?.Log(LogLevel.DEBUG, "Loaded Nodes: {0}", _graph.nodes.Count);
|
||||
logger?.Log(LogLevel.DEBUG, "Loaded Nodes: {0}", _graph.GetNodeCount());
|
||||
|
||||
mapData.Close();
|
||||
occuranceCount.Clear();
|
||||
|
Loading…
Reference in New Issue
Block a user