Package com.kernelcrew.moodapp.data
Class MoodEventFilter
java.lang.Object
com.kernelcrew.moodapp.data.MoodEventFilter
A class for filtering mood events through Firestore. It is used to build queries based on various filters.
-
Constructor Summary
ConstructorsConstructorDescriptionMoodEventFilter
(com.google.firebase.firestore.Query allMoodEvents) MoodEventFilter
(MoodEventProvider provider) -
Method Summary
Modifier and TypeMethodDescriptionaddEmotion
(Emotion emotion) addEmotions
(Set<Emotion> emotions) addSocialSituation
(String socialSituation) addSocialSituations
(Set<String> socialSituations) applyReasonFilter
(List<MoodEvent> events) Filters a list of mood events by reasonQuery if set.com.google.firebase.firestore.Query
Builds a Firestore Query using the applied filters.void
Clears all applied filters.int
count()
Counts the number of applied filters.Returns a summary of the currently applied filters.setDateRange
(Date startDate, Date endDate) setEmotions
(Set<Emotion> emotions) setLimit
(int limit) setLocation
(Double latitude, Double longitude, double radius) setReasonQuery
(String query) setSocialSituations
(Set<String> socialSituations) setSortField
(String field, com.google.firebase.firestore.Query.Direction direction) Set user filter to a single user ID.
-
Constructor Details
-
MoodEventFilter
public MoodEventFilter(com.google.firebase.firestore.Query allMoodEvents) -
MoodEventFilter
-
-
Method Details
-
addEmotion
-
addEmotions
-
setEmotions
-
setLocation
-
setDateRange
-
setSortField
public MoodEventFilter setSortField(String field, com.google.firebase.firestore.Query.Direction direction) -
setUser
Set user filter to a single user ID. -
setUsers
-
addUser
-
addUsers
-
setLimit
-
addSocialSituation
-
addSocialSituations
-
setSocialSituations
-
setReasonQuery
-
getEmotions
-
getStartDate
-
getEndDate
-
getReasonQuery
-
getFilterLatitude
-
getFilterLongitude
-
getFilterRadius
-
count
public int count()Counts the number of applied filters.- Returns:
- The number of active filters.
-
clearFilters
public void clearFilters()Clears all applied filters. -
getSummary
Returns a summary of the currently applied filters.- Returns:
- A summary string.
-
buildQuery
public com.google.firebase.firestore.Query buildQuery()Builds a Firestore Query using the applied filters.- Returns:
- A Query with filtering and sorting applied.
-
applyReasonFilter
Filters a list of mood events by reasonQuery if set.- Parameters:
events
- The events to filter.- Returns:
- A filtered List containing only those with a matching reason if reasonQuery is set.
-