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 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
.regex
.Pattern
;
20 public final class NoteCalendarFinder
27 private NoteCalendarFinder()
32 * Returns the file map.
34 * @param __exe The executable.
35 * @return The file map.
38 public static NoteUsers
findNotes(FossilExe __exe
)
40 // There will be a number of users
41 NoteUsers users
= new NoteUsers();
43 // Determine which notes exist
44 for (String fileName
: __exe
.unversionList())
47 if (!fileName
.startsWith("developer-notes/"))
51 fileName
= fileName
.substring("developer-notes/".length());
53 // Split to determine when
54 String
[] splice
= fileName
.split(Pattern
.quote("/"));
55 if (splice
.length
!= 4)
58 // Determine the date and time
59 String userName
= splice
[0];
60 LocalDate date
= LocalDate
.of(
61 Integer
.parseInt(splice
[1], 10),
62 Integer
.parseInt(splice
[2], 10),
64 NoteCalendarFinder
.__unMkd(splice
[3]), 10));
67 users
.add(userName
, date
, fileName
);
75 * Removes the markdown extension from the file.
77 * @param __s The string to remove from.
78 * @return The string with the extension removed.
79 * @throws NullPointerException On null arguments.
82 private static String
__unMkd(String __s
)
83 throws NullPointerException
86 throw new NullPointerException("NARG");
89 if (!__s
.endsWith(".mkd"))
90 throw new IllegalArgumentException("Missing .mkd: " + __s
);
93 return __s
.substring(0, __s
.length() - 4);