Java Code Examples for com.google.common.collect.RangeSet#addAll()

The following examples show how to use com.google.common.collect.RangeSet#addAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LineRanges.java    From git-code-format-maven-plugin with MIT License 5 votes vote down vote up
public static LineRanges concat(LineRanges lineRanges1, LineRanges lineRanges2) {
  if (lineRanges1.isAll()) {
    return lineRanges1;
  }
  if (lineRanges2.isAll()) {
    return lineRanges2;
  }

  RangeSet<Integer> newRangeSet = TreeRangeSet.create();
  newRangeSet.addAll(lineRanges1.rangeSet);
  newRangeSet.addAll(lineRanges2.rangeSet);

  return new LineRanges(newRangeSet);
}
 
Example 2
Source File: EncodedDiscreteResources.java    From onos with Apache License 2.0 5 votes vote down vote up
EncodedDiscreteResources add(EncodedDiscreteResources other) {
    checkArgument(this.codec.getClass() == other.codec.getClass());

    RangeSet<Integer> newRangeSet = TreeRangeSet.create(this.rangeSet);
    newRangeSet.addAll(other.rangeSet);

    return new EncodedDiscreteResources(newRangeSet, this.codec);
}
 
Example 3
Source File: CrontabEntry.java    From attic-aurora with Apache License 2.0 5 votes vote down vote up
private RangeSet<Integer> parseMinute() {
  RangeSet<Integer> minutes = TreeRangeSet.create();
  for (String component : getComponents(rawMinute)) {
    minutes.addAll(parseComponent(MINUTE, component));
  }
  return ImmutableRangeSet.copyOf(minutes);
}
 
Example 4
Source File: CrontabEntry.java    From attic-aurora with Apache License 2.0 5 votes vote down vote up
private RangeSet<Integer> parseHour() {
  RangeSet<Integer> hours = TreeRangeSet.create();
  for (String component : getComponents(rawHour)) {
    hours.addAll(parseComponent(HOUR, component));
  }
  return ImmutableRangeSet.copyOf(hours);
}
 
Example 5
Source File: CrontabEntry.java    From attic-aurora with Apache License 2.0 5 votes vote down vote up
private RangeSet<Integer> parseDayOfWeek() {
  RangeSet<Integer> daysOfWeek = TreeRangeSet.create();
  for (String component : getComponents(rawDayOfWeek)) {
    daysOfWeek.addAll(parseComponent(DAY_OF_WEEK, replaceNameAliases(component, DAY_NAMES)));
  }
  return ImmutableRangeSet.copyOf(daysOfWeek);
}
 
Example 6
Source File: CrontabEntry.java    From attic-aurora with Apache License 2.0 5 votes vote down vote up
private RangeSet<Integer> parseMonth() {
  RangeSet<Integer> months = TreeRangeSet.create();
  for (String component : getComponents(rawMonth)) {
    months.addAll(parseComponent(MONTH, replaceNameAliases(component, MONTH_NAMES)));
  }
  return ImmutableRangeSet.copyOf(months);
}
 
Example 7
Source File: CrontabEntry.java    From attic-aurora with Apache License 2.0 5 votes vote down vote up
private RangeSet<Integer> parseDayOfMonth() {
  RangeSet<Integer> daysOfMonth = TreeRangeSet.create();
  for (String component : getComponents(rawDayOfMonth)) {
    daysOfMonth.addAll(parseComponent(DAY_OF_MONTH, component));
  }
  return ImmutableRangeSet.copyOf(daysOfMonth);
}