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

Method create

output/java_guava/1.4.18/ContiguousSet.java:53–74  ·  view source on GitHub ↗

Returns a ContiguousSet containing the same values in the given domain plain Range#contains contained by the range. @throws IllegalArgumentException if neither range nor the domain has a lower bound, or if neither has an upper bound @since 13.0

(Range<C> range, DiscreteDomain<C> domain)

Source from the content-addressed store, hash-verified

51 */
52
53 public static <C extends Comparable> ContiguousSet<C> create(Range<C> range, DiscreteDomain<C> domain) {
54 checkNotNull(range);
55 checkNotNull(domain);
56 Range<C> effectiveRange = range;
57 try {
58 if (!range.hasLowerBound()) {
59 effectiveRange = effectiveRange.intersection(Range.atLeast(domain.minValue()));
60 }
61 if (!range.hasUpperBound()) {
62 effectiveRange = effectiveRange.intersection(Range.atMost(domain.maxValue()));
63 }
64 } catch (NoSuchElementException e) {
65 throw new IllegalArgumentException(e);
66 }
67
68 // Per class spec, we are allowed to throw CCE if necessary
69
70 boolean empty = effectiveRange.isEmpty() || Range.compareOrThrow(range.lowerBound.leastValueAbove(domain), range.upperBound.greatestValueBelow(domain)) > 0;
71 return empty
72 ? new EmptyContiguousSet<C>(domain)
73 : new RegularContiguousSet<C>(effectiveRange, domain);
74 }
75
76
77 final DiscreteDomain<C> domain;

Callers 5

intersectionMethod · 0.95
sizeMethod · 0.95
computeNextMethod · 0.95
indexOfMethod · 0.95

Calls 12

atLeastMethod · 0.95
atMostMethod · 0.95
compareOrThrowMethod · 0.95
isEmptyMethod · 0.65
checkNotNullMethod · 0.45
hasLowerBoundMethod · 0.45
intersectionMethod · 0.45
minValueMethod · 0.45
hasUpperBoundMethod · 0.45
maxValueMethod · 0.45
leastValueAboveMethod · 0.45
greatestValueBelowMethod · 0.45

Tested by

no test coverage detected