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.statistics.distribution.StudentTOneTailedCriticalValueCalculator.java

@Override
public Double evaluate(final Double x) {
    Validate.notNull(x, "x");
    ArgumentChecker.notNegative(x, "x");
    if (CompareUtils.closeEquals(x, 0.5, 1e-14)) {
        return 0.5;
    }//from ww w.j a  v a2 s .co  m
    return _dist.getInverseCDF(x);
}

From source file:net.bsrc.cbod.opencv.OpenCV.java

/**
 * @param imageModel/*from  w w  w . jav  a 2s .c  o m*/
 * @return
 */
public static Mat getImageMat(ImageModel imageModel) {
    Validate.notNull(imageModel, "Imagemodel must not be null");
    return getImageMat(imageModel.getImagePath());
}

From source file:com.fusesource.examples.horo.model.StarSign.java

public static StarSign getInstance(ReadableDateTime dateTime) {
    Validate.notNull(dateTime, "dateTime is null");
    StarSign starSign = null;/*from w  w  w. j ava  2 s  . c  om*/
    for (StarSign temp : values()) {
        if (temp.appliesTo(dateTime)) {
            starSign = temp;
            break;
        }
    }
    if (starSign == null) {
        throw new IllegalStateException(
                "Unable to find star sign for " + DateTimeFormat.forPattern("yyyyMMdd").print(dateTime));
    }
    return starSign;
}

From source file:com.fusesource.test.http.ResourceHttpHandler.java

public ResourceHttpHandler(Class testClass, String resource) {
    Validate.notNull(testClass, "testClass is null");
    Validate.notEmpty(resource, "resource is empty");
    try {/* w w w .  j a  va  2 s.c om*/
        response = new ResourceHelper(testClass).getResourceAsString(resource).getBytes();
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }
}

From source file:com.opengamma.analytics.financial.model.option.pricing.analytic.formula.BlackPriceFunction.java

@Override
public Function1D<BlackFunctionData, Double> getPriceFunction(final EuropeanVanillaOption option) {
    Validate.notNull(option, "option");
    final double k = option.getStrike();
    final double t = option.getTimeToExpiry();
    final boolean isCall = option.isCall();
    return new Function1D<BlackFunctionData, Double>() {

        @Override//w  w  w  .  j  a  v a  2 s  .  c om
        public Double evaluate(final BlackFunctionData data) {
            Validate.notNull(data, "data");
            final double forward = data.getForward();
            final double sigma = data.getBlackVolatility();
            final double df = data.getDiscountFactor();
            return df * BlackFormulaRepository.price(forward, k, t, sigma, isCall);
        }
    };
}

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

/**
 * {@inheritDoc}//from w  ww  . j  av  a2 s  .c  om
 */
@Override
public FunctionalDoublesSurface evaluate(final FunctionalDoublesSurface surface, final double percentage,
        final String newName) {
    Validate.notNull(surface, "surface");
    final Function<Double, Double> f = surface.getFunction();
    final Function<Double, Double> shiftedFunction = new Function<Double, Double>() {

        @Override
        public Double evaluate(final Double... xy) {
            return f.evaluate(xy) * (1 + percentage);
        }

    };
    return FunctionalDoublesSurface.from(shiftedFunction, newName);
}

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

/**
 * Builder from a map. A new map is created with the same values.
 * @param map The map./*from w w  w  . java 2 s  .  c  o  m*/
 * @return The surface value.
 */
public static SurfaceValue from(final Map<DoublesPair, Double> map) {
    Validate.notNull(map, "Map");
    HashMap<DoublesPair, Double> data = new HashMap<DoublesPair, Double>();
    data.putAll(map);
    return new SurfaceValue(data);
}

From source file:com.opengamma.financial.convention.USConventions.java

public static synchronized void addFixedIncomeInstrumentConventions(
        final ConventionBundleMaster conventionMaster) {
    Validate.notNull(conventionMaster, "convention master");
    final BusinessDayConvention modified = BusinessDayConventionFactory.INSTANCE
            .getBusinessDayConvention("Modified Following");
    final BusinessDayConvention following = BusinessDayConventionFactory.INSTANCE
            .getBusinessDayConvention("Following");
    final DayCount act360 = DayCountFactory.INSTANCE.getDayCount("Actual/360");
    final DayCount thirty360 = DayCountFactory.INSTANCE.getDayCount("30/360");
    final Frequency annual = PeriodFrequency.ANNUAL;
    final Frequency semiAnnual = SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.SEMI_ANNUAL_NAME);
    final Frequency quarterly = SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.QUARTERLY_NAME);

    final ExternalId usgb = ExternalSchemes.financialRegionId("US+GB");
    final ExternalId us = ExternalSchemes.financialRegionId("US");

    final ConventionBundleMasterUtils utils = new ConventionBundleMasterUtils(conventionMaster);

    // LIBOR//  w  w w .j  ava 2  s.  c om
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US00O/N Index"),
                    simpleNameSecurityId("USD LIBOR O/N")),
            "USD LIBOR O/N", act360, following, Period.ofDays(1), 0, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US00T/N Index"),
                    simpleNameSecurityId("USD LIBOR T/N")),
            "USD LIBOR T/N", act360, following, Period.ofDays(1), 1, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0001W Index"),
                    simpleNameSecurityId("USD LIBOR 1w"), tullettPrebonSecurityId("ASLIBUSD1WL")),
            "USD LIBOR 1w", act360, following, Period.ofDays(7), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0002W Index"),
                    simpleNameSecurityId("USD LIBOR 2w"), tullettPrebonSecurityId("ASLIBUSD2WL")),
            "USD LIBOR 2w", act360, following, Period.ofDays(14), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0001M Index"),
                    simpleNameSecurityId("USD LIBOR 1m"), tullettPrebonSecurityId("ASLIBUSD01L")),
            "USD LIBOR 1m", act360, modified, Period.ofMonths(1), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0002M Index"),
                    simpleNameSecurityId("USD LIBOR 2m"), tullettPrebonSecurityId("ASLIBUSD02L")),
            "USD LIBOR 2m", act360, modified, Period.ofMonths(2), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0003M Index"),
                    simpleNameSecurityId("USD LIBOR 3m"), ExternalSchemes.ricSecurityId("USD3MFSR="),
                    tullettPrebonSecurityId("ASLIBUSD03L")),
            "USD LIBOR 3m", act360, modified, Period.ofMonths(3), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0004M Index"),
                    simpleNameSecurityId("USD LIBOR 4m"), tullettPrebonSecurityId("ASLIBUSD04L")),
            "USD LIBOR 4m", act360, modified, Period.ofMonths(4), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0005M Index"),
                    simpleNameSecurityId("USD LIBOR 5m"), tullettPrebonSecurityId("ASLIBUSD05L")),
            "USD LIBOR 5m", act360, modified, Period.ofMonths(5), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0006M Index"),
                    simpleNameSecurityId("USD LIBOR 6m"), tullettPrebonSecurityId("ASLIBUSD06L")),
            "USD LIBOR 6m", act360, modified, Period.ofMonths(6), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0007M Index"),
                    simpleNameSecurityId("USD LIBOR 7m"), tullettPrebonSecurityId("ASLIBUSD07L")),
            "USD LIBOR 7m", act360, modified, Period.ofMonths(7), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0008M Index"),
                    simpleNameSecurityId("USD LIBOR 8m"), tullettPrebonSecurityId("ASLIBUSD08L")),
            "USD LIBOR 8m", act360, modified, Period.ofMonths(8), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0009M Index"),
                    simpleNameSecurityId("USD LIBOR 9m"), tullettPrebonSecurityId("ASLIBUSD09L")),
            "USD LIBOR 9m", act360, modified, Period.ofMonths(9), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0010M Index"),
                    simpleNameSecurityId("USD LIBOR 10m"), tullettPrebonSecurityId("ASLIBUSD10L")),
            "USD LIBOR 10m", act360, modified, Period.ofMonths(10), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0011M Index"),
                    simpleNameSecurityId("USD LIBOR 11m"), tullettPrebonSecurityId("ASLIBUSD11L")),
            "USD LIBOR 11m", act360, modified, Period.ofMonths(11), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("US0012M Index"),
                    simpleNameSecurityId("USD LIBOR 12m"), tullettPrebonSecurityId("ASLIBUSD12L")),
            "USD LIBOR 12m", act360, modified, Period.ofMonths(12), 2, false, us);

    //TODO need to check that these are right for deposit rates
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDR1T Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 1d")),
            "USD DEPOSIT 1d", act360, following, Period.ofDays(1), 0, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDR2T Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 2d")),
            "USD DEPOSIT 2d", act360, following, Period.ofDays(1), 1, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDR3T Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 3d")),
            "USD DEPOSIT 3d", act360, following, Period.ofDays(1), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDR7D Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 1w"), tullettPrebonSecurityId("ASDEPUSDSPT01W")),
            "USD DEPOSIT 1w", act360, following, Period.ofDays(7), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDR2Z Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 2w"), tullettPrebonSecurityId("ASDEPUSDSPT02W")),
            "USD DEPOSIT 2w", act360, following, Period.ofDays(14), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDR3Z Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 3w"), tullettPrebonSecurityId("ASDEPUSDSPT03W")),
            "USD DEPOSIT 3w", act360, following, Period.ofDays(21), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDRA Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 1m"), tullettPrebonSecurityId("ASDEPUSDSPT01M")),
            "USD DEPOSIT 1m", act360, following, Period.ofMonths(1), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDRB Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 2m"), tullettPrebonSecurityId("ASDEPUSDSPT02M")),
            "USD DEPOSIT 2m", act360, following, Period.ofMonths(2), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDRC Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 3m"), tullettPrebonSecurityId("ASDEPUSDSPT03M")),
            "USD DEPOSIT 3m", act360, following, Period.ofMonths(3), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDRD Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 4m"), tullettPrebonSecurityId("ASDEPUSDSPT04M")),
            "USD DEPOSIT 4m", act360, following, Period.ofMonths(4), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDRE Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 5m"), tullettPrebonSecurityId("ASDEPUSDSPT05M")),
            "USD DEPOSIT 5m", act360, following, Period.ofMonths(5), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDRF Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 6m"), tullettPrebonSecurityId("ASDEPUSDSPT06M")),
            "USD DEPOSIT 6m", act360, following, Period.ofMonths(6), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDRG Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 7m"), tullettPrebonSecurityId("ASDEPUSDSPT07M")),
            "USD DEPOSIT 7m", act360, following, Period.ofMonths(7), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDRH Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 8m"), tullettPrebonSecurityId("ASDEPUSDSPT08M")),
            "USD DEPOSIT 8m", act360, following, Period.ofMonths(8), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDRI Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 9m"), tullettPrebonSecurityId("ASDEPUSDSPT09M")),
            "USD DEPOSIT 9m", act360, following, Period.ofMonths(9), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDRJ Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 10m"), tullettPrebonSecurityId("ASDEPUSDSPT10M")),
            "USD DEPOSIT 10m", act360, following, Period.ofMonths(10), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDRK Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 11m"), tullettPrebonSecurityId("ASDEPUSDSPT11M")),
            "USD DEPOSIT 11m", act360, following, Period.ofMonths(11), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDR1 Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 1y"), tullettPrebonSecurityId("ASDEPUSDSPT12M")),
            "USD DEPOSIT 1y", act360, following, Period.ofYears(1), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDR2 Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 2y")),
            "USD DEPOSIT 2y", act360, following, Period.ofYears(2), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDR3 Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 3y")),
            "USD DEPOSIT 3y", act360, following, Period.ofYears(3), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDR4 Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 4y")),
            "USD DEPOSIT 4y", act360, following, Period.ofYears(4), 2, false, us);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("USDR5 Curncy"),
                    simpleNameSecurityId("USD DEPOSIT 5y")),
            "USD DEPOSIT 5y", act360, following, Period.ofYears(5), 2, false, us);

    //TODO with improvement in settlement days definition (i.e. including holiday and adjustment) change this
    // should be 2, LON, following
    // holiday for swap should be NY+LON

    final DayCount swapFixedDayCount = thirty360;
    final BusinessDayConvention swapFixedBusinessDay = modified;
    final Frequency swapFixedPaymentFrequency = semiAnnual;
    final DayCount swapFloatDayCount = act360;
    final BusinessDayConvention swapFloatBusinessDay = modified;
    final Frequency swapFloatPaymentFrequency = quarterly;

    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("USD_SWAP")), "USD_SWAP",
            swapFixedDayCount, swapFixedBusinessDay, swapFixedPaymentFrequency, 2, usgb, swapFloatDayCount,
            swapFloatBusinessDay, swapFloatPaymentFrequency, 2, simpleNameSecurityId("USD LIBOR 3m"), usgb,
            true);
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("USD_3M_SWAP")), "USD_3M_SWAP",
            swapFixedDayCount, swapFixedBusinessDay, swapFixedPaymentFrequency, 2, usgb, swapFloatDayCount,
            swapFloatBusinessDay, quarterly, 2, simpleNameSecurityId("USD LIBOR 3m"), usgb, true);
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("USD_6M_SWAP")), "USD_6M_SWAP",
            swapFixedDayCount, swapFixedBusinessDay, swapFixedPaymentFrequency, 2, usgb, swapFloatDayCount,
            swapFloatBusinessDay, semiAnnual, 2, simpleNameSecurityId("USD LIBOR 6m"), usgb, true);

    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("USD_IR_FUTURE")), "USD_IR_FUTURE",
            act360, modified, Period.ofMonths(3), 2, false, null);

    final int publicationLag = 1;
    // Fed Fund effective
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("FEDL01 Index"),
                    simpleNameSecurityId("USD FF EFFECTIVE")),
            "USD FF EFFECTIVE", act360, following, Period.ofDays(1), 2, false, us, publicationLag);
    // OIS swap
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("USD_OIS_SWAP")), "USD_OIS_SWAP",
            thirty360, modified, annual, 2, usgb, thirty360, modified, annual, 2,
            simpleNameSecurityId("USD FF EFFECTIVE"), usgb, true, publicationLag);

    // FRA conventions are stored as IRS
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("USD_3M_FRA")), "USD_3M_FRA", thirty360,
            modified, quarterly, 2, usgb, act360, modified, quarterly, 2, simpleNameSecurityId("USD LIBOR 3m"),
            usgb, true);
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("USD_6M_FRA")), "USD_6M_FRA", thirty360,
            modified, semiAnnual, 2, usgb, act360, modified, semiAnnual, 2,
            simpleNameSecurityId("USD LIBOR 6m"), usgb, true);

    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("USD_TENOR_SWAP")), "USD_TENOR_SWAP",
            act360, modified, quarterly, 2, simpleNameSecurityId("USD FF 3m"), usgb, act360, modified,
            quarterly, 2, simpleNameSecurityId("USD LIBOR 3m"), usgb);
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("USD_SWAPTION")), "USD_SWAPTION", true);

    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("USD_GENERIC_CASH")), "USD_GENERIC_CASH",
            act360, following, Period.ofDays(7), 2, true, null);

    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId(IndexType.Libor + "_USD_P3M")),
            IndexType.Libor + "_USD_P3M", thirty360, modified, null, 2, false, usgb);
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId(IndexType.Libor + "_USD_P6M")),
            IndexType.Libor + "_USD_P6M", thirty360, modified, null, 2, false, usgb);
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("USD_BASIS_SWAP")), "USD_BASIS_SWAP",
            act360, modified, quarterly, 2, null, usgb, act360, modified, quarterly, 2, null, usgb);

    // TODO: Add all ISDA fixing
    final int[] isdaFixTenor = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30 };
    // ISDA fixing 11.00 New-York
    for (final int element : isdaFixTenor) {
        final String tenorString = element + "Y";
        final String tenorStringBbg = String.format("%02d", element);
        utils.addConventionBundle(
                ExternalIdBundle.of(simpleNameSecurityId("USD_ISDAFIX_USDLIBOR10_" + tenorString),
                        ExternalSchemes.ricSecurityId("USDSFIX" + tenorString + "="),
                        bloombergTickerSecurityId("USISDA" + tenorStringBbg + " Index")),
                "USD_ISDAFIX_USDLIBOR10_" + tenorString, swapFixedDayCount, swapFixedBusinessDay,
                swapFixedPaymentFrequency, 2, us, act360, modified, semiAnnual, 2,
                simpleNameSecurityId("USD LIBOR 3m"), us, true, Period.ofYears(element));
    }

    //Identifiers for external data
    utils.addConventionBundle(ExternalId.of(FactorExposureData.FACTOR_SCHEME, "IR.SWAP.USD.1M").toBundle(),
            "IR.SWAP.USD.1M", act360, modified, Period.ofMonths(1), 2, false, null);
    utils.addConventionBundle(ExternalId.of(FactorExposureData.FACTOR_SCHEME, "IR.SWAP.USD.6M").toBundle(),
            "IR.SWAP.USD.6M", act360, modified, Period.ofMonths(6), 2, false, null);
    utils.addConventionBundle(ExternalId.of(FactorExposureData.FACTOR_SCHEME, "IR.SWAP.USD.12M").toBundle(),
            "IR.SWAP.USD.12M", act360, modified, Period.ofMonths(12), 2, false, null);
    utils.addConventionBundle(ExternalId.of(FactorExposureData.FACTOR_SCHEME, "IR.SWAP.USD.24M").toBundle(),
            "IR.SWAP.USD.24M", act360, modified, Period.ofMonths(24), 2, false, null);
    utils.addConventionBundle(ExternalId.of(FactorExposureData.FACTOR_SCHEME, "IR.SWAP.USD.36M").toBundle(),
            "IR.SWAP.USD.36M", act360, modified, Period.ofMonths(36), 2, false, null);
    utils.addConventionBundle(ExternalId.of(FactorExposureData.FACTOR_SCHEME, "IR.SWAP.USD.60M").toBundle(),
            "IR.SWAP.USD.60M", act360, modified, Period.ofMonths(60), 2, false, null);
    utils.addConventionBundle(ExternalId.of(FactorExposureData.FACTOR_SCHEME, "IR.SWAP.USD.84M").toBundle(),
            "IR.SWAP.USD.84M", act360, modified, Period.ofMonths(84), 2, false, null);
    utils.addConventionBundle(ExternalId.of(FactorExposureData.FACTOR_SCHEME, "IR.SWAP.USD.120M").toBundle(),
            "IR.SWAP.USD.120M", act360, modified, Period.ofMonths(120), 2, false, null);
    utils.addConventionBundle(ExternalId.of(FactorExposureData.FACTOR_SCHEME, "IR.SWAP.USD.360M").toBundle(),
            "IR.SWAP.USD.360M", act360, modified, Period.ofMonths(360), 2, false, null);
}

From source file:com.opengamma.analytics.financial.interestrate.PeriodicInterestRate.java

@Override
public InterestRate fromContinuous(final ContinuousInterestRate continuous) {
    Validate.notNull(continuous, "continuous");
    final int m = getCompoundingPeriodsPerYear();
    return new PeriodicInterestRate(m * (Math.exp(continuous.getRate() / m) - 1), m);
}

From source file:com.opengamma.analytics.math.interpolation.NaturalCubicSplineInterpolator1D.java

@Override
public Double interpolate(final Interpolator1DDataBundle data, final Double value) {
    Validate.notNull(value, "value");
    Validate.notNull(data, "data bundle");
    Validate.isTrue(data instanceof Interpolator1DCubicSplineDataBundle);
    Interpolator1DCubicSplineDataBundle splineData = (Interpolator1DCubicSplineDataBundle) data;
    final int low = data.getLowerBoundIndex(value);
    final int high = low + 1;
    final int n = data.size() - 1;
    final double[] xData = data.getKeys();
    final double[] yData = data.getValues();
    if (data.getLowerBoundIndex(value) == n) {
        return yData[n];
    }// w w  w . j  av a  2 s. c o  m
    final double delta = xData[high] - xData[low];
    if (Math.abs(delta) < _eps) {
        throw new MathException("x data points were not distinct");
    }
    final double a = (xData[high] - value) / delta;
    final double b = (value - xData[low]) / delta;
    final double[] y2 = splineData.getSecondDerivatives();
    return a * yData[low] + b * yData[high]
            + (a * (a * a - 1) * y2[low] + b * (b * b - 1) * y2[high]) * delta * delta / 6.;
}