From 326cb8f73f02fdf0a508a60ac21263769658fd34 Mon Sep 17 00:00:00 2001 From: Alinson Xavier Date: Fri, 18 Mar 2016 10:42:47 -0400 Subject: [PATCH] Minor changes to javadoc and method visibility --- .../isoron/uhabits/models/CheckmarkList.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/isoron/uhabits/models/CheckmarkList.java b/app/src/main/java/org/isoron/uhabits/models/CheckmarkList.java index cb96f74af..d4fd67617 100644 --- a/app/src/main/java/org/isoron/uhabits/models/CheckmarkList.java +++ b/app/src/main/java/org/isoron/uhabits/models/CheckmarkList.java @@ -71,7 +71,7 @@ public class CheckmarkList @NonNull public int[] getValues(long fromTimestamp, long toTimestamp) { - buildCache(fromTimestamp, toTimestamp); + compute(fromTimestamp, toTimestamp); if(fromTimestamp > toTimestamp) return new int[0]; String query = "select value, timestamp from Checkmarks where " + @@ -102,8 +102,8 @@ public class CheckmarkList } /** - * Computes and returns the values for all the checkmarks, since the oldest repetition of the - * habit until today. If there are no repetitions at all, returns an empty array. + * Returns the values for all the checkmarks, since the oldest repetition of the habit until + * today. If there are no repetitions at all, returns an empty array. * * The values are returned in an array containing one integer value for each day since the * first repetition of the habit until today. The first entry corresponds to today, the second @@ -130,7 +130,7 @@ public class CheckmarkList * @param from timestamp for the beginning of the interval * @param to timestamp for the end of the interval */ - public void buildCache(long from, long to) + protected void compute(long from, long to) { long day = DateHelper.millisecondsInOneDay; @@ -191,9 +191,11 @@ public class CheckmarkList /** * Returns newest checkmark that has already been computed. Ignores any checkmark that has * timestamp in the future. This does not update the cache. + * + * @return newest checkmark already computed */ @Nullable - private Checkmark findNewest() + protected Checkmark findNewest() { return new Select().from(Checkmark.class) .where("habit = ?", habit.getId()) @@ -205,17 +207,21 @@ public class CheckmarkList /** * Returns the checkmark for today. + * + * @return checkmark for today */ @Nullable public Checkmark getToday() { long today = DateHelper.getStartOfToday(); - buildCache(today, today); + compute(today, today); return findNewest(); } /** - * Returns the value of today's checkmark. If there is no checkmark today, returns UNCHECKED. + * Returns the value of today's checkmark. + * + * @return value of today's checkmark */ public int getTodayValue() {