Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
FixedParser |
|
| 3.0;3 |
1 | /** | |
2 | * Copyright 2010 Sven Diedrichsen | |
3 | * | |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an | |
12 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | |
13 | * express or implied. See the License for the specific language | |
14 | * governing permissions and limitations under the License. | |
15 | */ | |
16 | package de.jollyday.parser.impl; | |
17 | ||
18 | import java.time.LocalDate; | |
19 | import java.util.Set; | |
20 | ||
21 | import de.jollyday.Holiday; | |
22 | import de.jollyday.HolidayType; | |
23 | import de.jollyday.config.Fixed; | |
24 | import de.jollyday.config.Holidays; | |
25 | import de.jollyday.parser.AbstractHolidayParser; | |
26 | ||
27 | /** | |
28 | * The Class FixedParser. Parses a fixed date | |
29 | * | |
30 | * @author tboven | |
31 | * @version $Id: $ | |
32 | */ | |
33 | 31 | public class FixedParser extends AbstractHolidayParser { |
34 | ||
35 | /* | |
36 | * (non-Javadoc) | |
37 | * | |
38 | * @see de.jollyday.parser.HolidayParser#parse(int, java.util.Set, | |
39 | * de.jollyday.config.Holidays) | |
40 | */ | |
41 | /** {@inheritDoc} */ | |
42 | @Override | |
43 | public void parse(int year, Set<Holiday> holidays, final Holidays config) { | |
44 | 485 | for (Fixed f : config.getFixed()) { |
45 | 2204 | if (!isValid(f, year)) { |
46 | 127 | continue; |
47 | } | |
48 | 2077 | LocalDate date = calendarUtil.create(year, f); |
49 | 2077 | LocalDate movedDate = moveDate(f, date); |
50 | 2077 | HolidayType type = xmlUtil.getType(f.getLocalizedType()); |
51 | 2077 | Holiday h = new Holiday(movedDate, f.getDescriptionPropertiesKey(), type); |
52 | 2077 | holidays.add(h); |
53 | 2077 | } |
54 | 485 | } |
55 | ||
56 | } |