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

Method slice

basex-core/src/main/java/org/basex/query/func/fn/FnSlice.java:80–87  ·  view source on GitHub ↗

Returns slice properties. @param size input size @param qc query context @return slice properties @throws QueryException query exception

(final long size, final QueryContext qc)

Source from the content-addressed store, hash-verified

78 * @throws QueryException query exception
79 */
80 protected final Slice slice(final long size, final QueryContext qc) throws QueryException {
81 Slice s = new Slice(size, toLong(1, 0, qc), toLong(2, 0, qc), toLong(3, 0, qc), false);
82 if(s.step < 0) s = new Slice(size, -s.start, -s.end, -s.step, true);
83 s.start = Math.max(1, s.start);
84 s.end = Math.min(size, s.end);
85 s.length = s.end < 1 || s.start > size || s.start > s.end ? 0 : s.end - s.start + 1;
86 return s;
87 }
88
89 /**
90 * Returns a normalized specified integer argument.

Callers 2

valueMethod · 0.95
optMethod · 0.95

Calls 3

toLongMethod · 0.95
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected