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)
| 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. |
no test coverage detected