List of usage examples for com.google.common.collect ImmutableRangeSet copyOf
public static <C extends Comparable> ImmutableRangeSet<C> copyOf(RangeSet<C> rangeSet)
From source file:org.opendaylight.controller.cluster.access.commands.DeadTransactionException.java
public DeadTransactionException(final RangeSet<UnsignedLong> purgedIdentifiers) { super("Transactions " + purgedIdentifiers + " have been purged"); this.purgedIdentifiers = ImmutableRangeSet.copyOf(purgedIdentifiers); }
From source file:com.google.googlejavaformat.java.FileToFormat.java
public FileToFormat(RangeSet<Integer> lineRanges, List<Integer> offsets, List<Integer> lengths) { this.lineRanges = ImmutableRangeSet.copyOf(lineRanges); this.offsets = ImmutableList.copyOf(offsets); this.lengths = ImmutableList.copyOf(lengths); }
From source file:org.opendaylight.yangtools.yang.data.impl.codec.StringStringCodec.java
StringStringCodec(final StringTypeDefinition typeDef) { super(Optional.of(typeDef), String.class); final Collection<LengthConstraint> constraints = typeDef.getLengthConstraints(); if (!constraints.isEmpty()) { final RangeSet<Integer> tmp = TreeRangeSet.create(); for (LengthConstraint c : constraints) { tmp.add(Range.closed(c.getMin().intValue(), c.getMax().intValue())); }/* www.j a v a2s .co m*/ lengths = ImmutableRangeSet.copyOf(tmp); } else { lengths = null; } }
From source file:us.eharning.atomun.mnemonic.spi.electrum.v2.CJKCleanupUtility.java
private static RangeSet<Integer> buildRanges() { LineProcessor<RangeSet<Integer>> lineProcess = new LineProcessor<RangeSet<Integer>>() { private final RangeSet<Integer> resultBuilder = TreeRangeSet.create(); @Override/* w w w. j a va 2 s.co m*/ public boolean processLine(@Nonnull String line) throws IOException { /* Skip comments and empty lines */ int commentIndex = line.indexOf('#'); if (commentIndex >= 0) { line = line.substring(0, commentIndex); } line = CharMatcher.WHITESPACE.trimFrom(line); if (line.isEmpty()) { return true; } /* NOTE: Assuming 0xHEX-0xHEX notation */ int splitMarker = line.indexOf('-'); assert splitMarker >= 0; int start = Integer.parseInt(line.substring(2, splitMarker), 16); int stop = Integer.parseInt(line.substring(splitMarker + 3), 16); resultBuilder.add(Range.closed(start, stop)); return true; } @Override public RangeSet<Integer> getResult() { return ImmutableRangeSet.copyOf(resultBuilder); } }; try { return Resources.readLines(MnemonicUtility.class.getResource("cjk_ranges.dat"), Charsets.UTF_8, lineProcess); } catch (IOException e) { throw new Error(e); } }
From source file:org.opendaylight.controller.cluster.datastore.utils.UnsignedLongRangeSet.java
public RangeSet<UnsignedLong> toImmutable() { return ImmutableRangeSet.copyOf(rangeset); }
From source file:org.opendaylight.controller.cluster.datastore.persisted.FrontendClientMetadata.java
public FrontendClientMetadata(final ClientIdentifier identifier, final RangeSet<UnsignedLong> purgedHistories, final Collection<FrontendHistoryMetadata> currentHistories) { this.identifier = Preconditions.checkNotNull(identifier); this.purgedHistories = ImmutableRangeSet.copyOf(purgedHistories); this.currentHistories = ImmutableList.copyOf(currentHistories); }
From source file:org.apache.aurora.scheduler.cron.CrontabEntry.java
private CrontabEntry(RangeSet<Integer> minute, RangeSet<Integer> hour, RangeSet<Integer> dayOfMonth, RangeSet<Integer> month, RangeSet<Integer> dayOfWeek) { checkEnclosed("minute", MINUTE, minute); checkEnclosed("hour", HOUR, hour); checkEnclosed("dayOfMonth", DAY_OF_MONTH, dayOfMonth); checkEnclosed("month", MONTH, month); checkEnclosed("dayOfWeek", DAY_OF_WEEK, dayOfWeek); this.minute = ImmutableRangeSet.copyOf(minute); this.hour = ImmutableRangeSet.copyOf(hour); this.dayOfMonth = ImmutableRangeSet.copyOf(dayOfMonth); this.month = ImmutableRangeSet.copyOf(month); this.dayOfWeek = ImmutableRangeSet.copyOf(dayOfWeek); checkArgument(hasWildcardDayOfMonth() || hasWildcardDayOfWeek(), "Specifying both dayOfWeek and dayOfMonth is not supported."); }