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

Method distinctTokens

basex-core/src/main/java/org/basex/util/Token.java:1068–1080  ·  view source on GitHub ↗

Normalizes the specified input and returns its distinct tokens. Optimized for small number of tokens. @param token token @return distinct tokens

(final byte[] token)

Source from the content-addressed store, hash-verified

1066 * @return distinct tokens
1067 */
1068 public static byte[][] distinctTokens(final byte[] token) {
1069 final byte[][] tokens = split(normalize(token), ' ');
1070 int tl = tokens.length;
1071 for(int i = 0; i < tl - 1; i++) {
1072 for(int j = i + 1; j < tl; j++) {
1073 if(eq(tokens[i], tokens[j])) {
1074 Array.remove(tokens, j, 1, tl);
1075 j--; tl--;
1076 }
1077 }
1078 }
1079 return Array.copyOf(tokens, tl);
1080 }
1081
1082 /**
1083 * Checks if the specified token has only whitespace.

Callers 11

valueIndexTestMethod · 0.80
cdataSectionElementsMethod · 0.80
qnamesMethod · 0.80
idsMethod · 0.80
addMethod · 0.80
testMethod · 0.80
unorderedMethod · 0.80
buildMethod · 0.80
keyMethod · 0.80
buildMethod · 0.80
ValueCacheMethod · 0.80

Calls 5

splitMethod · 0.95
normalizeMethod · 0.95
eqMethod · 0.95
removeMethod · 0.95
copyOfMethod · 0.95

Tested by 1

valueIndexTestMethod · 0.64