@@ -87,15 +87,22 @@ public class Dictionary {
87
87
FST <IntsRef > suffixes ;
88
88
Breaks breaks = Breaks .DEFAULT ;
89
89
90
- // all condition checks used by prefixes and suffixes. these are typically re-used across
91
- // many affix stripping rules. so these are deduplicated, to save RAM.
90
+ /**
91
+ * All condition checks used by prefixes and suffixes. these are typically re-used across many
92
+ * affix stripping rules. so these are deduplicated, to save RAM.
93
+ */
92
94
ArrayList <CharacterRunAutomaton > patterns = new ArrayList <>();
93
95
94
- // the entries in the .dic file, mapping to their set of flags.
95
- // the fst output is the ordinal list for flagLookup
96
+ /**
97
+ * The entries in the .dic file, mapping to their set of flags. the fst output is the ordinal list
98
+ * for flagLookup.
99
+ */
96
100
FST <IntsRef > words ;
97
- // the list of unique flagsets (wordforms). theoretically huge, but practically
98
- // small (e.g. for polish this is 756), otherwise humans wouldn't be able to deal with it either.
101
+
102
+ /**
103
+ * The list of unique flagsets (wordforms). theoretically huge, but practically small (for Polish
104
+ * this is 756), otherwise humans wouldn't be able to deal with it either.
105
+ */
99
106
BytesRefHash flagLookup = new BytesRefHash ();
100
107
101
108
// the list of unique strip affixes.
@@ -126,8 +133,11 @@ public class Dictionary {
126
133
// st: morphological entries (either directly, or aliased from AM)
127
134
private String [] stemExceptions = new String [8 ];
128
135
private int stemExceptionCount = 0 ;
129
- // we set this during sorting, so we know to add an extra FST output.
130
- // when set, some words have exceptional stems, and the last entry is a pointer to stemExceptions
136
+
137
+ /**
138
+ * we set this during sorting, so we know to add an extra FST output. when set, some words have
139
+ * exceptional stems, and the last entry is a pointer to stemExceptions
140
+ */
131
141
boolean hasStemExceptions ;
132
142
133
143
boolean ignoreCase ;
@@ -1481,34 +1491,21 @@ public boolean getIgnoreCase() {
1481
1491
return ignoreCase ;
1482
1492
}
1483
1493
1484
- private static Path DEFAULT_TEMP_DIR ;
1485
-
1486
- /** Used by test framework */
1487
- @ SuppressWarnings ("unused" )
1488
- public static void setDefaultTempDir (Path tempDir ) {
1489
- DEFAULT_TEMP_DIR = tempDir ;
1490
- }
1491
-
1492
1494
/**
1493
- * Returns the default temporary directory. By default, java.io.tmpdir. If not accessible or not
1494
- * available, an IOException is thrown
1495
+ * Returns the default temporary directory pointed to by {@code java.io.tmpdir} . If not accessible
1496
+ * or not available, an IOException is thrown.
1495
1497
*/
1496
- static synchronized Path getDefaultTempDir () throws IOException {
1497
- if (DEFAULT_TEMP_DIR == null ) {
1498
- // Lazy init
1499
- String tempDirPath = System .getProperty ("java.io.tmpdir" );
1500
- if (tempDirPath == null ) {
1501
- throw new IOException ("Java has no temporary folder property (java.io.tmpdir)?" );
1502
- }
1503
- Path tempDirectory = Paths .get (tempDirPath );
1504
- if (!Files .isWritable (tempDirectory )) {
1505
- throw new IOException (
1506
- "Java's temporary folder not present or writeable?: " + tempDirectory .toAbsolutePath ());
1507
- }
1508
- DEFAULT_TEMP_DIR = tempDirectory ;
1498
+ static Path getDefaultTempDir () throws IOException {
1499
+ String tmpDir = System .getProperty ("java.io.tmpdir" );
1500
+ if (tmpDir == null ) {
1501
+ throw new IOException ("No temporary path (java.io.tmpdir)?" );
1509
1502
}
1510
-
1511
- return DEFAULT_TEMP_DIR ;
1503
+ Path tmpPath = Paths .get (tmpDir );
1504
+ if (!Files .isWritable (tmpPath )) {
1505
+ throw new IOException (
1506
+ "Temporary path not present or writeable?: " + tmpPath .toAbsolutePath ());
1507
+ }
1508
+ return tmpPath ;
1512
1509
}
1513
1510
1514
1511
/** Possible word breaks according to BREAK directives */
0 commit comments