Esempio n. 1
0
 //AddIntermediate(): Allows another station to be added to Intermediates
 public static bool AddIntermediate(this IIntermediate train, string intermediate)
 {
     if (!stations.Contains(intermediate) || train.Intermediates.Contains(intermediate))
     {
         return(false);
     }
     train.Intermediates.Add(intermediate);
     return(true);
 }
Esempio n. 2
0
 //IntermediateValidation(): Exception thrown if a list of string contains invalid station values
 public static void IntermediateValidation(this IIntermediate train, List <string> value)
 {
     foreach (var station in value)
     {
         if (!stations.Contains(station))
         {
             throw new ArgumentOutOfRangeException("Intermediates are not valid.");
         }
     }
 }
Esempio n. 3
0
 //IString(): Returns the list of intermediates as a single string joined by a hyphen
 public static string IString(this IIntermediate train) => string.Join("-", train.Intermediates.ToArray());
Esempio n. 4
0
 public Outer(IIntermediate intermediate)
 {
     _intermediate = intermediate;
 }