Skip to content

Commit cf7d045

Browse files
committed
rename variables/methods for better readability
1 parent a53af66 commit cf7d045

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

opengrok-web/src/main/java/org/opengrok/web/PageConfig.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -556,24 +556,24 @@ public int getIntParam(String name, int defaultValue) {
556556
}
557557

558558
/**
559-
* Get the <b>start</b> index for a search result to return by looking up
559+
* Get the <b>start</b> index for a search result or history listing to return by looking up
560560
* the {@code start} request parameter.
561561
*
562562
* @return 0 if the corresponding start parameter is not set or not a
563563
* number, the number found otherwise.
564564
*/
565-
public int getSearchStart() {
565+
public int getStartIndex() {
566566
return getIntParam(QueryParameters.START_PARAM, 0);
567567
}
568568

569569
/**
570-
* Get the number of search results to max. return by looking up the
570+
* Get the number of search results or history entries to display by looking up the
571571
* {@code n} request parameter.
572572
*
573-
* @return the default number of hits if the corresponding start parameter
573+
* @return the default number of items if the corresponding start parameter
574574
* is not set or not a number, the number found otherwise.
575575
*/
576-
public int getSearchMaxItems() {
576+
public int getMaxItems() {
577577
return getIntParam(QueryParameters.COUNT_PARAM, getEnv().getHitsPerPage());
578578
}
579579

@@ -1482,8 +1482,8 @@ public SearchHelper prepareSearch() {
14821482
*/
14831483
public SearchHelper prepareInternalSearch(SortOrder sortOrder) {
14841484
String xrValue = req.getParameter(QueryParameters.NO_REDIRECT_PARAM);
1485-
return new SearchHelper(getSearchStart(), sortOrder, getDataRoot(), new File(getSourceRootPath()),
1486-
getSearchMaxItems(), getEftarReader(), getQueryBuilder(), getPrefix() == Prefix.SEARCH_R,
1485+
return new SearchHelper(getStartIndex(), sortOrder, getDataRoot(), new File(getSourceRootPath()),
1486+
getMaxItems(), getEftarReader(), getQueryBuilder(), getPrefix() == Prefix.SEARCH_R,
14871487
req.getContextPath(), getPrefix() == Prefix.SEARCH_R || getPrefix() == Prefix.SEARCH_P,
14881488
xrValue != null && !xrValue.isEmpty());
14891489
}

opengrok-web/src/main/webapp/history.jsp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ include file="/httpheader.jspf"
138138
History hist;
139139
if ((hist = (History) request.getAttribute("history.jsp-hist")) != null) {
140140
141-
int start = cfg.getSearchStart();
142-
int max = cfg.getSearchMaxItems();
141+
int start = cfg.getStartIndex();
142+
int max = cfg.getMaxItems();
143143
long totalHits = hist.getHistoryEntries().size();
144144
long thispage = Math.min(totalHits - start, max);
145145
@@ -198,8 +198,8 @@ include file="/minisearch.jspf"
198198
revision2 + 1 : cfg.getIntParam(QueryParameters.REVISION_1_PARAM, -1);
199199
revision2 = revision2 >= hist.getHistoryEntries().size() ? hist.getHistoryEntries().size() - 1 : revision2;
200200
201-
int start = cfg.getSearchStart();
202-
int max = cfg.getSearchMaxItems();
201+
int startIndex = cfg.getStartIndex();
202+
int maxItems = cfg.getMaxItems();
203203
%>
204204
<script type="text/javascript">/* <![CDATA[ */
205205
document.domReady.push(function() {domReadyHistory();});
@@ -255,7 +255,7 @@ document.domReady.push(function() {domReadyHistory();});
255255
<tbody>
256256
<%
257257
int count=0;
258-
for (HistoryEntry entry : hist.getHistoryEntries(max, start)) {
258+
for (HistoryEntry entry : hist.getHistoryEntries(maxItems, startIndex)) {
259259
String rev = entry.getRevision();
260260
if (rev == null || rev.length() == 0) {
261261
rev = "";
@@ -296,17 +296,17 @@ document.domReady.push(function() {domReadyHistory();});
296296
<td><%
297297
%><input type="radio"
298298
aria-label="From"
299-
data-revision-1="<%= (start + count) %>"
299+
data-revision-1="<%= (startIndex + count) %>"
300300
data-revision-2="<%= revision2 %>"
301301
data-diff-revision="<%= QueryParameters.REVISION_1_PARAM %>"
302-
data-revision-path="<%= path + '@' + hist.getHistoryEntries().get(start + count).getRevision()%>"
302+
data-revision-path="<%= path + '@' + hist.getHistoryEntries().get(startIndex + count).getRevision()%>"
303303
<%
304-
if (count + start > revision1 || (count + start > revision2 && count + start <= revision1 - 1)) {
304+
if (count + startIndex > revision1 || (count + startIndex > revision2 && count + startIndex <= revision1 - 1)) {
305305
// revision1 enabled
306-
} else if (count + start == revision1 ) {
306+
} else if (count + startIndex == revision1 ) {
307307
// revision1 selected
308308
%> checked="checked"<%
309-
} else if( count + start <= revision2 ) {
309+
} else if( count + startIndex <= revision2 ) {
310310
// revision1 disabled
311311
%> disabled="disabled" <%
312312
}
@@ -315,16 +315,16 @@ document.domReady.push(function() {domReadyHistory();});
315315
%><input type="radio"
316316
aria-label="To"
317317
data-revision-1="<%= revision1 %>"
318-
data-revision-2="<%= (start + count) %>"
318+
data-revision-2="<%= (startIndex + count) %>"
319319
data-diff-revision="<%= QueryParameters.REVISION_2_PARAM %>"
320-
data-revision-path="<%= path + '@' + hist.getHistoryEntries().get(start + count).getRevision() %>"
320+
data-revision-path="<%= path + '@' + hist.getHistoryEntries().get(startIndex + count).getRevision() %>"
321321
<%
322-
if( count + start < revision2 || (count + start > revision2 && count + start <= revision1 - 1) ) {
322+
if( count + startIndex < revision2 || (count + startIndex > revision2 && count + startIndex <= revision1 - 1) ) {
323323
// revision2 enabled
324-
} else if( count + start == revision2 ) {
324+
} else if( count + startIndex == revision2 ) {
325325
// revision2 selected
326326
%> checked="checked" <%
327-
} else if (count + start >= revision1 ) {
327+
} else if (count + startIndex >= revision1 ) {
328328
// revision2 disabled
329329
%> disabled="disabled" <%
330330
}

0 commit comments

Comments
 (0)