예제 #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);
 }
예제 #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.");
         }
     }
 }
예제 #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());
예제 #4
0
 public Outer(IIntermediate intermediate)
 {
     _intermediate = intermediate;
 }