Commonize into PathUtils; On Linux/BSD try to use xdg-open/x-www-browser if Java...
[SquirrelJME.git] / buildSrc / src / main / java / cc / squirreljme / plugin / util / NoteYear.java
blob5cde879a8cb4c7023bda0573f09a40bed39bb79d
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc.squirreljme.plugin.util;
12 import java.time.LocalDate;
13 import java.util.Map;
14 import java.util.TreeMap;
16 /**
17 * Represents the year.
19 * @since 2020/06/27
21 public class NoteYear
23 /** The year number. */
24 public final int year;
26 /** The months. */
27 public final Map<Integer, NoteMonth> months =
28 new TreeMap<>();
30 /**
31 * Initializes the year.
33 * @param __num The number.
34 * @since 2020/06/27
36 public NoteYear(int __num)
38 this.year = __num;
41 /**
42 * Adds the month.
44 * @param __date The date.
45 * @param __fileName The file name.
46 * @return The added month.
47 * @throws NullPointerException On null arguments.
48 * @since 2020/06/27
50 public NoteMonth add(LocalDate __date, String __fileName)
51 throws NullPointerException
53 if (__date == null || __fileName == null)
54 throw new NullPointerException("NARG");
56 int monthNum = __date.getMonthValue();
57 NoteMonth rv = this.months.computeIfAbsent(monthNum,
58 __key -> new NoteMonth(__date, __key));
60 rv.add(__date, __fileName);
62 return rv;