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 / NoteUser.java
blob57e72cc658d5a53f63312d5c1585ea0b795e09ca
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 a single user.
19 * @since 2020/06/27
21 public class NoteUser
23 /** The user name. */
24 public final String userName;
26 /** The years. */
27 public final Map<Integer, NoteYear> years =
28 new TreeMap<>();
30 /**
31 * Initializes the user.
33 * @param __userName The user name.
34 * @throws NullPointerException On null arguments.
35 * @since 2020/06/27
37 public NoteUser(String __userName)
38 throws NullPointerException
40 this.userName = __userName;
43 /**
44 * Adds the year.
46 * @param __date The date.
47 * @param __fileName The file name.
48 * @return The added year.
49 * @throws NullPointerException On null arguments.
50 * @since 2020/06/27
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);
64 return rv;