public Predicate <T> BuildFilter <T>(Func <T, int> relationType) { List <Predicate <T> > relationFilters = new List <Predicate <T> >(); if (Blood) { relationFilters.Add(FilterUtils.IntFilter <T>(relationType, Individual.BLOOD)); } if (Directs) { relationFilters.Add(FilterUtils.IntFilter <T>(relationType, Individual.DIRECT)); } if (Marriage) { relationFilters.Add(FilterUtils.IntFilter <T>(relationType, Individual.MARRIAGE)); } if (MarriedToDB) { relationFilters.Add(FilterUtils.IntFilter <T>(relationType, Individual.MARRIEDTODB)); } if (Unknown) { relationFilters.Add(FilterUtils.IntFilter <T>(relationType, Individual.UNKNOWN)); } return(FilterUtils.OrFilter <T>(relationFilters)); }
public Predicate <Family> BuildFamilyFilter <Family>(Func <Family, IEnumerable <int> > relationTypes) { List <Predicate <Family> > relationFilters = new List <Predicate <Family> >(); if (Blood) { relationFilters.Add(FilterUtils.FamilyRelationFilter <Family>(relationTypes, Individual.BLOOD)); } if (Directs) { relationFilters.Add(FilterUtils.FamilyRelationFilter <Family>(relationTypes, Individual.DIRECT)); } if (Marriage) { relationFilters.Add(FilterUtils.FamilyRelationFilter <Family>(relationTypes, Individual.MARRIAGE)); } if (MarriedToDB) { relationFilters.Add(FilterUtils.FamilyRelationFilter <Family>(relationTypes, Individual.MARRIEDTODB)); } if (Unknown) { relationFilters.Add(FilterUtils.FamilyRelationFilter <Family>(relationTypes, Individual.UNKNOWN)); } return(FilterUtils.OrFilter <Family>(relationFilters)); }
public Predicate <T> BuildFilter <T>(FactDate when, Func <FactDate, T, FactLocation> location) { Predicate <T> locationFilter = FilterUtils.TrueFilter <T>(); string country(FactLocation x) => x.Country; if (Scotland) { locationFilter = FilterUtils.LocationFilter <T>(when, location, country, Countries.SCOTLAND); } else if (England) { locationFilter = FilterUtils.LocationFilter <T>(when, location, country, Countries.ENGLAND); } else if (Wales) { locationFilter = FilterUtils.LocationFilter <T>(when, location, country, Countries.WALES); } else if (UK) { locationFilter = FilterUtils.OrFilter <T>(FilterUtils.LocationFilter <T>(when, location, country, Countries.SCOTLAND), FilterUtils.LocationFilter <T>(when, location, country, Countries.ENGLAND), FilterUtils.LocationFilter <T>(when, location, country, Countries.WALES)); } else if (Canada) { locationFilter = FilterUtils.LocationFilter <T>(when, location, country, Countries.CANADA); } else if (USA) { locationFilter = FilterUtils.LocationFilter <T>(when, location, country, Countries.UNITED_STATES); } return(locationFilter); }