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
;
14 import java
.util
.TreeMap
;
17 * Represents a single user.
24 public final String userName
;
27 public final Map
<Integer
, NoteYear
> years
=
31 * Initializes the user.
33 * @param __userName The user name.
34 * @throws NullPointerException On null arguments.
37 public NoteUser(String __userName
)
38 throws NullPointerException
40 this.userName
= __userName
;
46 * @param __date The date.
47 * @param __fileName The file name.
48 * @return The added year.
49 * @throws NullPointerException On null arguments.
52 public NoteYear
add(LocalDate __date
, String __fileName
)
53 throws NullPointerException
55 if (__date
== null || __fileName
== null)
56 throw new NullPointerException("NARG");
58 int yearNum
= __date
.getYear();
59 NoteYear rv
= this.years
.computeIfAbsent(yearNum
,
60 __key
-> new NoteYear(__key
));
62 rv
.add(__date
, __fileName
);