//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); }
//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."); } } }
//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());
public Outer(IIntermediate intermediate) { _intermediate = intermediate; }