Minor changes to javadoc and method visibility

pull/69/head
Alinson S. Xavier 10 years ago
parent 6826bd1ddc
commit 326cb8f73f

@ -71,7 +71,7 @@ public class CheckmarkList
@NonNull @NonNull
public int[] getValues(long fromTimestamp, long toTimestamp) public int[] getValues(long fromTimestamp, long toTimestamp)
{ {
buildCache(fromTimestamp, toTimestamp); compute(fromTimestamp, toTimestamp);
if(fromTimestamp > toTimestamp) return new int[0]; if(fromTimestamp > toTimestamp) return new int[0];
String query = "select value, timestamp from Checkmarks where " + 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 * Returns the values for all the checkmarks, since the oldest repetition of the habit until
* habit until today. If there are no repetitions at all, returns an empty array. * 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 * 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 * 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 from timestamp for the beginning of the interval
* @param to timestamp for the end 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; long day = DateHelper.millisecondsInOneDay;
@ -191,9 +191,11 @@ public class CheckmarkList
/** /**
* Returns newest checkmark that has already been computed. Ignores any checkmark that has * Returns newest checkmark that has already been computed. Ignores any checkmark that has
* timestamp in the future. This does not update the cache. * timestamp in the future. This does not update the cache.
*
* @return newest checkmark already computed
*/ */
@Nullable @Nullable
private Checkmark findNewest() protected Checkmark findNewest()
{ {
return new Select().from(Checkmark.class) return new Select().from(Checkmark.class)
.where("habit = ?", habit.getId()) .where("habit = ?", habit.getId())
@ -205,17 +207,21 @@ public class CheckmarkList
/** /**
* Returns the checkmark for today. * Returns the checkmark for today.
*
* @return checkmark for today
*/ */
@Nullable @Nullable
public Checkmark getToday() public Checkmark getToday()
{ {
long today = DateHelper.getStartOfToday(); long today = DateHelper.getStartOfToday();
buildCache(today, today); compute(today, today);
return findNewest(); 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() public int getTodayValue()
{ {

Loading…
Cancel
Save