List of usage examples for com.google.common.collect BoundType OPEN
BoundType OPEN
To view the source code for com.google.common.collect BoundType OPEN.
Click Source Link
From source file:li.klass.fhem.activities.graph.YAxis.java
public YAxis(Context context, GPlotAxis axis, String label) { this.context = context; this.label = label; Range<Double> range = axis.getRange().or(Range.range(-1d, BoundType.OPEN, 1d, BoundType.OPEN)); if (range.hasLowerBound()) { minimumY = range.lowerEndpoint(); }//w ww. j a v a 2s . co m if (range.hasUpperBound()) { maximumY = range.upperEndpoint(); } }
From source file:com.basistech.tclre.RuntimeColorMap.java
private void computeBmp(RangeMap<Integer, Short> fullMap) { for (Map.Entry<Range<Integer>, Short> me : fullMap.asMapOfRanges().entrySet()) { Range<Integer> range = me.getKey(); int min = range.lowerEndpoint(); if (range.lowerBoundType() == BoundType.OPEN) { min++;//from w w w . j a v a2 s .com } if (min < Character.MAX_VALUE) { int rmax = range.upperEndpoint(); if (range.upperBoundType() == BoundType.OPEN) { rmax--; } int max = Math.min(Character.MAX_VALUE, rmax); for (int x = min; x <= max; x++) { this.bmpMap[x] = me.getValue(); } } } }
From source file:net.bican.iplib.AddressIterable.java
/** * @return size of the address range//from www. ja v a 2 s .co m */ public BigInteger size() { BigInteger result = this.domain.distance(this.range.lowerEndpoint(), this.range.upperEndpoint()); result = result.add(BigInteger.ONE); if (this.range.upperBoundType() == BoundType.OPEN) { result = result.subtract(BigInteger.ONE); } if (this.range.lowerBoundType() == BoundType.OPEN) { result = result.subtract(BigInteger.ONE); } return result; }
From source file:org.apache.pulsar.common.naming.NamespaceBundle.java
public NamespaceBundle(NamespaceName nsname, Range<Long> keyRange, NamespaceBundleFactory factory) { this.nsname = checkNotNull(nsname); this.keyRange = checkNotNull(keyRange); checkArgument(this.keyRange.lowerBoundType().equals(BoundType.CLOSED), "Invalid hash range. Lower Endpoint has to be inclusive"); checkArgument(/*from www . j a va2 s.c o m*/ (this.keyRange.upperEndpoint().equals(NamespaceBundles.FULL_UPPER_BOUND) && this.keyRange.upperBoundType().equals(BoundType.CLOSED)) || (!this.keyRange.upperEndpoint().equals(NamespaceBundles.FULL_UPPER_BOUND) && this.keyRange.upperBoundType().equals(BoundType.OPEN)), "Invalid hash range. Upper Endpoint should be exclusive unless it is 0xffffffff"); checkArgument(!this.keyRange.isEmpty(), "Cannot create bundle object for an empty key range"); this.factory = checkNotNull(factory); }
From source file:com.sk89q.guavabackport.collect.Range.java
public static <C extends Comparable<?>> Range<C> range(final C lower, final BoundType lowerType, final C upper, final BoundType upperType) { Preconditions.checkNotNull((Object) lowerType); Preconditions.checkNotNull((Object) upperType); final Cut<C> lowerBound = (lowerType == BoundType.OPEN) ? Cut.aboveValue(lower) : Cut.belowValue(lower); final Cut<C> upperBound = (upperType == BoundType.OPEN) ? Cut.belowValue(upper) : Cut.aboveValue(upper); return create(lowerBound, upperBound); }
From source file:com.techshroom.wood.ModuleDependency.java
public static ModuleDependency fromString(String dependency) { // Dependency format: '<id>:<version>' // List format: '<dep>;<dep>;<dep>' // Version range format: // Any version: [0.0.0,) or * or omitted // Any version above 1.0.0: [1.0.0,) // Any version with major 1: [1.0.0,2.0.0) // Any version with major.minor 1.0: [1.0.0,1.1.0) // 1.0.0-1.2.0: [1.0.0,1.2.0] // etc. Basically works like Range. String id;// w w w .j a v a 2s . c o m Range<SemVer> range; String[] idSplit = dependency.split(":", 2); id = idSplit[0]; if (idSplit.length == 2 && !idSplit[1].equals("*")) { String r = idSplit[1]; Matcher matcher = VERSION_RANGE_PATTERN.matcher(r); checkArgument(matcher.matches(), "'%s' is not a valid range", r); BoundType lowBound = matcher.group(1).equals("(") ? BoundType.OPEN : BoundType.CLOSED; BoundType hiBound = matcher.group(4).equals(")") ? BoundType.OPEN : BoundType.CLOSED; String lowVersion = matcher.group(2); String hiVersion = matcher.group(3); checkArgument(lowVersion != null || hiVersion != null, "A bound must have at least one version. Use \"[0.0.0,)\" or '*' for any."); if (lowVersion == null) { checkArgument(lowBound == BoundType.OPEN, "must use '(' with no lower bound"); range = Range.upTo(SemVer.fromString(hiVersion), hiBound); } else if (hiVersion == null) { checkArgument(hiBound == BoundType.OPEN, "must use ')' with no upper bound"); range = Range.downTo(SemVer.fromString(lowVersion), lowBound); } else { range = Range.range(SemVer.fromString(lowVersion), lowBound, SemVer.fromString(hiVersion), hiBound); } } else { range = Range.downTo(ZERO, BoundType.CLOSED); } return fromFields(id, range); }
From source file:io.horizondb.model.core.filters.RangeFilter.java
/** * {@inheritDoc}//from w w w .j a va 2 s .co m */ @Override public boolean accept(T value) throws IOException { if (!this.range.contains(value)) { if (this.valuesNeverDecrease && ((this.range.upperBoundType() == BoundType.CLOSED && this.range.upperEndpoint().compareTo(value) < 0) || (this.range.upperBoundType() == BoundType.OPEN && this.range.upperEndpoint().compareTo(value) <= 0))) { this.isDone = true; } return false; } return true; }
From source file:com.yahoo.pulsar.broker.namespace.ServiceUnitZkUtils.java
private static Range<Long> getHashRange(String rangePathPart) { String[] endPoints = rangePathPart.split("_"); checkArgument(endPoints.length == 2, "Malformed bundle hash range path part:" + rangePathPart); Long startLong = Long.decode(endPoints[0]); Long endLong = Long.decode(endPoints[1]); BoundType endType = (endPoints[1].equals(LAST_BOUNDARY)) ? BoundType.CLOSED : BoundType.OPEN; return Range.range(startLong, BoundType.CLOSED, endLong, endType); }
From source file:org.apache.druid.sql.calcite.filtration.Bounds.java
public static BoundDimFilter toFilter(final BoundRefKey boundRefKey, final Range<BoundValue> range) { return new BoundDimFilter(boundRefKey.getDimension(), range.hasLowerBound() ? range.lowerEndpoint().getValue() : null, range.hasUpperBound() ? range.upperEndpoint().getValue() : null, range.hasLowerBound() && range.lowerBoundType() == BoundType.OPEN, range.hasUpperBound() && range.upperBoundType() == BoundType.OPEN, null, boundRefKey.getExtractionFn(), boundRefKey.getComparator()); }
From source file:com.wealdtech.collect.TreeRangedMap.java
/** * Validate a range prior to insertion/*w w w .ja v a 2 s. c om*/ * @param range the range to validate */ private void validateRange(final Range<K> range) { if (!range.hasLowerBound()) { throw new IllegalArgumentException("RangedMap only supports ranges with defined lower bound"); } if (!range.lowerBoundType().equals(BoundType.CLOSED)) { throw new IllegalArgumentException("RangedMap must use ranges with closed lower bound"); } if (!range.hasUpperBound()) { throw new IllegalArgumentException("RangedMap must use ranges with defined upper bound"); } if (!range.upperBoundType().equals(BoundType.OPEN)) { throw new IllegalArgumentException("RangedMap must use ranges with open upper bound"); } if (range.isEmpty()) { throw new IllegalArgumentException("RangedMap must use ranges with non-zero size"); } }