@Test public void testDifference() { IntegerSpace s1 = IntegerSpace.builder().including(Range.closed(1, 10)).build(); IntegerSpace s2 = IntegerSpace.builder().including(Range.closed(5, 15)).build(); IntegerSpace expected = IntegerSpace.builder().including(Range.closed(1, 4)).build(); IntegerSpace expectedFlipped = IntegerSpace.builder().including(Range.closed(11, 15)).build(); assertThat(s1.difference(s2), equalTo(expected)); assertThat(s2.difference(s1), equalTo(expectedFlipped)); IntegerSpace unconnected = IntegerSpace.builder().including(Range.closed(100, 200)).build(); assertThat(s1.difference(unconnected), equalTo(s1)); assertThat(unconnected.difference(s1), equalTo(unconnected)); assertThat(s1.difference(s1), equalTo(EMPTY)); }
public static @Nonnull Builder builder() { return new Builder(); }
IntegerSpace extends NumberSpace<Integer, IntegerSpace, IntegerSpace.Builder> { public static @Nonnull Builder builder() { return new Builder(); } }
IntegerSpace extends NumberSpace<Integer, IntegerSpace, IntegerSpace.Builder> { public static @Nonnull Builder builder() { return new Builder(); } protected  IntegerSpace(RangeSet<Integer> rangeset); }
IntegerSpace extends NumberSpace<Integer, IntegerSpace, IntegerSpace.Builder> { public static @Nonnull Builder builder() { return new Builder(); } protected  IntegerSpace(RangeSet<Integer> rangeset); static @Nonnull IntegerSpace parse(String s); @Nonnull Set<SubRange> getSubRanges(); @Override @Nonnull SortedSet<Integer> enumerate(); @Nonnull IntStream intStream(); static @Nonnull IntegerSpace of(SubRange range); static @Nonnull IntegerSpace unionOf(IntegerSpace... spaces); static @Nonnull IntegerSpace unionOf(SubRange... subRanges); @SafeVarargs @SuppressWarnings("varargs") static @Nonnull IntegerSpace unionOf(Range<Integer>... ranges); static IntegerSpace unionOf(Iterable<Range<Integer>> ranges); static IntegerSpace unionOfSubRanges(Iterable<SubRange> subRanges); static IntegerSpace of(Range<Integer> range); static IntegerSpace of(RangeSet<Integer> rangeSet); static IntegerSpace of(int value); static @Nonnull Builder builder(); }
IntegerSpace extends NumberSpace<Integer, IntegerSpace, IntegerSpace.Builder> { public static @Nonnull Builder builder() { return new Builder(); } protected  IntegerSpace(RangeSet<Integer> rangeset); static @Nonnull IntegerSpace parse(String s); @Nonnull Set<SubRange> getSubRanges(); @Override @Nonnull SortedSet<Integer> enumerate(); @Nonnull IntStream intStream(); static @Nonnull IntegerSpace of(SubRange range); static @Nonnull IntegerSpace unionOf(IntegerSpace... spaces); static @Nonnull IntegerSpace unionOf(SubRange... subRanges); @SafeVarargs @SuppressWarnings("varargs") static @Nonnull IntegerSpace unionOf(Range<Integer>... ranges); static IntegerSpace unionOf(Iterable<Range<Integer>> ranges); static IntegerSpace unionOfSubRanges(Iterable<SubRange> subRanges); static IntegerSpace of(Range<Integer> range); static IntegerSpace of(RangeSet<Integer> rangeSet); static IntegerSpace of(int value); static @Nonnull Builder builder(); static final IntegerSpace EMPTY; static final IntegerSpace PORTS; }