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

Unified Diff: java/org/chromium/distiller/MonotonicPageInfosGroups.java

Issue 1178633002: implement parser for new pagination algorithm (Closed) Base URL: https://github.com/chromium/dom-distiller.git@master
Patch Set: addr wychen's comments Created 5 years, 2 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 | java/org/chromium/distiller/PageParameterParser.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: java/org/chromium/distiller/MonotonicPageInfosGroups.java
diff --git a/java/org/chromium/distiller/MonotonicPageInfosGroups.java b/java/org/chromium/distiller/MonotonicPageInfosGroups.java
index f2be969c6e23c00ba629b8f77d5b05e1f2cdc700..01470d0502181a10624e038b592f1e88121d50a4 100644
--- a/java/org/chromium/distiller/MonotonicPageInfosGroups.java
+++ b/java/org/chromium/distiller/MonotonicPageInfosGroups.java
@@ -37,13 +37,11 @@ class MonotonicPageInfosGroups {
}
/**
- * Add a PageParamInfo.PageInfo for the given page number and URL, ensuring the group stays
- * monotonic:
+ * Add the given PageParamInfo.PageInfo, ensuring the group stays monotonic:
* - add in the current group if the page number is strictly increasing or decreasing
* - otherwise, start a new group.
*/
- void addNumber(int number, String url) {
- PageParamInfo.PageInfo pageInfo = new PageParamInfo.PageInfo(number, url);
+ void addPageInfo(PageParamInfo.PageInfo pageInfo) {
Group group = getLastGroup();
if (group.mList.isEmpty()) {
group.mList.add(pageInfo);
@@ -74,6 +72,14 @@ class MonotonicPageInfosGroups {
group.mDeltaSign = deltaSign;
}
+ /**
+ * Add a PageParamInfo.PageInfo for the given page number and URL, ensuring the group stays
+ * monotonic.
+ */
+ void addNumber(int number, String url) {
+ addPageInfo(new PageParamInfo.PageInfo(number, url));
+ }
+
void cleanup() {
// Remove last empty adjacent number group.
if (!mGroups.isEmpty() && getLastGroup().mList.isEmpty()) {
« no previous file with comments | « no previous file | java/org/chromium/distiller/PageParameterParser.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698