This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax: glob | |
#-- Files | |
*.bak.* | |
*.bak | |
thumbs.db | |
*.msi | |
*.sdf | |
*.opensdf | |
#-- Directories |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Ignore Visual Studio temporary files, build results, and | |
## files generated by popular Visual Studio add-ons. | |
# User-specific files | |
*.suo | |
*.user | |
*.sln.docstates | |
# Build results | |
[Dd]ebug/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isTypeA) | |
{ | |
periodsToCheck.AddAll(typeAPeriods); | |
if (isTypeB) | |
{ | |
//find overlaps between type a and type b | |
periodsToCheck.AddAll(typeBPeriods); | |
overlapPeriods = periodCombiner.IntersectPeriods(periodsToCheck); | |
//reassign periods to check to the overlapping periods if we have to look at type C |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//final overlapping periods | |
ITimePeriodCollection overlapPeriods = new TimePeriodCollection(); | |
//used to help find overlaps | |
TimePeriodIntersector<TimeRange> periodCombiner = new TimePeriodIntersector<TimeRange>(); | |
//periods to check to see if they overlap | |
TimePeriodCollection periodsToCheck = new TimePeriodCollection(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isTypeA) | |
foreach (var dateTime in typeADates) | |
typeAPeriods.Add(new TimeRange(dateTime.Start, dateTime.End)); | |
if (isTypeB) | |
foreach (var dateTime in typeBDates) | |
typeBPeriods.Add(new TimeRange(dateTime.Start, dateTime.End)); | |
if (isTypeC) | |
foreach (var dateTime in typeCDates) | |
typeCPeriods.Add(new TimeRange(dateTime.Start, dateTime.End)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TimePeriodCollection typeAPeriods = new TimePeriodCollection(); | |
TimePeriodCollection typeBPeriods = new TimePeriodCollection(); | |
TimePeriodCollection typeCPeriods = new TimePeriodCollection(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<Tuple<double, double>> LargestTriangleThreeBuckets(List<Tuple<double, double>> data, int threshold) | |
{ | |
int dataLength = data.Count; | |
if (threshold >= dataLength || threshold == 0) | |
return data; // Nothing to do | |
List<Tuple<double, double>> sampled = new List<Tuple<double, double>>(threshold); | |
// Bucket size. Leave room for start and end data points | |
double every = (double)(dataLength - 2) / (threshold - 2); |