| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 PODIntervalSearchAdapter(Vector<IntervalType>& result, | 50 PODIntervalSearchAdapter(Vector<IntervalType>& result, |
| 51 const T& lowValue, | 51 const T& lowValue, |
| 52 const T& highValue) | 52 const T& highValue) |
| 53 : m_result(result), m_lowValue(lowValue), m_highValue(highValue) {} | 53 : m_result(result), m_lowValue(lowValue), m_highValue(highValue) {} |
| 54 | 54 |
| 55 const T& lowValue() const { return m_lowValue; } | 55 const T& lowValue() const { return m_lowValue; } |
| 56 const T& highValue() const { return m_highValue; } | 56 const T& highValue() const { return m_highValue; } |
| 57 void collectIfNeeded(const IntervalType& data) const { | 57 void collectIfNeeded(const IntervalType& data) const { |
| 58 if (data.overlaps(m_lowValue, m_highValue)) | 58 if (data.overlaps(m_lowValue, m_highValue)) |
| 59 m_result.append(data); | 59 m_result.push_back(data); |
| 60 } | 60 } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 Vector<IntervalType>& m_result; | 63 Vector<IntervalType>& m_result; |
| 64 T m_lowValue; | 64 T m_lowValue; |
| 65 T m_highValue; | 65 T m_highValue; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 // An interval tree, which is a form of augmented red-black tree. It | 68 // An interval tree, which is a form of augmented red-black tree. It |
| 69 // supports efficient (O(lg n)) insertion, removal and querying of | 69 // supports efficient (O(lg n)) insertion, removal and querying of |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 struct ValueToString<PODInterval<T, UserData>> { | 248 struct ValueToString<PODInterval<T, UserData>> { |
| 249 static String toString(const PODInterval<T, UserData>& interval) { | 249 static String toString(const PODInterval<T, UserData>& interval) { |
| 250 return interval.toString(); | 250 return interval.toString(); |
| 251 } | 251 } |
| 252 }; | 252 }; |
| 253 #endif | 253 #endif |
| 254 | 254 |
| 255 } // namespace blink | 255 } // namespace blink |
| 256 | 256 |
| 257 #endif // PODIntervalTree_h | 257 #endif // PODIntervalTree_h |
| OLD | NEW |