Example usage for org.apache.commons.lang Validate notNull

List of usage examples for org.apache.commons.lang Validate notNull

Introduction

In this page you can find the example usage for org.apache.commons.lang Validate notNull.

Prototype

public static void notNull(Object object, String message) 

Source Link

Document

Validate an argument, throwing IllegalArgumentException if the argument is null.

 Validate.notNull(myObject, "The object must not be null"); 

Usage

From source file:com.opengamma.analytics.math.surface.SurfaceSliceFunction.java

public ConstantDoublesCurve cut(final ConstantDoublesSurface surface, final Axis axis, final Double at) {
    Validate.notNull(surface, "surface");
    Validate.notNull(axis, "axis");
    Validate.notNull(at, "at");
    return ConstantDoublesCurve.from(surface.getZValue(null, null));
}

From source file:com.opengamma.analytics.util.surface.CubeValue.java

/**
 * Builder from on point./*from  w  ww .ja v  a  2s . com*/
 * @param point The surface point.
 * @param value The associated value.
 * @return The surface value.
 */
public static CubeValue from(final Triple<Double, Double, Double> point, final Double value) {
    Validate.notNull(point, "Point");
    HashMap<Triple<Double, Double, Double>, Double> data = new HashMap<Triple<Double, Double, Double>, Double>();
    data.put(point, value);
    return new CubeValue(data);
}

From source file:com.opengamma.analytics.financial.model.finitedifference.NeumannBoundaryCondition2D.java

public NeumannBoundaryCondition2D(final Surface<Double, Double, Double> boundaryFirstDeriviative,
        double boundaryLevel) {
    Validate.notNull(boundaryFirstDeriviative, "boundaryValue ");
    _f = boundaryFirstDeriviative;/* w w  w  . ja  va2s  .  co m*/
    _level = boundaryLevel;
}

From source file:com.opengamma.analytics.math.ParallelArrayBinarySort.java

/**
 * Sort the content of keys and values simultaneously so that
 * both match the correct ordering. Alters the arrays in place
 * @param keys The keys/*from w  w  w  . j  a va  2s .  com*/
 * @param values The values
 */
public static void parallelBinarySort(final float[] keys, final double[] values) {
    Validate.notNull(keys, "x data");
    Validate.notNull(values, "y data");
    Validate.isTrue(keys.length == values.length);
    final int n = keys.length;
    dualArrayQuickSort(keys, values, 0, n - 1);
}

From source file:com.opengamma.analytics.math.surface.FunctionalSurfaceAdditiveShiftFunction.java

/**
 * {@inheritDoc}//  www.  jav  a 2 s.c  o m
 */
@Override
public FunctionalDoublesSurface evaluate(final FunctionalDoublesSurface surface, final double shift) {
    Validate.notNull(surface, "surface");
    return evaluate(surface, shift, "PARALLEL_SHIFT_" + surface.getName());
}

From source file:ch.admin.suis.msghandler.util.ISO8601Utils.java

/**
 * Tests whether the given string is in ISO-8601 format.
 *
 * @param value to be tested/*  w ww.j av a  2s  .c  o m*/
 * @throws NullPointerException if the provided value is <code>null</code>
 */
public static boolean isISO8601Date(String value) {
    Validate.notNull(value, "Date cannot be null");

    try {
        parse(value);
        return true;
    } catch (IllegalArgumentException e) {
        return false;
    }
}

From source file:com.vmware.identity.rest.idm.server.mapper.ResourceServerMapper.java

public static ResourceServerDTO getResourceServerDTO(ResourceServer resourceServer) {
    Validate.notNull(resourceServer, "resourceServer");
    return ResourceServerDTO.builder().withName(resourceServer.getName())
            .withGroupFilter(resourceServer.getGroupFilter()).build();
}

From source file:com.opengamma.analytics.financial.model.volatility.smile.function.SABRFormulaData.java

/**
 * // w  ww .java 2s .co m
 * @param parameters Must be 4 parameters in the order alpha, beta, rho, nu
 */
public SABRFormulaData(final double[] parameters) {
    Validate.notNull(parameters, "parameters are null");
    Validate.isTrue(parameters.length == NUM_PARAMETERS, "must be " + NUM_PARAMETERS + " parameters");
    Validate.isTrue(parameters[0] >= 0.0, "alpha must be >= 0.0");
    Validate.isTrue(parameters[1] >= 0.0, "beta must be >= 0.0");
    Validate.isTrue(parameters[2] >= -1 && parameters[2] <= 1, "rho must be between -1 and 1");
    Validate.isTrue(parameters[3] >= 0.0, "nu must be >= 0.0");

    _parameters = new double[NUM_PARAMETERS];
    System.arraycopy(parameters, 0, _parameters, 0, NUM_PARAMETERS);
}

From source file:com.opengamma.analytics.financial.var.parametric.DeltaMeanCalculator.java

public DeltaMeanCalculator(final MatrixAlgebra algebra) {
    Validate.notNull(algebra, "algebra");
    _algebra = algebra;
}

From source file:com.opengamma.analytics.math.TrigonometricFunctionUtils.java

public static ComplexNumber asin(final ComplexNumber z) {
    Validate.notNull(z, "z");
    return ComplexMathUtils.multiply(NEGATIVE_I,
            ComplexMathUtils.log(ComplexMathUtils.add(ComplexMathUtils.multiply(I, z),
                    ComplexMathUtils.sqrt(ComplexMathUtils.subtract(1, ComplexMathUtils.multiply(z, z))))));
}