71 lines
1.5 KiB
Java
Executable File
71 lines
1.5 KiB
Java
Executable File
package grading.io;
|
|
|
|
import grading.*;
|
|
import java.util.*;
|
|
|
|
/**
|
|
* An aggregate for Grade representing a specific type of assignment with a specific Filter and
|
|
* GradingStrategy.
|
|
*/
|
|
public class Category
|
|
{
|
|
private final String key;
|
|
private final List<Grade> grades;
|
|
private final Filter filter;
|
|
private final GradingStrategy strategy;
|
|
|
|
/**
|
|
* @param key
|
|
* The key for the Category
|
|
* @param grades
|
|
* The Grades in the category
|
|
* @param filter
|
|
* The filter to apply to the collection of grades
|
|
* @param strategy
|
|
* The strategy used to calculate the final Category Grade
|
|
*/
|
|
public Category(final String key, final List<Grade> grades, final Filter filter,
|
|
final GradingStrategy strategy)
|
|
{
|
|
if (key == null || key.isEmpty())
|
|
throw new IllegalArgumentException();
|
|
|
|
this.key = key;
|
|
this.grades = grades;
|
|
this.filter = filter;
|
|
this.strategy = strategy;
|
|
}
|
|
|
|
/**
|
|
* @return The filter for the Category
|
|
*/
|
|
public Filter getFilter()
|
|
{
|
|
return filter;
|
|
}
|
|
|
|
/**
|
|
* @return The GradingStrategy for the Category
|
|
*/
|
|
public GradingStrategy getStrategy()
|
|
{
|
|
return strategy;
|
|
}
|
|
|
|
/**
|
|
* @return The Grades making up the Category
|
|
*/
|
|
public List<Grade> getGrades()
|
|
{
|
|
return grades;
|
|
}
|
|
|
|
/**
|
|
* @return The key for the Category
|
|
*/
|
|
public String getKey()
|
|
{
|
|
return key;
|
|
}
|
|
}
|