Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1425)

Unified Diff: net/quic/core/interval.h

Issue 2339223003: Remove QUIC's Interval::difference. (Closed)
Patch Set: delete instead Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/quic/core/interval_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/interval.h
diff --git a/net/quic/core/interval.h b/net/quic/core/interval.h
index ef4661c760bf61f644f254298bc9eb25846b7d73..d29694e598bc054a22a5ebae9ad4498e3295c40e 100644
--- a/net/quic/core/interval.h
+++ b/net/quic/core/interval.h
@@ -157,19 +157,6 @@ class Interval {
// to represent that interval, and returns true iff *this was modified.
bool SpanningUnion(const Interval& i);
- // Determines the difference between two intervals by finding all points that
- // are contained in *this but not in i, coalesces those points into the
- // largest possible contiguous intervals, and appends those intervals to the
- // *difference vector. Intuitively this can be thought of as "erasing" i from
- // *this. This will either completely erase *this (leaving nothing behind),
- // partially erase some of *this from the left or right side (leaving some
- // residual behind), or erase a hole in the middle of *this (leaving behind an
- // interval on either side). Therefore, 0, 1, or 2 intervals will be appended
- // to *difference. The method returns true iff the intersection of *this and i
- // is non-empty. The caller owns the vector and the Interval* pointers
- // inside it. The difference vector is required to be non-null.
- bool Difference(const Interval& i, std::vector<Interval*>* difference) const;
-
// Determines the difference between two intervals as in
// Difference(Interval&, vector*), but stores the results directly in out
// parameters rather than dynamically allocating an Interval* and appending
@@ -266,53 +253,6 @@ bool Interval<T>::SpanningUnion(const Interval& i) {
template <typename T>
bool Interval<T>::Difference(const Interval& i,
- std::vector<Interval*>* difference) const {
- if (Empty()) {
- // <empty> - <i> = <empty>
- return false;
- }
- if (i.Empty()) {
- // <this> - <empty> = <this>
- difference->push_back(new Interval(*this));
- return false;
- }
- if (min() < i.max() && min() >= i.min() && max() > i.max()) {
- // [------ this ------)
- // [------ i ------)
- // [-- result ---)
- difference->push_back(new Interval(i.max(), max()));
- return true;
- }
- if (max() > i.min() && max() <= i.max() && min() < i.min()) {
- // [------ this ------)
- // [------ i ------)
- // [- result -)
- difference->push_back(new Interval(min(), i.min()));
- return true;
- }
- if (min() < i.min() && max() > i.max()) {
- // [------- this --------)
- // [---- i ----)
- // [ R1 ) [ R2 )
- // There are two results: R1 and R2.
- difference->push_back(new Interval(min(), i.min()));
- difference->push_back(new Interval(i.max(), max()));
- return true;
- }
- if (min() >= i.min() && max() <= i.max()) {
- // [--- this ---)
- // [------ i --------)
- // Intersection is <this>, so difference yields the empty interval.
- // Nothing is appended to *difference.
- return true;
- }
- // No intersection. Append <this>.
- difference->push_back(new Interval(*this));
- return false;
-}
-
-template <typename T>
-bool Interval<T>::Difference(const Interval& i,
Interval* lo,
Interval* hi) const {
// Initialize *lo and *hi to empty
« no previous file with comments | « no previous file | net/quic/core/interval_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698