/// <summary> /// Comparator function for ordering signal lights /// </summary> /// <param name="lightA">first light to compare</param> /// <param name="lightB">second light to compare</param> /// <returns>integer describing whether first light needs to be sorted before second light (so less than 0, 0, or larger than 0)</returns> public static int Comparer(SignalLight lightA, SignalLight lightB) { return(lightA.Index - lightB.Index); }
/// <summary> /// Comparator function for ordering signal lights /// </summary> /// <param name="lightA">first light to compare</param> /// <param name="lightB">second light to compare</param> /// <returns>integer describing whether first light needs to be sorted before second light (so less than 0, 0, or larger than 0)</returns> public static int Comparer(SignalLight lightA, SignalLight lightB) { return(lightA?.Index - lightB?.Index ?? 0); }