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

Method remove

basex-core/src/main/java/org/basex/query/expr/path/Step.java:409–420  ·  view source on GitHub ↗

Checks if the step is redundant. @param seqType type of incoming nodes @return true if the step can be removed

(final SeqType seqType)

Source from the content-addressed store, hash-verified

407 * @return {@code true} if the step can be removed
408 */
409 final boolean remove(final SeqType seqType) {
410 // <xml/>/. → <xml/>
411 // <xml/>/self::node() → <xml/>
412 // $text/descendant-or-self::text() → $text
413 // $doc/ancestor-or-self::text() → $doc
414 final Type type = seqType.type;
415 return exprs.length == 0 && (
416 axis == SELF ||
417 axis == DESCENDANT_OR_SELF && isLeaf(type.kind()) ||
418 axis == ANCESTOR_OR_SELF && type.instanceOf(NodeType.DOCUMENT)
419 ) && test.subsumes(type) == Boolean.TRUE;
420 }
421
422 /**
423 * Adds predicates to the step.

Callers

nothing calls this directly

Calls 4

isLeafMethod · 0.95
kindMethod · 0.95
instanceOfMethod · 0.95
subsumesMethod · 0.45

Tested by

no test coverage detected