| 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) { |