summaryrefslogtreecommitdiff
path: root/src/main/java/design/model/statistics/CourseStats.java
blob: 98d9529f9ec4aae94a408b6073d009afa6dde3f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package design.model.statistics;

import java.util.Arrays;

import design.model.Course;
import design.model.Round;

public class CourseStats extends StatisticsDecorator{
    private Course course;

    public CourseStats(Statistics wrapped_statistics, Course course){
        super(wrapped_statistics);
        this.course = course;
    }

    @Override
    public Round[] getRounds(){
        return Arrays.stream(super.getRounds())
                        .filter(rounds -> (rounds.getCourse().getName().equals(course.getName()) && rounds.getCourse().getLocation().equals(course.getLocation())))
                        .toArray(Round[]::new);
    }
}