Package com.example.lottery.util
Class EntrantEventFilterUtils
java.lang.Object
com.example.lottery.util.EntrantEventFilterUtils
Pure filter predicates for the entrant Explore event list.
Extracted from
EntrantMainActivity so the
filtering rules can be unit tested without launching an Activity.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanTrue if the event has room on its waiting list and registration is still open.static booleanisNewEvent(Event event, Date now) True if the event was created within the last seven days.static booleanisRecommendedEvent(Event event, List<String> interests) True if the event's category matches any stored user interest.static booleanDispatches to the predicate for the selected browse tab.static booleanmatchesCategory(Event event, String category) True if the event category matches the selected filter.static booleanmatchesSearchQuery(Event event, String rawQuery) Case-insensitive substring match of the event title against the query.static booleanmatchesTimeFilter(Event event, String timeFilter, Date now) True if the event's scheduled time falls within the selected time window.
-
Field Details
-
BROWSE_ALL
- See Also:
-
BROWSE_NEW
- See Also:
-
BROWSE_RECOMMENDED
- See Also:
-
TIME_ALL_DATES
- See Also:
-
TIME_TODAY
- See Also:
-
TIME_THIS_WEEK
- See Also:
-
TIME_THIS_MONTH
- See Also:
-
CATEGORY_ALL
- See Also:
-
-
Method Details
-
matchesSearchQuery
Case-insensitive substring match of the event title against the query. -
matchesCategory
True if the event category matches the selected filter. -
matchesTimeFilter
True if the event's scheduled time falls within the selected time window. -
hasAvailableSpots
True if the event has room on its waiting list and registration is still open. -
isNewEvent
True if the event was created within the last seven days. -
isRecommendedEvent
True if the event's category matches any stored user interest. -
matchesBrowseTab
public static boolean matchesBrowseTab(Event event, String browseTab, Date now, List<String> interests) Dispatches to the predicate for the selected browse tab.
-