MCPcopy Create free account
hub / github.com/antlr/codebuff / asSet

Method asSet

output/java_guava/1.4.17/ImmutableRangeSet.java:405–423  ·  view source on GitHub ↗

Returns an ImmutableSortedSet containing the same values in the given domain plain RangeSet#contains contained by this range set. Note: a.asSet(d).equals(b.asSet(d)) does not imply a.equals(b)! For example, a and b could be [2..4] and

(DiscreteDomain<C> domain)

Source from the content-addressed store, hash-verified

403
404
405 public ImmutableSortedSet<C> asSet(DiscreteDomain<C> domain) {
406 checkNotNull(domain);
407 if (isEmpty()) {
408 return ImmutableSortedSet.of();
409 }
410 Range<C> span = span().canonical(domain);
411 if (!span.hasLowerBound()) {
412 // according to the spec of canonical, neither this ImmutableRangeSet nor
413 // the range have a lower bound
414 throw new IllegalArgumentException("Neither the DiscreteDomain nor this range set are bounded below");
415 } else if (!span.hasUpperBound()) {
416 try {
417 domain.maxValue();
418 } catch (NoSuchElementException e) {
419 throw new IllegalArgumentException("Neither the DiscreteDomain nor this range set are bounded above");
420 }
421 }
422 return new AsSet(domain);
423 }
424
425 private final class AsSet extends ImmutableSortedSet<C> {
426 private final DiscreteDomain<C> domain;

Callers 2

subSetMethod · 0.45
readResolveMethod · 0.45

Calls 8

isEmptyMethod · 0.95
ofMethod · 0.95
spanMethod · 0.95
checkNotNullMethod · 0.45
canonicalMethod · 0.45
hasLowerBoundMethod · 0.45
hasUpperBoundMethod · 0.45
maxValueMethod · 0.45

Tested by

no test coverage detected