Permalink
Browse files

remove possible solution

  • Loading branch information...
1 parent 1cc659b commit 94684a7ea4b9245299db1c48da155bb4b1648683 @OdeToCode committed Apr 8, 2012
@@ -43,12 +43,6 @@
<Compile Include="Finder.cs" />
<Compile Include="F.cs" />
<Compile Include="FT.cs" />
- <Compile Include="MarginallyBetter\Finder.cs" />
- <Compile Include="MarginallyBetter\FindType.cs" />
- <Compile Include="MarginallyBetter\Person.cs" />
- <Compile Include="MarginallyBetter\PersonDifference.cs" />
- <Compile Include="MarginallyBetter\PersonDifferenceList.cs" />
- <Compile Include="MarginallyBetter\PersonList.cs" />
<Compile Include="Thing.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
@@ -1,10 +0,0 @@
-using System;
-
-namespace Algorithm.MarginallyBetter
-{
- public static class Find
- {
- public static Func<PersonDifference, PersonDifference, bool> Closest = (p1, p2) => p1.Difference < p2.Difference;
- public static Func<PersonDifference, PersonDifference, bool> Furthest = (p1, p2) => p1.Difference > p2.Difference;
- }
-}
@@ -1,21 +0,0 @@
-using System;
-
-namespace Algorithm.MarginallyBetter
-{
- public class Finder
- {
- private readonly PersonList _people;
-
- public Finder(PersonList people)
- {
- _people = people;
- }
-
- public PersonDifference Find(Func<PersonDifference, PersonDifference, bool> findStrategy)
- {
- var differences = new PersonDifferenceList(_people);
- var answer = differences.Find(findStrategy);
- return answer;
- }
- }
-}
@@ -1,10 +0,0 @@
-using System;
-
-namespace Algorithm.MarginallyBetter
-{
- public class Person
- {
- public string Name { get; set; }
- public DateTime BirthDate { get; set; }
- }
-}
@@ -1,31 +0,0 @@
-using System;
-
-namespace Algorithm.MarginallyBetter
-{
- public class PersonDifference
- {
- public PersonDifference()
- {
-
- }
-
- public PersonDifference(Person person1, Person person2)
- {
- if(person1.BirthDate < person2.BirthDate)
- {
- Person1 = person1;
- Person2 = person2;
- }
- else
- {
- Person1 = person2;
- Person2 = person1;
- }
- Difference = Person2.BirthDate - Person1.BirthDate;
- }
-
- public Person Person1 { get; set; }
- public Person Person2 { get; set; }
- public TimeSpan Difference { get; set; }
- }
-}
@@ -1,38 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Algorithm.MarginallyBetter
-{
- public class PersonDifferenceList : List<PersonDifference>
- {
- public PersonDifferenceList(PersonList people)
- {
- CombineEachPerson(people);
- }
-
- private void CombineEachPerson(PersonList people)
- {
- for (var i = 0; i < people.Count - 1; i++)
- {
- for (var j = i + 1; j < people.Count; j++)
- {
- var result = new PersonDifference(people[i], people[j]);
- Add(result);
- }
- }
- }
-
- public PersonDifference Find(Func<PersonDifference, PersonDifference, bool> findStrategy)
- {
- var answer = Count > 0 ? this[0] : new PersonDifference();
- foreach (var result in this)
- {
- if(findStrategy(result, answer))
- {
- answer = result;
- }
- }
- return answer;
- }
- }
-}
@@ -1,9 +0,0 @@
-using System.Collections.Generic;
-
-namespace Algorithm.MarginallyBetter
-{
- public class PersonList : List<Person>
- {
-
- }
-}

0 comments on commit 94684a7

Please sign in to comment.