@Test public void testContains() { SubRange empty = new SubRange(2, 1); SubRange base = new SubRange(0, 10); SubRange singleton = SubRange.singleton(5); assertThat(base.contains(empty), equalTo(true)); assertThat(empty.contains(empty), equalTo(true)); assertThat(empty.contains(base), equalTo(false)); assertThat(singleton.contains(singleton), equalTo(true)); assertThat(singleton.contains(empty), equalTo(true)); assertThat(base.contains(new SubRange(2, 8)), equalTo(true)); assertThat(base.contains(new SubRange(2, 10)), equalTo(true)); assertThat(base.contains(new SubRange(-1, 5)), equalTo(false)); assertThat(base.contains(new SubRange(-1, 11)), equalTo(false)); assertThat(new SubRange(-1, 11).contains(base), equalTo(true)); }
public boolean contains(@Nonnull SubRange other) { return other.isEmpty() || (_start <= other.getStart() && _end >= other.getEnd()); }
SubRange implements Serializable, Comparable<SubRange> { public boolean contains(@Nonnull SubRange other) { return other.isEmpty() || (_start <= other.getStart() && _end >= other.getEnd()); } }
SubRange implements Serializable, Comparable<SubRange> { public boolean contains(@Nonnull SubRange other) { return other.isEmpty() || (_start <= other.getStart() && _end >= other.getEnd()); } SubRange(int start, int end); @JsonCreator  SubRange(@Nullable Object o); }
SubRange implements Serializable, Comparable<SubRange> { public boolean contains(@Nonnull SubRange other) { return other.isEmpty() || (_start <= other.getStart() && _end >= other.getEnd()); } SubRange(int start, int end); @JsonCreator  SubRange(@Nullable Object o); static SubRange singleton(int value); IntStream asStream(); @Override int compareTo(@Nonnull SubRange rhs); boolean contains(@Nonnull SubRange other); @Override boolean equals(Object o); int getEnd(); int getStart(); @Override int hashCode(); boolean includes(@Nullable Integer integer); boolean includes(int integer); Optional<SubRange> intersection(SubRange other); boolean isEmpty(); boolean isSingleValue(); @JsonValue String serializedForm(); @Override String toString(); }
SubRange implements Serializable, Comparable<SubRange> { public boolean contains(@Nonnull SubRange other) { return other.isEmpty() || (_start <= other.getStart() && _end >= other.getEnd()); } SubRange(int start, int end); @JsonCreator  SubRange(@Nullable Object o); static SubRange singleton(int value); IntStream asStream(); @Override int compareTo(@Nonnull SubRange rhs); boolean contains(@Nonnull SubRange other); @Override boolean equals(Object o); int getEnd(); int getStart(); @Override int hashCode(); boolean includes(@Nullable Integer integer); boolean includes(int integer); Optional<SubRange> intersection(SubRange other); boolean isEmpty(); boolean isSingleValue(); @JsonValue String serializedForm(); @Override String toString();  }