@Test public void testToString(){ assertEquals("[-1, 1]", UNIT .toString()); assertEquals("[0, 0]", ZERO .toString()); assertEquals("[A, B)", A .toString()); assertEquals("(-\u221E, \u221E)", INTEGERS.toString()); assertEquals("(0, \u221E)", POSITIVE.toString()); assertEquals("(-\u221E, 0)", NEGATIVE.toString()); }
@Override public String toString() { if (isEmpty()) { return "[]"; } final StringBuilder buffer = new StringBuilder(); buffer.append(isMinIncluded ? '[' : '('); if (minValue == null) { buffer.append("-\u221E"); } else { buffer.append(minValue); } buffer.append(", "); if (maxValue == null) { buffer.append('\u221E'); } else { buffer.append(maxValue); } buffer.append(isMaxIncluded ? ']' : ')'); final Unit<?> units = getUnits(); if (units != null) { buffer.append(' ').append(units); } return buffer.toString(); }
Range implements Serializable { @Override public String toString() { if (isEmpty()) { return "[]"; } final StringBuilder buffer = new StringBuilder(); buffer.append(isMinIncluded ? '[' : '('); if (minValue == null) { buffer.append("-\u221E"); } else { buffer.append(minValue); } buffer.append(", "); if (maxValue == null) { buffer.append('\u221E'); } else { buffer.append(maxValue); } buffer.append(isMaxIncluded ? ']' : ')'); final Unit<?> units = getUnits(); if (units != null) { buffer.append(' ').append(units); } return buffer.toString(); } }
Range implements Serializable { @Override public String toString() { if (isEmpty()) { return "[]"; } final StringBuilder buffer = new StringBuilder(); buffer.append(isMinIncluded ? '[' : '('); if (minValue == null) { buffer.append("-\u221E"); } else { buffer.append(minValue); } buffer.append(", "); if (maxValue == null) { buffer.append('\u221E'); } else { buffer.append(maxValue); } buffer.append(isMaxIncluded ? ']' : ')'); final Unit<?> units = getUnits(); if (units != null) { buffer.append(' ').append(units); } return buffer.toString(); } Range(final Class<T> elementClass, final T value);  Range(final Class<T> elementClass, final T minValue, final T maxValue);  Range(final Class<T> elementClass,
                 final T minValue, final boolean isMinIncluded,
                 final T maxValue, final boolean isMaxIncluded); }
Range implements Serializable { @Override public String toString() { if (isEmpty()) { return "[]"; } final StringBuilder buffer = new StringBuilder(); buffer.append(isMinIncluded ? '[' : '('); if (minValue == null) { buffer.append("-\u221E"); } else { buffer.append(minValue); } buffer.append(", "); if (maxValue == null) { buffer.append('\u221E'); } else { buffer.append(maxValue); } buffer.append(isMaxIncluded ? ']' : ')'); final Unit<?> units = getUnits(); if (units != null) { buffer.append(' ').append(units); } return buffer.toString(); } Range(final Class<T> elementClass, final T value);  Range(final Class<T> elementClass, final T minValue, final T maxValue);  Range(final Class<T> elementClass,
                 final T minValue, final boolean isMinIncluded,
                 final T maxValue, final boolean isMaxIncluded); Class<T> getElementClass(); T getMinValue(); boolean isMinIncluded(); T getMaxValue(); boolean isMaxIncluded(); boolean isEmpty(); boolean contains(final Comparable<?> value); boolean contains(final Range<?> range); boolean intersects(final Range<?> range); Range<?> intersect(final Range<?> range); Range<?>[] subtract(final Range<?> range); Range<?> union(final Range<?> range); @Override boolean equals(final Object object); @Override int hashCode(); @Override String toString(); }
Range implements Serializable { @Override public String toString() { if (isEmpty()) { return "[]"; } final StringBuilder buffer = new StringBuilder(); buffer.append(isMinIncluded ? '[' : '('); if (minValue == null) { buffer.append("-\u221E"); } else { buffer.append(minValue); } buffer.append(", "); if (maxValue == null) { buffer.append('\u221E'); } else { buffer.append(maxValue); } buffer.append(isMaxIncluded ? ']' : ')'); final Unit<?> units = getUnits(); if (units != null) { buffer.append(' ').append(units); } return buffer.toString(); } Range(final Class<T> elementClass, final T value);  Range(final Class<T> elementClass, final T minValue, final T maxValue);  Range(final Class<T> elementClass,
                 final T minValue, final boolean isMinIncluded,
                 final T maxValue, final boolean isMaxIncluded); Class<T> getElementClass(); T getMinValue(); boolean isMinIncluded(); T getMaxValue(); boolean isMaxIncluded(); boolean isEmpty(); boolean contains(final Comparable<?> value); boolean contains(final Range<?> range); boolean intersects(final Range<?> range); Range<?> intersect(final Range<?> range); Range<?>[] subtract(final Range<?> range); Range<?> union(final Range<?> range); @Override boolean equals(final Object object); @Override int hashCode(); @Override String toString();  }