List of usage examples for com.google.common.collect Range upperBoundType
public BoundType upperBoundType()
From source file:net.conquiris.lucene.search.SearchSupport.java
static boolean maxIncluded(Range<?> range) { return range.hasUpperBound() && range.upperBoundType() == BoundType.CLOSED; }
From source file:com.google.googlejavaformat.intellij.FormatterUtil.java
private static TextRange toTextRange(Range<Integer> range) { checkState(/*from w ww .j a va2 s . com*/ range.lowerBoundType().equals(BoundType.CLOSED) && range.upperBoundType().equals(BoundType.OPEN)); return new TextRange(range.lowerEndpoint(), range.upperEndpoint()); }
From source file:org.mskcc.shenkers.data.interval.RangeTools.java
public static Range<Integer> asClosed(Range<Integer> r) { return Range.closed(r.lowerBoundType() == BoundType.OPEN ? r.lowerEndpoint() + 1 : r.lowerEndpoint(), r.upperBoundType() == BoundType.OPEN ? r.upperEndpoint() - 1 : r.upperEndpoint()); }
From source file:edu.mit.streamjit.impl.compiler2.InternalArrayConcreteStorage.java
public static StorageFactory initFactory(final Map<ActorGroup, Integer> initSchedule) { return (Storage storage) -> { Range<Integer> indices = storage.writeIndexSpan(initSchedule).span(storage.initialDataIndexSpan()); assert indices.upperBoundType() == BoundType.OPEN; int capacity = indices.upperEndpoint(); Arrayish array1 = new Arrayish.ArrayArrayish(storage.type(), capacity); return new InternalArrayConcreteStorage(array1, storage); };/*from w ww.j a v a 2 s. com*/ }
From source file:org.nmdp.ngs.range.Ranges.java
/** * Return true if the specified range is strictly less than the specified value. * * @param <C> range endpoint type/* www .j a va 2 s .co m*/ * @param range range, must not be null * @param value value, must not be null * @return true if the specified range is strictly less than the specified value */ public static <C extends Comparable> boolean isLessThan(final Range<C> range, final C value) { checkNotNull(range); checkNotNull(value); if (!range.hasUpperBound()) { return false; } if (range.upperBoundType() == BoundType.OPEN && range.upperEndpoint().equals(value)) { return true; } return range.upperEndpoint().compareTo(value) < 0; }
From source file:org.apache.kylin.common.util.RangeUtil.java
public static <C extends Comparable<?>> boolean upperBoundInclusive(Range<C> range) { if (!range.hasUpperBound()) { throw new IllegalArgumentException(("This range does not have upper bound" + range)); }//w ww . j av a2 s.co m return range.upperBoundType() == BoundType.CLOSED; }
From source file:org.apache.druid.sql.calcite.filtration.MoveTimeFiltersToIntervals.java
private static Range<Long> toLongRange(final Range<BoundValue> range) { if (!range.hasUpperBound() && !range.hasLowerBound()) { return Range.all(); } else if (range.hasUpperBound() && !range.hasLowerBound()) { return Range.upTo(Long.parseLong(range.upperEndpoint().getValue()), range.upperBoundType()); } else if (!range.hasUpperBound() && range.hasLowerBound()) { return Range.downTo(Long.parseLong(range.lowerEndpoint().getValue()), range.lowerBoundType()); } else {/*from w ww. j ava 2 s . c o m*/ return Range.range(Long.parseLong(range.lowerEndpoint().getValue()), range.lowerBoundType(), Long.parseLong(range.upperEndpoint().getValue()), range.upperBoundType()); } }
From source file:google.registry.model.common.PersistedRangeLong.java
public static PersistedRangeLong create(Range<Long> range) { PersistedRangeLong instance = new PersistedRangeLong(); if (range.hasLowerBound()) { instance.lowerBound = range.lowerEndpoint(); instance.lowerBoundType = range.lowerBoundType(); }/*w w w .jav a2 s. co m*/ if (range.hasUpperBound()) { instance.upperBound = range.upperEndpoint(); instance.upperBoundType = range.upperBoundType(); } return instance; }
From source file:net.bican.iplib.IPAddresses.java
static Range<IPAddress> canonical(final Range<IPAddress> range, final LongDiscreteDomain<IPAddress> domain) { if (range.isEmpty()) { return null; }/*from w ww. j av a 2 s. c o m*/ final boolean l = range.lowerBoundType() == BoundType.OPEN; final boolean u = range.upperBoundType() == BoundType.OPEN; final IPAddress s = range.lowerEndpoint(); final IPAddress e = range.upperEndpoint(); if (l && u) { Range.closed(domain.next(s), domain.previous(e)); } else if (l) { return Range.closed(domain.next(s), e); } else if (u) { return Range.closed(s, domain.previous(e)); } return range; }
From source file:io.horizondb.model.core.util.SerializationUtils.java
/** * Serializes the specified range of <code>Field</code>s into the specified writer. * @param writer the writer to write to//from w ww. jav a 2 s . co m * @param range the range of fields to serialize * * @throws IOException if an I/O problem occurs */ public static void writeRange(ByteWriter writer, Range<Field> range) throws IOException { writeField(writer, range.lowerEndpoint()); writeBoundType(writer, range.lowerBoundType()); writeField(writer, range.upperEndpoint()); writeBoundType(writer, range.upperBoundType()); }