/** * Returns a {@code SortedSet} of the specified portion of this {@code TreeSet} which * contains elements greater or equal to the start element but less than the * end element. The returned SortedSet is backed by this TreeSet so changes * to one are reflected by the other. * * @param start * the start element * @param end * the end element * @return a subset where the elements are greater or equal to * <code>start</code> and less than <code>end</code> * * @exception ClassCastException * when the start or end object cannot be compared with the * elements in this TreeSet * @exception NullPointerException * when the start or end object is null and the comparator * cannot handle null */ @SuppressWarnings("unchecked") public SortedSet<E> subSet(E start, E end) { return subSet(start, true, end, false); }
public MutableSortedSet<T> subSet(T fromElement, T toElement) { return SortedSetAdapter.adapt(this.treeSet.subSet(fromElement, toElement)); }
@Override public MutableSortedSet<T> subSet(T fromElement, T toElement) { return SortedSetAdapter.adapt(this.treeSet.subSet(fromElement, toElement)); }
@Override public MutableSortedSet<T> subSet(T fromElement, T toElement) { return SortedSetAdapter.adapt(this.treeSet.subSet(fromElement, toElement)); }
@Override public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { return set().subSet(fromElement, fromInclusive, toElement, toInclusive); }
@Override public SortedSet<E> subSet(E fromElement, E toElement) { return set().subSet(fromElement, toElement); }
private List<Long> expectedIdsInOrder( NodeValueTuple from, boolean fromInclusive, NodeValueTuple to, boolean toInclusive, IndexOrder indexOrder ) { List<Long> expectedIdsInOrder = singlePropValues.subSet( from, fromInclusive, to, toInclusive ) .stream() .map( NodeValueTuple::nodeId ) .collect( Collectors.toList() ); if ( indexOrder == IndexOrder.DESCENDING ) { Collections.reverse( expectedIdsInOrder ); } return expectedIdsInOrder; }
private void checkOverlaps(Replacement replacement) { Range<Integer> replacementRange = replacement.range(); Collection<Replacement> overlap = overlaps.subRangeMap(replacementRange).asMapOfRanges().values(); checkArgument( overlap.isEmpty(), "%s overlaps with existing replacements: %s", replacement, Joiner.on(", ").join(overlap)); Set<Integer> containedZeroLengthRangeStarts = zeroLengthRanges.subSet( replacementRange.lowerEndpoint(), /* fromInclusive= */ false, replacementRange.upperEndpoint(), /* toInclusive= */ false); checkArgument( containedZeroLengthRangeStarts.isEmpty(), "%s overlaps with existing zero-length replacements: %s", replacement, Joiner.on(", ").join(containedZeroLengthRangeStarts)); overlaps.put(replacementRange, replacement); if (replacementRange.isEmpty()) { zeroLengthRanges.add(replacementRange.lowerEndpoint()); } }
/** * Generates a coverage multimap from split key to Regions that start with the * split key. * * @return coverage multimap */ public Multimap<byte[], R> calcCoverage() { // This needs to be sorted to force the use of the comparator on the values, // otherwise byte array comparison isn't used Multimap<byte[], R> regions = TreeMultimap.create(BYTES_COMPARATOR, rangeCmp); // march through all splits from the start points for (Entry<byte[], Collection<R>> start : starts.asMap().entrySet()) { byte[] key = start.getKey(); for (R r : start.getValue()) { regions.put(key, r); for (byte[] coveredSplit : splits.subSet(r.getStartKey(), specialEndKey(r))) { regions.put(coveredSplit, r); } } } return regions; }
public List<Long> expectedIds( TreeSet<IndexEntryUpdate> sortedValues, Value booleanValue, Value from, Value to, boolean fromInclusive, boolean toInclusive ) { return sortedValues.subSet( add( 0, descriptor.schema(), booleanValue, from ), fromInclusive, add( 0, descriptor.schema(), booleanValue, to ), toInclusive ) .stream() .map( IndexEntryUpdate::getEntityId ) .sorted( Long::compare ) .collect( Collectors.toList() ); }
private List<Long> expectedIds( TreeSet<IndexEntryUpdate> sortedValues, Value from, Value to, boolean fromInclusive, boolean toInclusive ) { return sortedValues.subSet( add( 0, descriptor.schema(), from ), fromInclusive, add( 0, descriptor.schema(), to ), toInclusive ) .stream() .map( IndexEntryUpdate::getEntityId ) .sorted( Long::compare ) .collect( Collectors.toList() ); }
/** * Filter resources from the used model generating a new one containing only resources * having the name between from and to string.<br> * Note that objects are shared between models so changes to objects in the filtered model * will also affect the current model. * * @param from * @param to * @return the filtered model * @throws IllegalArgumentException if from or to are null */ public AboutModel filterNameByRange(String from, String to) throws IllegalArgumentException { if (from == null || to == null) { throw new IllegalArgumentException("Unable to parse from or to are null"); } return new AboutModel( getManifests() .subSet(new ManifestModel(from), true, new ManifestModel(to), true)); }
@Override public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { return new UnmodifiableTreeSet<>(super.subSet(fromElement, fromInclusive, toElement, toInclusive)); }
@Override public SortedSet<E> subSet(E fromElement, E toElement) { return new UnmodifiableTreeSet<>(super.subSet(fromElement, toElement)); }
for (TreeSet<Float> xMatch : xMatches.values()) SortedSet<Float> yMatches = xMatch.subSet(textY - tolerance, textY + tolerance); if (!yMatches.isEmpty())
public Iterator<Statement> subIterator(Statement fromElement, boolean fromInclusive, Statement toElement, boolean toInclusive) { return tree.subSet(fromElement, true, toElement, true).iterator(); } }
@Override public MutableSortedSet<T> subSet(T fromElement, T toElement) { return SortedSetAdapter.adapt(this.treeSet.subSet(fromElement, toElement)); }
@Override public NavigableSet subSet(Object fromElement, boolean fromInclusive, Object toElement, boolean toInclusive) { if (!_directAccess && isDelayLoad()) { load(); } return super.subSet(fromElement, fromInclusive, toElement, toInclusive); }
/** Finds all ranges that overlap or touch the given range. */ private NavigableSet<Range> overlaps(int start, int end, boolean includeTouching) { // Establish bounds on start times to select ranges that would overlap or touch Range startRange = new Range(start, 0); Range lower = ranges.lower(startRange); if (lower != null && lower.end >= (includeTouching ? start - 1 : start)) { // This range would overlap (or touch, if those are to be included) startRange = new Range(lower.start, 0); } Range endRange = new Range(end + 1, 0); // Any range with start time within startRange and endRange would touch or overlap return ranges.subSet(startRange, true, endRange, includeTouching); }