Rename Range::overlap to Range::overlaps

This commit is contained in:
Thomas Lauf 2018-09-18 20:15:15 +02:00
parent c48063dec7
commit 9e1e604108
7 changed files with 40 additions and 40 deletions

View file

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez.
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -113,7 +113,7 @@ std::vector <Range> Exclusion::ranges (const Range& range) const
Datetime end (start);
++end;
Range all_day (start, end);
if (range.overlap (all_day))
if (range.overlaps (all_day))
results.push_back (all_day);
}
@ -140,7 +140,7 @@ std::vector <Range> Exclusion::ranges (const Range& range) const
for (unsigned int block = 2; block < _tokens.size (); ++block)
{
auto r = rangeFromTimeBlock (_tokens[block], start, end);
if (myRange.overlap (r))
if (myRange.overlaps (r))
results.push_back (r);
}
}

View file

@ -131,7 +131,7 @@ bool Range::contains (const Datetime &datetime) const
// H [...
// I [...
//
bool Range::overlap (const Range& other) const
bool Range::overlaps (const Range &other) const
{
if (! is_started () || ! other.is_started ())
return false;
@ -202,7 +202,7 @@ bool Range::endsWithin (const Range& other) const
//
Range Range::intersect (const Range& other) const
{
if (overlap (other))
if (overlaps (other))
{
// Intersection is choosing the later of the two starts, and the earlier of
// the two ends, provided the two ranges overlap.
@ -237,7 +237,7 @@ Range Range::intersect (const Range& other) const
////////////////////////////////////////////////////////////////////////////////
bool Range::intersects (const Range &other) const
{
if (overlap (other)) {
if (overlaps (other)) {
return true;
}
@ -313,7 +313,7 @@ std::vector <Range> Range::subtract (const Range& other) const
{
std::vector <Range> results;
if (overlap (other))
if (overlaps (other))
{
if (start < other.start)
{

View file

@ -49,7 +49,7 @@ public:
bool contains (const Datetime&) const;
bool overlap (const Range&) const;
bool overlaps (const Range &) const;
bool encloses (const Range&) const;
bool startsWithin (const Range &) const;
bool endsWithin (const Range &) const;

View file

@ -252,7 +252,7 @@ static void determineHourRange (
for (auto& track : tracked)
{
if (day_range.overlap (track.range))
if (day_range.overlaps (track.range))
{
Interval clipped = clip (track, day_range);
if (track.range.is_open ())
@ -475,7 +475,7 @@ static void renderExclusionBlocks (
for (auto& exc : excluded)
{
if (exc.overlap (r))
if (exc.overlaps (r))
{
// Determine which of the character blocks included.
auto sub_hour = exc.intersect (r);
@ -521,7 +521,7 @@ static void renderInterval (
// Ignore any track that doesn't overlap with day.
auto day_range = getFullDay (day);
if (! day_range.overlap (track.range) ||
if (!day_range.overlaps (track.range) ||
(track.range.is_open () && day > now))
return;
@ -640,7 +640,7 @@ static std::string renderSummary (
{
time_t total_unavailable = 0;
for (auto& exclusion : exclusions)
if (filter.range.overlap (exclusion))
if (filter.range.overlaps (exclusion))
total_unavailable += filter.range.intersect (exclusion).total ();
time_t total_worked = 0;
@ -648,7 +648,7 @@ static std::string renderSummary (
{
for (auto& interval : tracked)
{
if (filter.range.overlap (interval.range))
if (filter.range.overlaps (interval.range))
{
Interval clipped = clip (interval, filter.range);
if (interval.range.is_open ())

View file

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez.
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -429,7 +429,7 @@ std::vector <Range> merge (
int merges = 0;
for (unsigned int i = 0; i < sorted.size (); ++i)
{
if (cursor && sorted[cursor - 1].overlap (sorted[i]))
if (cursor && sorted[cursor - 1].overlaps (sorted[i]))
{
sorted[cursor - 1] = sorted[cursor - 1].combine (sorted[i]);
++merges;
@ -457,11 +457,11 @@ std::vector <Range> addRanges (
std::vector <Range> results;
for (auto& range : ranges)
if (limits.overlap (range))
if (limits.overlaps (range))
results.push_back (range);
for (auto& addition : additions)
if (limits.overlap (addition))
if (limits.overlaps (addition))
results.push_back (addition);
return results;

View file

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez.
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -456,7 +456,7 @@ std::vector <Interval> getOverlaps (
std::vector <Interval> overlaps;
for (auto& track : tracked)
if (interval.range.overlap (track.range))
if (interval.range.overlaps (track.range))
overlaps.push_back (track);
return overlaps;