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

Method get

basex-core/src/main/java/org/basex/query/expr/path/Test.java:41–54  ·  view source on GitHub ↗

Creates a new test. @param kind node kind (can be null) @param qname node name (can be null) @param scope scope (can be null) @param ns default element namespace (used for optimizations, can be null) @return test

(final Kind kind, final QNm qname, final Scope scope, final byte[] ns)

Source from the content-addressed store, hash-verified

39 * @return test
40 */
41 public static Test get(final Kind kind, final QNm qname, final Scope scope, final byte[] ns) {
42 final QNm n = qname != null ? qname : QNm.EMPTY;
43 final Kind k = kind != null ? kind : Kind.GNODE;
44 final Scope s = scope == Scope.FLEXIBLE && k.instanceOf(Kind.NODE) ? Scope.FULL :
45 scope != null ? scope : k == Kind.PROCESSING_INSTRUCTION ? Scope.LOCAL : Scope.FULL;
46
47 if(k != Kind.GNODE) {
48 // element(*), attribute(*), jnode(*)
49 if(s == Scope.ALL || n == QNm.EMPTY) return NodeTest.get(k);
50 // jnode(a)
51 if(s == Scope.FLEXIBLE && k == Kind.JNODE) return JNodeTest.get(Str.get(n.string()), null);
52 }
53 return new NameTest(n, s, k, ns);
54 }
55
56 /**
57 * Creates a single test.

Callers 11

errorMethod · 0.95
axisStepMethod · 0.95
nodeTestMethod · 0.95
simpleNodeTestMethod · 0.95
documentTestMethod · 0.95
elemAttrTestMethod · 0.95
mergePathsMethod · 0.95
optPredMethod · 0.95
childrenMethod · 0.95
attributeMethod · 0.95
unionMethod · 0.95

Calls 9

instanceOfMethod · 0.95
getMethod · 0.95
getMethod · 0.95
getMethod · 0.95
stringMethod · 0.95
mergeMethod · 0.95
sizeMethod · 0.65
getMethod · 0.65
toArrayMethod · 0.45

Tested by

no test coverage detected