public static DivingClubSingleton GetInstance() { if (Instance != null) { return(Instance); } else { lock (thisLock) { if (Instance == null) { Instance = new DivingClubSingleton(); } } return(Instance); } }
public void Init() { string[] diversRaw = ReadFile(diversFilePath); string[] scheduleRaw = ReadFile(diveScheduleFilePath); outFilePath = GetOutFilePath(outFilePath); if (diversRaw != null && scheduleRaw != null) { AddDiversToList(diversRaw); AddDiveSchedule(scheduleRaw); DivingClubSingleton divingClub = DivingClubSingleton.GetInstance(); DiveAlgorithmFactory diveFactory = new DiveAlgorithmFactory(); DiveAlgorithmProduct algorithm = diveFactory.createAlgorithm(algorithmName); AddDiversToDiveSchedule(algorithm); Writer.CreateFile(outFilePath); Writer.WriteDiveSchedule(diveSchedule.AsEnumerable(), outFilePath); Writer.WriteDivers(divers.AsEnumerable(), outFilePath); } }