/** * Ensures that the given matrix size is valid for this {@code GeneralMatrix} implementation. */ private static void ensureValidSize(final int numRow, final int numCol) { ArgumentChecks.ensureBetween("numRow", 1, Short.MAX_VALUE, numRow); ArgumentChecks.ensureBetween("numCol", 1, Short.MAX_VALUE, numCol); }
/** * Sets the length of geohashes strings to be encoded by the {@link #encode(DirectPosition)} method. * * @param precision the new length of geohashes strings. */ public void setPrecision(final int precision) { ArgumentChecks.ensureBetween("precision", 1, 255, precision); this.precision = (byte) precision; buffer = null; // Will recreate a new buffer when first needed. }
/** * Returns the matrix element at the given index. */ @Override public final double getElement(final int row, final int column) { ArgumentChecks.ensureBetween("row", 0, numRow - 1, row); ArgumentChecks.ensureBetween("column", 0, numCol - 1, column); return elt[row * numCol + column]; }
/** * Sets the length of geohashes strings to be encoded by the {@link #encode(DirectPosition)} method. * * @param length the new length of geohashes strings. */ public void setHashLength(final int length) { ArgumentChecks.ensureBetween("length", 1, 255, length); this.length = (byte) length; buffer = null; // Will recreate a new buffer when first needed. }
/** * Ensures that the given matrix size is valid for this {@code GeneralMatrix} implementation. */ private static void ensureValidSize(final int numRow, final int numCol) { ArgumentChecks.ensureBetween("numRow", 1, Numerics.MAXIMUM_MATRIX_SIZE, numRow); ArgumentChecks.ensureBetween("numCol", 1, Numerics.MAXIMUM_MATRIX_SIZE, numCol); }
/** * Returns the matrix element at the given index. */ @Override public final double getElement(final int row, final int column) { ArgumentChecks.ensureBetween("row", 0, numRow - 1, row); ArgumentChecks.ensureBetween("column", 0, numCol - 1, column); return elt[row * numCol + column]; }
/** * Sets the bit offset to the given value. * * @param bitOffset the new bit offset of the stream. */ public final void setBitOffset(final int bitOffset) { ensureBetween("bitOffset", 0, Byte.SIZE - 1, bitOffset); final long position = bufferOffset + buffer.position(); bitPosition = (position << BIT_OFFSET_SIZE) | bitOffset; }
/** * Sets the position to the specified position in the text and returns that character. */ @Override public final char setIndex(final int position) { ArgumentChecks.ensureBetween("position", lower, upper, position); return ((index = position) != upper) ? text.charAt(position) : DONE; }
/** * Sets the bit offset to the given value. * * @param bitOffset the new bit offset of the stream. */ public final void setBitOffset(final int bitOffset) { ensureBetween("bitOffset", 0, Byte.SIZE - 1, bitOffset); final long position = bufferOffset + buffer.position(); bitPosition = (position << BIT_OFFSET_SIZE) | bitOffset; }
/** * Sets the position to the specified position in the text and returns that character. */ @Override public final char setIndex(final int position) { ArgumentChecks.ensureBetween("position", lower, upper, position); return ((index = position) != upper) ? text.charAt(position) : DONE; }
/** * Sets the tabulation width, in unit of Unicode characters (code point count). * * @param width the new tabulation width. Must be greater than 0. * @throws IllegalArgumentException if {@code tabWidth} is not greater than 0 * or is unreasonably high. */ public void setTabulationWidth(final int width) { ArgumentChecks.ensureStrictlyPositive("width", width); ArgumentChecks.ensureBetween("width", 1, Integer.MAX_VALUE, width); tabulationWidth = (short) width; }
/** * Sets the position of the vertical line, relative to the position of the root label. * The given value can not be greater than the {@linkplain #getIndentation() indentation}. * * @param verticalLinePosition the new vertical line position. * @throws IllegalArgumentException if the given value is negative or greater than the indentation. */ public void setVerticalLinePosition(final int verticalLinePosition) throws IllegalArgumentException { ArgumentChecks.ensureBetween("verticalLinePosition", 0, indentation, verticalLinePosition); this.verticalLinePosition = verticalLinePosition; clearTreeSymbols(); }
/** * Sets the tabulation width, in unit of Unicode characters (code point count). * * @param width the new tabulation width. Must be greater than 0. * @throws IllegalArgumentException if {@code tabWidth} is not greater than 0 * or is unreasonably high. */ public void setTabulationWidth(final int width) { ArgumentChecks.ensureStrictlyPositive("width", width); ArgumentChecks.ensureBetween("width", 1, Integer.MAX_VALUE, width); tabulationWidth = (short) width; }
/** * Sets the position of the vertical line, relative to the position of the root label. * The given value can not be greater than the {@linkplain #getIndentation() indentation}. * * @param verticalLinePosition the new vertical line position. * @throws IllegalArgumentException if the given value is negative or greater than the indentation. */ public void setVerticalLinePosition(final int verticalLinePosition) throws IllegalArgumentException { ArgumentChecks.ensureBetween("verticalLinePosition", 0, indentation, verticalLinePosition); this.verticalLinePosition = verticalLinePosition; clearTreeSymbols(); }
/** * Sets the position of the vertical line, relative to the position of the root label. * The given value can not be greater than the {@linkplain #getIndentation() indentation}. * * @param verticalLinePosition The new vertical line position. * @throws IllegalArgumentException If the given value is negative or greater than the indentation. */ public void setVerticalLinePosition(final int verticalLinePosition) throws IllegalArgumentException { ArgumentChecks.ensureBetween("verticalLinePosition", 0, indentation, verticalLinePosition); this.verticalLinePosition = verticalLinePosition; clearTreeSymbols(); }
/** * Sets a new indentation to be used for formatting objects. * The {@value #SINGLE_LINE} value means that the whole WKT is to be formatted on a single line. * * @param indentation the new indentation to use. * * @see org.apache.sis.setup.OptionKey#INDENTATION */ public void setIndentation(final int indentation) { ArgumentChecks.ensureBetween("indentation", SINGLE_LINE, Byte.MAX_VALUE, indentation); this.indentation = (byte) indentation; updateFormatter(formatter); }
/** * Sets a new indentation to be used for formatting objects. * The {@value #SINGLE_LINE} value means that the whole WKT is to be formatted on a single line. * * @param indentation the new indentation to use. * * @see org.apache.sis.setup.OptionKey#INDENTATION */ public void setIndentation(final int indentation) { ArgumentChecks.ensureBetween("indentation", SINGLE_LINE, Byte.MAX_VALUE, indentation); this.indentation = (byte) indentation; updateFormatter(formatter); }
/** * Sets the element at the given index as the {@code int} primitive type. * * @param index the element index. * @param value the value at the given index. * @throws IndexOutOfBoundsException if the given index is out of bounds. * @throws IllegalArgumentException if the given value is out of bounds. */ public void setInt(int index, int value) throws IndexOutOfBoundsException { ArgumentChecks.ensureValidIndex(size, index); ArgumentChecks.ensureBetween("value", 0, mask, value); modCount++; setUnchecked(index, value); }
/** * Truncates the data to the given size. */ @Override public SeekableByteChannel truncate(final long size) throws IOException { ensureOpen(); ArgumentChecks.ensureBetween("position", 0, limit, size); limit = (int) size; return this; }
/** * Sets this channel position. */ @Override public SeekableByteChannel position(final long newPosition) throws IOException { ensureOpen(); ArgumentChecks.ensureBetween("position", 0, data.length, newPosition); position = (int) newPosition; return this; }