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 / NoteWeek.java
blob4b3e09c0c5af608ec04a3622f73429f2ae92a409
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.DayOfWeek;
13 import java.time.LocalDate;
14 import java.util.Map;
15 import java.util.TreeMap;
17 /**
18 * Represents the week.
20 * @since 2020/06/27
22 public class NoteWeek
24 /** The weekdays. */
25 public final Map<DayOfWeek, NoteDay> weekdays =
26 new TreeMap<>();
28 /** The week of the year. */
29 public final int week;
31 /**
32 * Initializes the week.
34 * @param __num The week number.
35 * @since 2020/06/27
37 public NoteWeek(int __num)
39 this.week = __num;
42 /**
43 * Adds a day.
45 * @param __date The date.
46 * @param __fileName The file name.
47 * @return The day.
48 * @throws NullPointerException On null arguments.
49 * @since 2020/06/27
51 public NoteDay add(LocalDate __date, String __fileName)
52 throws NullPointerException
54 if (__date == null || __fileName == null)
55 throw new NullPointerException("NARG");
57 return this.weekdays.computeIfAbsent(__date.getDayOfWeek(),
58 __key -> new NoteDay(__date, __fileName));