@Override public CharSequence subSequence(final int start, final int end) { ArgumentChecks.ensureValidIndexRange(length, start, end); final int n = end - start; return (n == length) ? this : spaces(n); }
/** * Returns a string representation for debugging purpose only. */ @Debug @Override public String toString() { String name = Classes.getShortName(type); if (propertyType != Object.class) { name = name + " as " + Classes.getShortName(propertyType); } return name; }
/** * Returns a string representation of the object pair for debugging purpose only. */ @Debug @Override public String toString() { return '(' + Classes.getShortClassName(o1) + ", " + Classes.getShortClassName(o2) + ')'; } }
/** * Creates a new instance for the given type of values. * * @param type base type of all values in the column identified by this instance. * @param header the text to display as column header. */ public TableColumn(final Class<V> type, final CharSequence header) { ArgumentChecks.ensureNonNull("type", this.type = type); ArgumentChecks.ensureNonNull("header", this.header = header); }
/** * Returns {@code true} if the given character sequence starts with the given prefix. * * @param text the characters sequence to test. * @param prefix the expected prefix. * @param ignoreCase {@code true} if the case should be ignored. * @return {@code true} if the given sequence starts with the given prefix. * @throws NullPointerException if any of the arguments is null. */ public static boolean startsWith(final CharSequence text, final CharSequence prefix, final boolean ignoreCase) { return regionMatches(text, 0, prefix, ignoreCase); }
/** * Returns the number of elements (e.g. {@code "elt_0_0"}) when formatting the parameter descriptors * for a tensor of the given size. This is the total number of elements in the tensor. */ private int numElements(final int[] actualSize) { int n = 1; for (int s : actualSize) { ArgumentChecks.ensurePositive("actualSize", s); n *= s; } return n; }
/** * Returns {@code true} if the given name or identifier is deprecated. * * @see #isDeprecated() */ private static boolean isDeprecated(final Object object) { return (object instanceof Deprecable) && ((Deprecable) object).isDeprecated(); }
/** * Parses the given string. Callers shall catch the {@link NumberFormatException} * and handle the error according the caller's method contract. * * @throws NumberFormatException if the parsing failed. */ private Object valueOf(final String source) throws NumberFormatException { return (type != Number.class) ? Numbers.valueOf(source, type) : Numbers.narrowestNumber(source); }
/** * Sets the coordinate reference system in which the coordinate is given. * * @param crs the new coordinate reference system, or {@code null}. */ public void setCoordinateReferenceSystem(final CoordinateReferenceSystem crs) { ensureDimensionMatches("crs", 1, crs); this.crs = crs; }
/** * Must be overridden, since the super-class method does not handle the index range * for performance reasons. */ @Override public double getUpper(final int dimension) throws IndexOutOfBoundsException { ensureValidIndex(endIndex, dimension); return ordinates[dimension + beginIndex + (ordinates.length >>> 1)]; }
/** * Creates a new derived set from the specified storage set. * * @param storage the set which actually store the elements. * @param converter the type of elements in this derived set. */ Invertible(final Set<S> storage, final ObjectConverter<S,E> converter) { super(storage, converter); inverse = converter.inverse(); }
/** * Returns the values as an array. */ public int[] toArray() { return CharSequences.parseInts(value, ' ', 10); } }
/** * Returns {@code true} if this comparison ignores metadata. * This method currently returns {@code true} for {@code IGNORE_METADATA}, {@code APPROXIMATIVE} * or {@code DEBUG} only, but this list may be extended in future SIS versions. * * @return whether this comparison ignore metadata. * * @since 0.6 */ public boolean isIgnoringMetadata() { return ordinal() >= IGNORE_METADATA.ordinal(); }
/** * Constructs a set of the specified type. * * @param type the element type (can not be null). */ public CheckedHashSet(final Class<E> type) { super(); this.type = type; ensureNonNull("type", type); }
@Override public CharSequence subSequence(final int start, final int end) { ArgumentChecks.ensureValidIndexRange(length, start, end); final int n = end - start; return (n == length) ? this : spaces(n); }
/** * Creates a new representative fraction from the specified denominator. * * @param denominator the denominator as a positive number, or 0 if unspecified. * @throws IllegalArgumentException if the given value is negative. */ public DefaultRepresentativeFraction(final long denominator) { ArgumentChecks.ensurePositive("denominator", denominator); this.denominator = denominator; }
/** * Returns {@code true} if this comparison uses a tolerance threshold. * This method currently returns {@code true} for {@code APPROXIMATIVE} or {@code DEBUG} only, * but this list may be extended in future SIS versions. * * @return whether this comparison uses a tolerance threshold. * * @since 0.6 */ public boolean isApproximative() { return ordinal() >= APPROXIMATIVE.ordinal(); }
/** * Constructs a set of the specified type and initial capacity. * * @param type the element type (should not be null). * @param capacity the initial capacity. */ public CheckedHashSet(final Class<E> type, final int capacity) { super(capacity); this.type = type; ensureNonNull("type", type); }
/** * Creates a dimension initialized to the given type and size. * * @param dimensionName the name of the axis, or {@code null} if none, or {@code null} if none. * @param dimensionSize the number of elements along the axis, or {@code null} if none. * @throws IllegalArgumentException if {@code dimensionSize} is negative. */ public DefaultDimension(final DimensionNameType dimensionName, final int dimensionSize) { ArgumentChecks.ensurePositive("dimensionSize", dimensionSize); this.dimensionName = dimensionName; this.dimensionSize = dimensionSize; }
/** * Sets the domain of the search (for example whether to include deprecated objects in the search). * If this method is never invoked, then the default value is {@link Domain#VALID_DATASET}. * * @param domain the domain of the search. */ public void setSearchDomain(final Domain domain) { ArgumentChecks.ensureNonNull("domain", domain); this.domain = domain; }