/** * Sets the maximal line length, in units of Unicode characters (code point count). * * @param length the new maximal number of Unicode characters per line, * or {@link Integer#MAX_VALUE} if there is no limit. */ public void setMaximalLineLength(final int length) { ArgumentChecks.ensureStrictlyPositive("length", length); maximalLineLength = length; }
/** * Sets the logarithm or exponent base in the transfer function. * This value is ignored for {@link TransferFunctionType#LINEAR}. * For other supported types, the default value is 10. * * @param base the new logarithm or exponent base. */ public void setBase(final double base) { ArgumentChecks.ensureStrictlyPositive("base", base); this.base = base; transform = null; }
/** * Set class number. * * @param classNumber class number ask by caller. */ public void setClassNumber(int classNumber) { ArgumentChecks.ensureStrictlyPositive("classNumber", classNumber); this.classNumber = classNumber; this.index = null; }
/** * Sets the maximal line length, in units of Unicode characters (code point count). * * @param length the new maximal number of Unicode characters per line, * or {@link Integer#MAX_VALUE} if there is no limit. */ public void setMaximalLineLength(final int length) { ArgumentChecks.ensureStrictlyPositive("length", length); maximalLineLength = length; }
/** * Constructs a formatter which will wrap the lines at a given maximal length. * * @param out the underlying stream or buffer to write to. * @param maximalLineLength the maximal number of Unicode characters per line, * or {@link Integer#MAX_VALUE} if there is no limit. * @param isTabulationExpanded {@code true} for expanding tabulations into spaces, * or {@code false} for forwarding {@code '\t'} characters as-is. */ public LineAppender(final Appendable out, final int maximalLineLength, final boolean isTabulationExpanded) { super(out); ArgumentChecks.ensureStrictlyPositive("maximalLineLength", maximalLineLength); this.maximalLineLength = maximalLineLength; this.isTabulationExpanded = isTabulationExpanded; }
/** * Constructs a formatter which will wrap the lines at a given maximal length. * * @param out the underlying stream or buffer to write to. * @param maximalLineLength the maximal number of Unicode characters per line, * or {@link Integer#MAX_VALUE} if there is no limit. * @param isTabulationExpanded {@code true} for expanding tabulations into spaces, * or {@code false} for forwarding {@code '\t'} characters as-is. */ public LineAppender(final Appendable out, final int maximalLineLength, final boolean isTabulationExpanded) { super(out); ArgumentChecks.ensureStrictlyPositive("maximalLineLength", maximalLineLength); this.maximalLineLength = maximalLineLength; this.isTabulationExpanded = isTabulationExpanded; }
/** * Creates a new grid extent for an image or matrix of the given size. * The {@linkplain #getLow() low} grid coordinates are zeros and the axis types are * {@link DimensionNameType#COLUMN} and {@link DimensionNameType#ROW ROW} in that order. * * @param width number of pixels in each row. * @param height number of pixels in each column. */ public GridExtent(final long width, final long height) { ArgumentChecks.ensureStrictlyPositive("width", width); ArgumentChecks.ensureStrictlyPositive("height", height); coordinates = new long[4]; coordinates[2] = width - 1; coordinates[3] = height - 1; types = DEFAULT_TYPES; }
/** * Sets a timer for closing the Data Access Object after the specified amount of time of inactivity. * If a new Data Access Object is needed after the disposal of the last one, then the {@link #newDataAccess()} * method will be invoked again. * * @param delay the delay of inactivity before to close a Data Access Object. * @param unit the unit of measurement of the given delay. */ public void setTimeout(long delay, final TimeUnit unit) { ArgumentChecks.ensureStrictlyPositive("delay", delay); delay = unit.toNanos(delay); synchronized (availableDAOs) { timeout = delay; // Will be taken in account after the next factory to close. } }
/** * Sets a timer for closing the Data Access Object after the specified amount of time of inactivity. * If a new Data Access Object is needed after the disposal of the last one, then the {@link #newDataAccess()} * method will be invoked again. * * @param delay the delay of inactivity before to close a Data Access Object. * @param unit the unit of measurement of the given delay. */ public void setTimeout(long delay, final TimeUnit unit) { ArgumentChecks.ensureStrictlyPositive("delay", delay); delay = unit.toNanos(delay); synchronized (availableDAOs) { timeout = delay; // Will be taken in account after the next factory to close. } }
public ContiguousArrayPoint(double[] ordinates, int dimension) { ArgumentChecks.ensureStrictlyPositive("dimension", dimension); if (ordinates.length % dimension != 0) { throw new IllegalArgumentException(String.format( "Given array size (%d) is not a multiple the number of dimensions (%d) specified", ordinates.length, dimension )); } this.ordinates = ordinates; this.dimension = dimension; size = ordinates.length / dimension; }
/** * Creates a new list with the given initial size. * The value of all elements are initialized to 0. * * @param initialCapacity the initial capacity. * @param maximalValue the maximal value to be allowed, inclusive. * @param fill if {@code true}, the initial {@linkplain #size() size} is set to the initial capacity * with all values set to 0. */ public IntegerList(final int initialCapacity, final int maximalValue, final boolean fill) { ArgumentChecks.ensureStrictlyPositive("initialCapacity", initialCapacity); ArgumentChecks.ensureStrictlyPositive("maximalValue", maximalValue); bitCount = Math.max(1, Integer.SIZE - Integer.numberOfLeadingZeros(maximalValue)); mask = (1 << bitCount) - 1; values = new long[length(initialCapacity)]; if (fill) { size = initialCapacity; } }
/** * 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 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 a new limit for the number of elements to show in lists. * If this method is never invoked, then the default is unlimited. * * @param limit the new lists size limit, or {@link Integer#MAX_VALUE} if unlimited. * * @since 1.0 */ public void setMaximumListElements(final int limit) { ArgumentChecks.ensureStrictlyPositive("limit", limit); listSizeLimit = limit; updateFormatter(formatter); }
/** * Sets the logarithm or exponent base in the transfer function. * This value is ignored for {@link TransferFunctionType#LINEAR}. * For other supported types, the default value is 10. * * @param base the new logarithm or exponent base. * @throws IllegalArgumentException if the given base is NaN, negative, zero or infinite. */ public void setBase(final double base) { ArgumentChecks.ensureStrictlyPositive("base", base); ArgumentChecks.ensureFinite("base", base); this.base = base; transform = null; }
/** * Returns an identity transform of the specified dimension. * * <p>Special cases:</p> * <ul> * <li>If {@code dimension == 1}, then the returned transform implements {@link MathTransform1D}.</li> * <li>If {@code dimension == 2}, then the returned transform implements {@link MathTransform2D}.</li> * </ul> * * @param dimension the dimension of the transform to be returned. * @return an identity transform of the specified dimension. */ public static LinearTransform identity(final int dimension) { ArgumentChecks.ensureStrictlyPositive("dimension", dimension); return IdentityTransform.create(dimension); }
/** * Constructs a new logarithmic transform which add the given offset after the logarithm. * * @param base the base of the logarithm (typically 10). * @param offset the offset to add to the logarithm. * @return the math transform. */ public static MathTransform1D create(final double base, final double offset) { ArgumentChecks.ensureStrictlyPositive("base", base); if (base == 10) { return Base10.create(offset); } else { return NATURAL.concatenate(1 / Math.log(base), offset); } }
/** * Constructs a new logarithmic transform which add the given offset after the logarithm. * * @param base the base of the logarithm (typically 10). * @param offset the offset to add to the logarithm. * @return the math transform. */ public static MathTransform1D create(final double base, final double offset) { ArgumentChecks.ensureStrictlyPositive("base", base); if (base == 10) { return Base10.create(offset); } else { return NATURAL.concatenate(1 / Math.log(base), offset); } }
/** * Sets the semi-major axis value. * This method is invoked by JAXB at unmarshalling time only. * * @see #setSecondDefiningParameter(SecondDefiningParameter) * @see #afterUnmarshal(Unmarshaller, Object) */ private void setSemiMajorAxisMeasure(final Measure measure) { if (semiMajorAxis == 0) { final Unit<Length> uom = unit; // In case semi-minor were defined before semi-major. ensureStrictlyPositive("semiMajorAxis", semiMajorAxis = measure.value); unit = measure.getUnit(Length.class); harmonizeAxisUnits(uom); } else { MetadataUtilities.propertyAlreadySet(DefaultEllipsoid.class, "setSemiMajorAxisMeasure", "semiMajorAxis"); } }
/** * Sets the semi-major axis value. * This method is invoked by JAXB at unmarshalling time only. * * @see #setSecondDefiningParameter(SecondDefiningParameter) * @see #afterUnmarshal(Unmarshaller, Object) */ private void setSemiMajorAxisMeasure(final Measure measure) { if (semiMajorAxis == 0) { final Unit<Length> uom = unit; // In case semi-minor were defined before semi-major. ensureStrictlyPositive("semiMajorAxis", semiMajorAxis = measure.value); unit = measure.getUnit(Length.class); harmonizeAxisUnits(uom); } else { MetadataUtilities.propertyAlreadySet(DefaultEllipsoid.class, "setSemiMajorAxisMeasure", "semiMajorAxis"); } }