Class SubmissionQuery<T extends VilleSubmissionFields>
java.lang.Object
studentrepoloader.model.villecsv.util.SubmissionQuery<T>
- Type Parameters:
T
- A type that extends VilleSubmission
Fluent wrapper for filtering and transforming lists of
VilleSubmissionFields
objects.
Enables expressive, immutable query chaining for CLI and batch processing scenarios.-
Constructor Summary
ConstructorsConstructorDescriptionSubmissionQuery
(List<T> submissions) Constructs a new query object from a given list. -
Method Summary
Modifier and TypeMethodDescription<R> List
<R> extractColumn
(Function<T, R> getter) Terminal operation that projects the current filtered list into a single column.Applies an arbitrary predicate to the current submission list.filterAfterDate
(String deadline) Filters submissions after the given ViLLe deadline date (yyyy-MM-dd).filterBeforeDate
(String deadline) Filters submissions on or before the given ViLLe deadline date.filterFieldContaining
(Function<T, String> getter, String mustContain) Filters by whether a specific field contains a given substring.filterIdAtOrAfter
(String lowerBound) Filters submissions where getID() is greater than or equal to the lower bound.filterIdAtOrBefore
(String upperBound) Filters submissions where getID() is less than or equal to the upper bound.filterIdBetween
(String lower, String upper) Filters submissions whose getID() falls within a specified inclusive range.Applies a negated filter condition to exclude matching entries.static <T extends VilleSubmissionFields>
SubmissionQuery<T> Static factory method to begin a fluent query.Sorts submissions by a field (e.g., ID or name).toList()
Returns the current list of filtered submissions.
-
Constructor Details
-
SubmissionQuery
-
-
Method Details
-
from
Static factory method to begin a fluent query.- Type Parameters:
T
- type of submission- Parameters:
submissions
- list of entries to wrap- Returns:
- a new SubmissionQuery instance
-
filterAfterDate
Filters submissions after the given ViLLe deadline date (yyyy-MM-dd).- Parameters:
deadline
- cutoff date as ISO string (inclusive-exclusive boundary)- Returns:
- filtered query containing only submissions strictly after the given date
-
filterBeforeDate
Filters submissions on or before the given ViLLe deadline date.- Parameters:
deadline
- inclusive cutoff date- Returns:
- filtered query containing submissions on or before the given date
-
filterIdAtOrBefore
Filters submissions where getID() is less than or equal to the upper bound.- Parameters:
upperBound
- max string value (case-insensitive)- Returns:
- filtered query
-
filterIdAtOrAfter
Filters submissions where getID() is greater than or equal to the lower bound.- Parameters:
lowerBound
- min string value (case-insensitive)- Returns:
- filtered query
-
filterIdBetween
Filters submissions whose getID() falls within a specified inclusive range.If
lower
is null or empty, the range is unbounded below. Ifupper
is null or empty, the range is unbounded above. If both are null or empty, no filtering is applied.- Parameters:
lower
- inclusive lower bound (nullable/empty to skip)upper
- inclusive upper bound (nullable/empty to skip)- Returns:
- filtered query
-
filterFieldContaining
Filters by whether a specific field contains a given substring.- Parameters:
getter
- field accessor functionmustContain
- target substring- Returns:
- filtered query including only entries whose field includes the substring
-
filter
Applies an arbitrary predicate to the current submission list. This is the general-purpose filtering function used internally by all specific filters.- Parameters:
condition
- the predicate to apply- Returns:
- a filtered SubmissionQuery instance
-
filterNot
Applies a negated filter condition to exclude matching entries. This is the inverse offilter(Predicate)
.- Parameters:
condition
- predicate whose matches should be excluded- Returns:
- a filtered SubmissionQuery excluding matching entries
-
sortBy
Sorts submissions by a field (e.g., ID or name).- Parameters:
getter
- field accessor for sorting- Returns:
- a sorted query
-
extractColumn
Terminal operation that projects the current filtered list into a single column.Applies the given field accessor or transformation function to each submission and returns the resulting values in order. Commonly used for generating summaries, diagnostics, or exporting a specific attribute from the current query result.
- Type Parameters:
R
- the type of values extracted- Parameters:
getter
- function to extract or transform a field from each submission- Returns:
- a list of extracted values, one per submission
-
toList
-