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

Method dbName

basex-core/src/main/java/org/basex/io/IO.java:276–287  ·  view source on GitHub ↗

Generates a database name from the name of this resource. The path will be chopped and special characters from the remaining name will be removed. @return database name

()

Source from the content-addressed store, hash-verified

274 * @return database name
275 */
276 public final String dbName() {
277 final TokenBuilder tb = new TokenBuilder();
278 final byte[] token = token(name());
279 int nl = lastIndexOf(token, '.');
280 if(nl == -1) nl = token.length;
281 for(int n = 0; n < nl; n += cl(token, n)) {
282 final int ch = noDiacritics(cp(token, n));
283 if(Databases.validChar(ch, n == 0 || n + 1 == nl)) tb.add(ch);
284 }
285 // return hash code if string is empty (mainly required for CHECK command)
286 return tb.isEmpty() ? Integer.toString(hashCode()) : tb.toString();
287 }
288
289 /**
290 * Returns the name of the resource.

Callers 8

runMethod · 0.95
createMethod · 0.95
DialogImportMethod · 0.95
setTypeMethod · 0.95
BaseXGUIMethod · 0.80
addLocksMethod · 0.80
addURLMethod · 0.80
fileMethod · 0.80

Calls 12

nameMethod · 0.95
validCharMethod · 0.95
addMethod · 0.95
isEmptyMethod · 0.95
toStringMethod · 0.95
lastIndexOfMethod · 0.80
noDiacriticsMethod · 0.80
tokenMethod · 0.65
toStringMethod · 0.65
clMethod · 0.45
cpMethod · 0.45
hashCodeMethod · 0.45

Tested by 1

fileMethod · 0.64