1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc
.squirreljme
.plugin
.util
;
12 import java
.time
.LocalDate
;
13 import java
.time
.temporal
.IsoFields
;
15 import java
.util
.TreeMap
;
18 * Represents the month.
22 public class NoteMonth
25 public final Map
<Integer
, NoteWeek
> weeks
=
28 /** The month number. */
29 public final int month
;
32 public final LocalDate date
;
35 * Initializes the month.
37 * @param __date The date.
38 * @param __num The month number.
39 * @throws NullPointerException On null arguments.
42 public NoteMonth(LocalDate __date
, int __num
)
43 throws NullPointerException
46 throw new NullPointerException("NARG");
55 * @param __date The date.
56 * @param __fileName The file name.
58 * @throws NullPointerException On null arguments.
61 public NoteWeek
add(LocalDate __date
, String __fileName
)
62 throws NullPointerException
64 if (__date
== null || __fileName
== null)
65 throw new NullPointerException("NARG");
67 int weekNum
= __date
.get(IsoFields
.WEEK_OF_WEEK_BASED_YEAR
);
68 NoteWeek rv
= this.weeks
.computeIfAbsent(weekNum
,
69 __key
-> new NoteWeek(__key
));
71 rv
.add(__date
, __fileName
);