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

Method value

basex-core/src/main/java/org/basex/query/expr/Range.java:78–91  ·  view source on GitHub ↗
(final QueryContext qc)

Source from the content-addressed store, hash-verified

76 }
77
78 @Override
79 public Value value(final QueryContext qc) throws QueryException {
80 final Item min = exprs[0].atomItem(qc, info);
81 if(min == Empty.VALUE) return Empty.VALUE;
82 final Item max = exprs[1].atomItem(qc, info);
83 if(max == Empty.VALUE) return Empty.VALUE;
84 final long mn = toLong(min), mx = toLong(max);
85 // min smaller than max: empty sequence
86 if(mn > mx) return Empty.VALUE;
87 // max smaller than min: create range
88 final long size = mx - mn + 1;
89 // too large range: assign maximum
90 return RangeSeq.get(mn, size < 0 ? Long.MAX_VALUE : size, true);
91 }
92
93 @Override
94 public Range copy(final CompileContext cc, final IntObjectMap<Var> vm) {

Callers

nothing calls this directly

Calls 3

getMethod · 0.95
atomItemMethod · 0.45
toLongMethod · 0.45

Tested by

no test coverage detected