MCPcopy Create free account
hub / github.com/BaseXdb/basex / unique

Method unique

basex-core/src/main/java/org/basex/core/cmd/Export.java:170–179  ·  view source on GitHub ↗

Returns a unique file path. @param exp exported names @param file file path @return unique path

(final HashSet<String> exp, final String file)

Source from the content-addressed store, hash-verified

168 * @return unique path
169 */
170 private static IOFile unique(final HashSet<String> exp, final String file) {
171 int c = 1;
172 String path = file;
173 while(exp.contains(path)) {
174 path = file.indexOf('.') == -1 ? file + '(' + ++c + ')' :
175 file.replaceAll("(.*)\\.(.*)", "$1(" + ++c + ").$2");
176 }
177 exp.add(path);
178 return new IOFile(path);
179 }
180}

Callers 2

exportMethod · 0.95
UserMethod · 0.45

Calls 3

containsMethod · 0.65
addMethod · 0.65
indexOfMethod · 0.45

Tested by

no test coverage detected