|
|
@ -173,7 +173,7 @@ public class MemoryHabitList extends HabitList
|
|
|
|
else return p1.compareTo(p2);
|
|
|
|
else return p1.compareTo(p2);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Comparator<Habit> priorityComparatorDesc = (h1, h2) ->
|
|
|
|
Comparator<Habit> statusComparatorDesc = (h1, h2) ->
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (h1.isCompletedToday() != h2.isCompletedToday()) {
|
|
|
|
if (h1.isCompletedToday() != h2.isCompletedToday()) {
|
|
|
|
return h1.isCompletedToday() ? -1 : 1;
|
|
|
|
return h1.isCompletedToday() ? -1 : 1;
|
|
|
@ -189,7 +189,7 @@ public class MemoryHabitList extends HabitList
|
|
|
|
return v2.compareTo(v1);
|
|
|
|
return v2.compareTo(v1);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Comparator<Habit> priorityComparatorAsc = (h1, h2) -> priorityComparatorDesc.compare(h2, h1);
|
|
|
|
Comparator<Habit> statusComparatorAsc = (h1, h2) -> statusComparatorDesc.compare(h2, h1);
|
|
|
|
|
|
|
|
|
|
|
|
if (order == BY_POSITION) return positionComparator;
|
|
|
|
if (order == BY_POSITION) return positionComparator;
|
|
|
|
if (order == BY_NAME_ASC) return nameComparatorAsc;
|
|
|
|
if (order == BY_NAME_ASC) return nameComparatorAsc;
|
|
|
@ -198,8 +198,8 @@ public class MemoryHabitList extends HabitList
|
|
|
|
if (order == BY_COLOR_DESC) return colorComparatorDesc;
|
|
|
|
if (order == BY_COLOR_DESC) return colorComparatorDesc;
|
|
|
|
if (order == BY_SCORE_DESC) return scoreComparatorDesc;
|
|
|
|
if (order == BY_SCORE_DESC) return scoreComparatorDesc;
|
|
|
|
if (order == BY_SCORE_ASC) return scoreComparatorAsc;
|
|
|
|
if (order == BY_SCORE_ASC) return scoreComparatorAsc;
|
|
|
|
if (order == BY_PRIORITY_DESC) return priorityComparatorDesc;
|
|
|
|
if (order == BY_STATUS_DESC) return statusComparatorDesc;
|
|
|
|
if (order == BY_PRIORITY_ASC) return priorityComparatorAsc;
|
|
|
|
if (order == BY_STATUS_ASC) return statusComparatorAsc;
|
|
|
|
throw new IllegalStateException();
|
|
|
|
throw new IllegalStateException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|