Small improvements

This commit is contained in:
Pieter Vander Vennet 2021-05-12 13:28:36 +02:00
parent 6cefdf5602
commit 49979c2072
2 changed files with 19 additions and 5 deletions

View file

@ -93,7 +93,7 @@ namespace AspectedRouting
private static void Repl(Context c, Dictionary<string, ProfileMetaData> profiles) private static void Repl(Context c, Dictionary<string, ProfileMetaData> profiles)
{ {
var profile = profiles["bicycle"]; var profile = profiles["emergency_vehicle"];
var behaviour = profile.Behaviours.Keys.First(); var behaviour = profile.Behaviours.Keys.First();
do do
{ {
@ -130,12 +130,13 @@ namespace AspectedRouting
if (beh.Contains(".")) if (beh.Contains("."))
{ {
var profileName = beh.Split(".")[0]; var profileName = beh.Split(".")[0];
if (!profiles.TryGetValue(profileName, out profile)) if (!profiles.TryGetValue(profileName, out var newProfile))
{ {
Console.Error.WriteLine("Profile " + profileName + " not found, ignoring"); Console.Error.WriteLine("Profile " + profileName + " not found, ignoring");
continue; continue;
} }
profile = newProfile;
beh = beh.Substring(beh.IndexOf(".") + 1); beh = beh.Substring(beh.IndexOf(".") + 1);
} }

View file

@ -18,15 +18,28 @@ namespace AspectedRouting.Tests
PriorityExplanation = priorityExplanation; PriorityExplanation = priorityExplanation;
} }
private static string str(string s)
{
if (s == null) {
return "<null>";
}
if (s == "") {
return "<empty string>";
}
return s;
}
public override string ToString() public override string ToString()
{ {
return string.Join("\n ", return string.Join("\n ",
"access "+Access, " access "+str(Access),
"oneway "+Oneway, "oneway "+str(Oneway),
"speed "+Speed, "speed "+Speed,
"priority "+Priority, "priority "+Priority,
"because \n "+PriorityExplanation "because \n "+str(PriorityExplanation)
); );
} }
} }