ScanRanges { public boolean intersects(byte[] lowerInclusiveKey, byte[] upperExclusiveKey, int keyOffset, boolean crossesRegionBoundary) { if (isEverything()) { return true; } if (isDegenerate()) { return false; } return intersectScan(null, lowerInclusiveKey, upperExclusiveKey, keyOffset, crossesRegionBoundary) == HAS_INTERSECTION; } private  ScanRanges(RowKeySchema schema, int[] slotSpan, List<List<KeyRange>> ranges, KeyRange scanRange, KeyRange minMaxRange, boolean useSkipScanFilter, boolean isPointLookup, Integer bucketNum); static ScanRanges create(RowKeySchema schema, List<List<KeyRange>> ranges, int[] slotSpan); static ScanRanges create(RowKeySchema schema, List<List<KeyRange>> ranges, int[] slotSpan, KeyRange minMaxRange, boolean forceRangeScan, Integer nBuckets); KeyRange getMinMaxRange(); void initializeScan(Scan scan); Scan intersectScan(Scan scan, final byte[] originalStartKey, final byte[] originalStopKey, final int keyOffset, boolean crossesRegionBoundary); boolean intersects(byte[] lowerInclusiveKey, byte[] upperExclusiveKey, int keyOffset, boolean crossesRegionBoundary); SkipScanFilter getSkipScanFilter(); List<List<KeyRange>> getRanges(); RowKeySchema getSchema(); boolean isEverything(); boolean isDegenerate(); boolean useSkipScanFilter(); boolean isPointLookup(); int getPointLookupCount(); Iterator<KeyRange> getPointLookupKeyIterator(); int getPkColumnSpan(); @Override String toString(); static final ScanRanges EVERYTHING; static final ScanRanges NOTHING; }
@Test public void test() { byte[] lowerInclusiveKey = keyRange.getLowerRange(); if (!keyRange.isLowerInclusive() && !Bytes.equals(lowerInclusiveKey, KeyRange.UNBOUND)) { lowerInclusiveKey = ByteUtil.nextKey(lowerInclusiveKey); } byte[] upperExclusiveKey = keyRange.getUpperRange(); if (keyRange.isUpperInclusive()) { upperExclusiveKey = ByteUtil.nextKey(upperExclusiveKey); } assertEquals(expectedResult, scanRanges.intersects(lowerInclusiveKey,upperExclusiveKey,0, true)); }