public virtual bool WriteToConsole(PersonMatchPairCollection list) { if (list.Count == 0) { return(false); } string printFormat = "\tId={0}, Name={1} {2} {3}, BirthDate={4}/{5}/{6}"; foreach (Tuple <Person, Person> match in list) { Console.WriteLine("Match:\n"); Console.WriteLine( string.Format(printFormat, match.Item1.ObjectId, match.Item1.FirstName, match.Item1.MiddleName, match.Item1.LastName, match.Item1.BirthMonth, match.Item1.BirthDay, match.Item1.BirthYear)); Console.WriteLine( string.Format(printFormat, match.Item2.ObjectId, match.Item2.FirstName, match.Item2.MiddleName, match.Item2.LastName, match.Item2.BirthMonth, match.Item2.BirthDay, match.Item2.BirthYear)); } return(true); }
public PersonCollection(MatchingAlgorithm personMatchingAlogrithm, IOManager personIOManager, string inputFilename, string outputFilename) { this.PersonMatchingAlgorithm = personMatchingAlogrithm; this.PersonIOManager = personIOManager; this.InputFilename = inputFilename; this.OutputFilename = outputFilename; this.PersonMatchPairs = new PersonMatchPairCollection(); }
public override bool Write(PersonMatchPairCollection list, string filename) { StreamWriter writer = new StreamWriter(filename); for (int index = 0; index < list.Count; index += 1) { writer.WriteLine(list[index].Item1.ObjectId.ToString() + ',' + list[index].Item2.ObjectId.ToString()); } writer.Close(); return(true); }
public override bool FindMatches(PersonCollection list, PersonMatchPairCollection pairs) { for (int firstIndex = 0; firstIndex < list.Count - 1; firstIndex += 1) { for (int secondIndex = firstIndex + 1; secondIndex < list.Count; secondIndex += 1) { if (list[firstIndex].FirstName == list[secondIndex].FirstName && list[firstIndex].LastName == list[secondIndex].LastName && list[firstIndex].SocialSecurityNumber == list[secondIndex].SocialSecurityNumber) { pairs.Add(Tuple.Create(list[firstIndex], list[secondIndex])); } } } return(pairs.Count > 0 ? true : false); }
/// <summary> /// Write the values in list to filename with the given extension. /// </summary> /// <returns>true on success</returns> /// <param name="list">List of Person matched objects.</param> /// <param name="filename">Filename to write to.</param> public abstract bool Write(PersonMatchPairCollection list, string filename);
public abstract bool FindMatches(PersonCollection list, PersonMatchPairCollection pairs);