Java Code Examples for org.apache.commons.lang3.Validate#exclusiveBetween()

The following examples show how to use org.apache.commons.lang3.Validate#exclusiveBetween() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileUploadManager.java    From alf.io with GNU General Public License v3.0 5 votes vote down vote up
public String insertFile(UploadBase64FileModification file) {
    Validate.exclusiveBetween(1, MAXIMUM_ALLOWED_SIZE, file.getFile().length);
    String digest = DigestUtils.sha256Hex(file.getFile());
    if (Integer.valueOf(1).equals(repository.isPresent(digest))) {
        return digest;
    }
    repository.upload(file, digest, getAttributes(file));
    return digest;
}
 
Example 2
Source File: MonteCarloIntegrator.java    From finmath-lib with Apache License 2.0 3 votes vote down vote up
/**
 * Create an integrator using Monte-Carlo integration.
 *
 * @param lowerBound Lower bound of the integral.
 * @param upperBound Upper bound of the integral.
 * @param numberOfEvaluationPoints Maximum number of evaluation points to be used, must be greater or equal to 3.
 * @param seed The seed of the random number generator.
 * @param useParallelEvaluation If true, the integration rule will perform parallel evaluation of the integrand.
 */
public MonteCarloIntegrator(final double lowerBound, final double upperBound, final int numberOfEvaluationPoints, final int seed, final boolean useParallelEvaluation) {
	super(lowerBound, upperBound);
	Validate.exclusiveBetween(0, Integer.MAX_VALUE, numberOfEvaluationPoints, "Parameter numberOfEvaluationPoints required to be > 0.");
	this.numberOfEvaluationPoints = numberOfEvaluationPoints;
	this.seed = seed;
}
 
Example 3
Source File: SimpsonRealIntegrator.java    From finmath-lib with Apache License 2.0 3 votes vote down vote up
/**
 * Create an integrator using Simpson's rule.
 *
 * @param lowerBound Lower bound of the integral.
 * @param upperBound Upper bound of the integral.
 * @param numberOfEvaluationPoints Maximum number of evaluation points to be used, must be greater or equal to 3, should be odd.
 * @param useParallelEvaluation If true, the integration rule will perform parallel evaluation of the integrand.
 */
public SimpsonRealIntegrator(final double lowerBound, final double upperBound, final int numberOfEvaluationPoints, final boolean useParallelEvaluation) {
	super(lowerBound, upperBound);
	Validate.exclusiveBetween(2, Integer.MAX_VALUE, numberOfEvaluationPoints, "Parameter numberOfEvaluationPoints required to be > 2.");
	this.numberOfEvaluationPoints = numberOfEvaluationPoints;
	this.useParallelEvaluation = useParallelEvaluation;
}
 
Example 4
Source File: MonteCarloIntegrator.java    From finmath-lib with Apache License 2.0 3 votes vote down vote up
/**
 * Create an integrator using Monte-Carlo integration.
 *
 * @param lowerBound Lower bound of the integral.
 * @param upperBound Upper bound of the integral.
 * @param numberOfEvaluationPoints Maximum number of evaluation points to be used, must be greater or equal to 3.
 * @param seed The seed of the random number generator.
 * @param useParallelEvaluation If true, the integration rule will perform parallel evaluation of the integrand.
 */
public MonteCarloIntegrator(final double lowerBound, final double upperBound, final int numberOfEvaluationPoints, final int seed, final boolean useParallelEvaluation) {
	super(lowerBound, upperBound);
	Validate.exclusiveBetween(0, Integer.MAX_VALUE, numberOfEvaluationPoints, "Parameter numberOfEvaluationPoints required to be > 0.");
	this.numberOfEvaluationPoints = numberOfEvaluationPoints;
	this.seed = seed;
}
 
Example 5
Source File: SimpsonRealIntegrator.java    From finmath-lib with Apache License 2.0 3 votes vote down vote up
/**
 * Create an integrator using Simpson's rule.
 *
 * @param lowerBound Lower bound of the integral.
 * @param upperBound Upper bound of the integral.
 * @param numberOfEvaluationPoints Maximum number of evaluation points to be used, must be greater or equal to 3, should be odd.
 * @param useParallelEvaluation If true, the integration rule will perform parallel evaluation of the integrand.
 */
public SimpsonRealIntegrator(final double lowerBound, final double upperBound, final int numberOfEvaluationPoints, final boolean useParallelEvaluation) {
	super(lowerBound, upperBound);
	Validate.exclusiveBetween(2, Integer.MAX_VALUE, numberOfEvaluationPoints, "Parameter numberOfEvaluationPoints required to be > 2.");
	this.numberOfEvaluationPoints = numberOfEvaluationPoints;
	this.useParallelEvaluation = useParallelEvaluation;
}
 
Example 6
Source File: TusFileUploadService.java    From tus-java-server with MIT License 2 votes vote down vote up
/**
 * Specify the maximum number of bytes that can be uploaded per upload.
 * If you don't call this method, the maximum number of bytes is Long.MAX_VALUE.
 *
 * @param maxUploadSize The maximum upload length that is allowed
 * @return The current service
 */
public TusFileUploadService withMaxUploadSize(Long maxUploadSize) {
    Validate.exclusiveBetween(0, Long.MAX_VALUE, maxUploadSize, "The max upload size must be bigger than 0");
    this.uploadStorageService.setMaxUploadSize(maxUploadSize);
    return this;
}
 
Example 7
Source File: TrapezoidalRealIntegrator.java    From finmath-lib with Apache License 2.0 2 votes vote down vote up
/**
 * Create an integrator using the trapezoidal rule and an equi-distant grid of evaluation points.
 * The minimum number of evaluation points (<code>numberOfEvaluationPoints</code>) is 2, since the
 * trapezoidal rule operates on intervals. That is, lowerBound and upperBound are always evaluated. For
 * <code>numberOfEvaluationPoints &gt; 2</code> additional inner points will be evaluated.
 *
 * @param lowerBound Lower bound of the integral.
 * @param upperBound Upper bound of the integral.
 * @param numberOfEvaluationPoints Number of evaluation points (that is calls to the applyAsDouble of integrand). Has to be &gt; 2;
 */
public TrapezoidalRealIntegrator(final double lowerBound, final double upperBound, final int numberOfEvaluationPoints) {
	super(lowerBound, upperBound);
	Validate.exclusiveBetween(2, Integer.MAX_VALUE, numberOfEvaluationPoints, "Parameter numberOfEvaluationPoints required to be > 2.");
	this.numberOfEvaluationPoints = numberOfEvaluationPoints;
}
 
Example 8
Source File: TrapezoidalRealIntegrator.java    From finmath-lib with Apache License 2.0 2 votes vote down vote up
/**
 * Create an integrator using the trapezoidal rule and an equi-distant grid of evaluation points.
 * The minimum number of evaluation points (<code>numberOfEvaluationPoints</code>) is 2, since the
 * trapezoidal rule operates on intervals. That is, lowerBound and upperBound are always evaluated. For
 * <code>numberOfEvaluationPoints &gt; 2</code> additional inner points will be evaluated.
 *
 * @param lowerBound Lower bound of the integral.
 * @param upperBound Upper bound of the integral.
 * @param numberOfEvaluationPoints Number of evaluation points (that is calls to the applyAsDouble of integrand). Has to be &gt; 2;
 */
public TrapezoidalRealIntegrator(final double lowerBound, final double upperBound, final int numberOfEvaluationPoints) {
	super(lowerBound, upperBound);
	Validate.exclusiveBetween(2, Integer.MAX_VALUE, numberOfEvaluationPoints, "Parameter numberOfEvaluationPoints required to be > 2.");
	this.numberOfEvaluationPoints = numberOfEvaluationPoints;
}