List of usage examples for com.google.common.collect ImmutableRangeSet of
@SuppressWarnings("unchecked") public static <C extends Comparable> ImmutableRangeSet<C> of()
From source file:org.mskcc.shenkers.view.GeneViewBuilder.java
public GeneViewBuilder(Range<Integer> transcript, Optional<RangeSet<Integer>> exons, Optional<Range<Integer>> cds) { gene = transcript;/*from ww w . java 2 s . co m*/ codingSubset = cds.map(c -> exons.map(e -> asClosed(e.subRangeSet(c))).orElse(ImmutableRangeSet.of())) .orElse(ImmutableRangeSet.of()); introns = TreeRangeSet.create(); introns.add(transcript); exons.ifPresent(e -> introns.removeAll(e)); RangeSet<Integer> utr = exons.map(e -> (RangeSet<Integer>) TreeRangeSet.create(e)) .orElse(TreeRangeSet.create()); utr.removeAll(codingSubset); untranslated = utr; log.info("UTRs {}", untranslated); log.info("introns {}", introns); log.info("CDSs {}", codingSubset); }
From source file:org.pentaho.di.trans.steps.samplerows.SampleRowsData.java
public SampleRowsData() { super(); rangeSet = ImmutableRangeSet.of(); addlineField = false; outputRow = null; }
From source file:io.horizondb.model.core.predicates.BetweenPredicate.java
/** * {@inheritDoc}//from w w w.ja va 2 s. c om */ @Override public RangeSet<Field> getTimestampRanges() { if (!isTimestamp()) { return TimestampField.ALL; } if (this.max.compareTo(this.min) < 0) { return ImmutableRangeSet.of(); } Range<Field> range = Range.<Field>closed(this.min, this.max); RangeSet<Field> rangeSet = ImmutableRangeSet.of(range); if (this.notBetween) { return rangeSet.complement(); } return rangeSet; }
From source file:org.apache.cassandra.cql3.restrictions.TokenFilter.java
/** * Converts the specified slice into a range set. * * @param slice the slice to convert/*from w w w.j a v a 2 s .co m*/ * @param options the query option * @return the range set corresponding to the specified slice * @throws InvalidRequestException if the request is invalid */ private static RangeSet<Token> toRangeSet(TokenRestriction slice, QueryOptions options) throws InvalidRequestException { if (slice.hasBound(START)) { Token start = deserializeToken(slice.bounds(START, options).get(0)); BoundType startBoundType = toBoundType(slice.isInclusive(START)); if (slice.hasBound(END)) { BoundType endBoundType = toBoundType(slice.isInclusive(END)); Token end = deserializeToken(slice.bounds(END, options).get(0)); if (start.equals(end) && (BoundType.OPEN == startBoundType || BoundType.OPEN == endBoundType)) return ImmutableRangeSet.of(); if (start.compareTo(end) <= 0) return ImmutableRangeSet.of(Range.range(start, startBoundType, end, endBoundType)); return ImmutableRangeSet.<Token>builder().add(Range.upTo(end, endBoundType)) .add(Range.downTo(start, startBoundType)).build(); } return ImmutableRangeSet.of(Range.downTo(start, startBoundType)); } Token end = deserializeToken(slice.bounds(END, options).get(0)); return ImmutableRangeSet.of(Range.upTo(end, toBoundType(slice.isInclusive(END)))); }