@Test public void testInvert() throws SqlException { final String intervalStr = "2018-01-10T10:30:00.000Z;30m;2d;2"; LongList out = new LongList(); IntrinsicModel.parseIntervalEx(intervalStr, 0, intervalStr.length(), 0, out); IntrinsicModel.invert(out); TestUtils.assertEquals("[{lo=, hi=2018-01-10T10:29:59.999999Z},{lo=2018-01-10T11:00:00.000001Z, hi=2018-01-12T10:29:59.999999Z},{lo=2018-01-12T11:00:00.000001Z, hi=294247-01-10T04:00:54.775807Z}]", intervalToString(out)); }
static void invert(LongList intervals) { long last = Long.MIN_VALUE; int n = intervals.size(); for (int i = 0; i < n; i += 2) { final long lo = intervals.getQuick(i); final long hi = intervals.getQuick(i + 1); intervals.setQuick(i, last); intervals.setQuick(i + 1, lo - 1); last = hi + 1; } intervals.extendAndSet(n + 1, Long.MAX_VALUE); intervals.extendAndSet(n, last); }
IntrinsicModel implements Mutable { static void invert(LongList intervals) { long last = Long.MIN_VALUE; int n = intervals.size(); for (int i = 0; i < n; i += 2) { final long lo = intervals.getQuick(i); final long hi = intervals.getQuick(i + 1); intervals.setQuick(i, last); intervals.setQuick(i + 1, lo - 1); last = hi + 1; } intervals.extendAndSet(n + 1, Long.MAX_VALUE); intervals.extendAndSet(n, last); } }
IntrinsicModel implements Mutable { static void invert(LongList intervals) { long last = Long.MIN_VALUE; int n = intervals.size(); for (int i = 0; i < n; i += 2) { final long lo = intervals.getQuick(i); final long hi = intervals.getQuick(i + 1); intervals.setQuick(i, last); intervals.setQuick(i + 1, lo - 1); last = hi + 1; } intervals.extendAndSet(n + 1, Long.MAX_VALUE); intervals.extendAndSet(n, last); }  }
IntrinsicModel implements Mutable { static void invert(LongList intervals) { long last = Long.MIN_VALUE; int n = intervals.size(); for (int i = 0; i < n; i += 2) { final long lo = intervals.getQuick(i); final long hi = intervals.getQuick(i + 1); intervals.setQuick(i, last); intervals.setQuick(i + 1, lo - 1); last = hi + 1; } intervals.extendAndSet(n + 1, Long.MAX_VALUE); intervals.extendAndSet(n, last); }  static long getIntervalHi(LongList intervals, int pos); static long getIntervalLo(LongList intervals, int pos); static long parseFloorPartialDate(CharSequence seq, final int pos, int lim); static long parseCeilingPartialDate(CharSequence seq, final int pos, int lim); @Override void clear(); void clearInterval(); void excludeValue(ExpressionNode val); void intersectIntervals(long lo, long hi); void intersectIntervals(CharSequence seq, int lo, int lim, int position); void subtractIntervals(long lo, long hi); void subtractIntervals(CharSequence seq, int lo, int lim, int position); @Override String toString(); }
IntrinsicModel implements Mutable { static void invert(LongList intervals) { long last = Long.MIN_VALUE; int n = intervals.size(); for (int i = 0; i < n; i += 2) { final long lo = intervals.getQuick(i); final long hi = intervals.getQuick(i + 1); intervals.setQuick(i, last); intervals.setQuick(i + 1, lo - 1); last = hi + 1; } intervals.extendAndSet(n + 1, Long.MAX_VALUE); intervals.extendAndSet(n, last); }  static long getIntervalHi(LongList intervals, int pos); static long getIntervalLo(LongList intervals, int pos); static long parseFloorPartialDate(CharSequence seq, final int pos, int lim); static long parseCeilingPartialDate(CharSequence seq, final int pos, int lim); @Override void clear(); void clearInterval(); void excludeValue(ExpressionNode val); void intersectIntervals(long lo, long hi); void intersectIntervals(CharSequence seq, int lo, int lim, int position); void subtractIntervals(long lo, long hi); void subtractIntervals(CharSequence seq, int lo, int lim, int position); @Override String toString(); static final ObjectFactory<IntrinsicModel> FACTORY; static final int TRUE; static final int FALSE; static final int UNDEFINED; final CharSequenceHashSet keyValues; final CharSequenceHashSet keyExcludedValues; final IntList keyValuePositions; final IntList keyExcludedValuePositions; public CharSequence keyColumn; public ExpressionNode filter; public LongList intervals; public int intrinsicValue; public QueryModel keySubQuery; }