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

Method mergeEbv

basex-core/src/main/java/org/basex/query/expr/IntPos.java:97–110  ·  view source on GitHub ↗
(final Expr ex, final boolean or, final CompileContext cc)

Source from the content-addressed store, hash-verified

95 }
96
97 @Override
98 public Expr mergeEbv(final Expr ex, final boolean or, final CompileContext cc) {
99 if(ex instanceof final IntPos pos) {
100 // find range with smaller minimum
101 final boolean smaller = min < pos.min;
102 final IntPos pos1 = smaller ? this : pos, pos2 = smaller ? pos : this;
103 // create intersection: pos: 1, 2 and pos: 2, 3 → pos: 2
104 if(!or) return get(pos2.min, Math.min(pos1.max, pos2.max), info);
105 // create union: pos: 1, 2 or pos: 2, 3 → pos: 1, 3
106 if(pos1.max + 1 >= pos2.min) return get(pos1.min, Math.max(pos1.max, pos2.max), info);
107 // disjoint ranges, no rewrite: pos: 1 or pos: 3
108 }
109 return null;
110 }
111
112 @Override
113 public boolean has(final Flag... flags) {

Callers

nothing calls this directly

Calls 3

getMethod · 0.95
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected