List of usage examples for org.apache.commons.lang ArrayUtils toObject
public static Boolean[] toObject(boolean[] array)
Converts an array of primitive booleans to objects.
From source file:com.opengamma.analytics.financial.provider.curve.inflation.InflationDiscountBuildingRepository.java
/** * Build a unit of curves without the discount curve. * @param instruments The instruments used for the unit calibration. * @param initGuess The initial parameters guess. * @param knownData The known data (fx rates, other curves, model parameters, ...) * @param discountingMap The discounting curves names map. * @param forwardIborMap The forward curves names map. * @param forwardONMap The forward curves names map. * @param generatorsMap The generators map. * @param calculator The calculator of the value on which the calibration is done (usually ParSpreadMarketQuoteCalculator (recommended) or converted present value). * @param sensitivityCalculator The parameter sensitivity calculator. * @return The new curves and the calibrated parameters. *//* w w w . j a v a 2 s .c o m*/ private Pair<InflationProviderDiscount, Double[]> makeUnit(final InstrumentDerivative[] instruments, final double[] initGuess, final InflationProviderDiscount knownData, final LinkedHashMap<String, IndexPrice[]> inflationMap, final LinkedHashMap<String, GeneratorPriceIndexCurve> generatorsMap, final InstrumentDerivativeVisitor<InflationProviderInterface, Double> calculator, final InstrumentDerivativeVisitor<InflationProviderInterface, InflationSensitivity> sensitivityCalculator) { final GeneratorInflationProviderDiscount generator = new GeneratorInflationProviderDiscount(knownData, inflationMap, generatorsMap); final InflationDiscountBuildingData data = new InflationDiscountBuildingData(instruments, generator); final Function1D<DoubleMatrix1D, DoubleMatrix1D> curveCalculator = new InflationDiscountFinderFunction( calculator, data); final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacobianCalculator = new InflationDiscountFinderJacobian( new ParameterSensitivityInflationMatrixCalculator(sensitivityCalculator), data); final double[] parameters = _rootFinder .getRoot(curveCalculator, jacobianCalculator, new DoubleMatrix1D(initGuess)).getData(); final InflationProviderDiscount newCurves = data.getGeneratorMarket() .evaluate(new DoubleMatrix1D(parameters)); return new ObjectsPair<>(newCurves, ArrayUtils.toObject(parameters)); }
From source file:alluxio.worker.block.TieredBlockStoreTestUtils.java
/** * Sets up a specific tier's {@link Configuration} for a {@link TieredBlockStore}. * * @param tierAlias alias of the tier/*from w w w . j a v a2 s. c om*/ * @param tierPath absolute path of the tier * @param tierCapacity capacity of the tier */ private static void setupConfTier(int ordinal, String tierAlias, String[] tierPath, long[] tierCapacity) { Preconditions.checkNotNull(tierPath); Preconditions.checkNotNull(tierCapacity); Preconditions.checkArgument(tierPath.length == tierCapacity.length, "tierPath and tierCapacity should have the same length"); Configuration.set(PropertyKeyFormat.WORKER_TIERED_STORE_LEVEL_ALIAS_FORMAT.format(ordinal), tierAlias); String tierPathString = StringUtils.join(tierPath, ","); Configuration.set(PropertyKeyFormat.WORKER_TIERED_STORE_LEVEL_DIRS_PATH_FORMAT.format(ordinal), tierPathString); String tierCapacityString = StringUtils.join(ArrayUtils.toObject(tierCapacity), ","); Configuration.set(PropertyKeyFormat.WORKER_TIERED_STORE_LEVEL_DIRS_QUOTA_FORMAT.format(ordinal), tierCapacityString); }
From source file:adwords.axis.v201309.accountmanagement.GetAccountChanges.java
/** * Gets a formatted list of a long array in the form {1,2,3}. * @param idList the long array/* w w w .ja v a2 s.co m*/ * @return the formatted list */ private static String getFormattedList(long[] idList) { if (idList == null) { idList = new long[] {}; } return new StringBuilder().append("{").append(StringUtils.join(ArrayUtils.toObject(idList), ',')) .append("}").toString(); }
From source file:ch.epfl.data.squall.operators.MultiAggregateOperator.java
@Override public AggregateOperator setGroupByColumns(int... hashIndexes) { return setGroupByColumns(Arrays.asList(ArrayUtils.toObject(hashIndexes))); }
From source file:com.opengamma.analytics.financial.provider.curve.issuer.IssuerDiscountBuildingRepository.java
/** * Build a unit of curves.//from www.java 2 s . com * @param instruments The instruments used for the unit calibration. * @param initGuess The initial parameters guess. * @param knownData The known data (fx rates, other curves, model parameters, ...) * @param discountingMap The discounting curves names map. * @param forwardIborMap The forward curves names map. * @param forwardONMap The forward curves names map. * @param issuerMap The issuer curves names map. * @param generatorsMap The generators map. * @param calculator The calculator of the value on which the calibration is done (usually ParSpreadMarketQuoteCalculator (recommended) or converted present value). * @param sensitivityCalculator The parameter sensitivity calculator. * @return The new curves and the calibrated parameters. */ private Pair<IssuerProviderDiscount, Double[]> makeUnit(final InstrumentDerivative[] instruments, final double[] initGuess, final IssuerProviderDiscount knownData, final LinkedHashMap<String, Currency> discountingMap, final LinkedHashMap<String, IborIndex[]> forwardIborMap, final LinkedHashMap<String, IndexON[]> forwardONMap, final LinkedHashMap<String, Pair<String, Currency>> issuerMap, final LinkedHashMap<String, GeneratorYDCurve> generatorsMap, final InstrumentDerivativeVisitor<IssuerProviderInterface, Double> calculator, final InstrumentDerivativeVisitor<IssuerProviderInterface, MulticurveSensitivity> sensitivityCalculator) { final GeneratorIssuerProviderDiscount generator = new GeneratorIssuerProviderDiscount(knownData, discountingMap, forwardIborMap, forwardONMap, issuerMap, generatorsMap); final IssuerDiscountBuildingData data = new IssuerDiscountBuildingData(instruments, generator); final Function1D<DoubleMatrix1D, DoubleMatrix1D> curveCalculator = new IssuerDiscountFinderFunction( calculator, data); // final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacobianCalculator = new IssuerDiscountFinderJacobian(new ParameterSensitivityIssuerUnderlyingMatrixCalculator(sensitivityCalculator), data); // TODO final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacobianCalculator = new IssuerDiscountFinderJacobian( new ParameterSensitivityIssuerMatrixCalculator(sensitivityCalculator), data); final double[] parameters = _rootFinder .getRoot(curveCalculator, jacobianCalculator, new DoubleMatrix1D(initGuess)).getData(); final IssuerProviderDiscount newCurves = data.getGeneratorMarket().evaluate(new DoubleMatrix1D(parameters)); return new ObjectsPair<>(newCurves, ArrayUtils.toObject(parameters)); }
From source file:morphy.timeseal.TimesealCoder.java
public static byte[][] splitBytes(byte[] bytes, byte splitByte) { byte[] bytesToProcess = bytes; ArrayList<Byte[]> bytesList = new ArrayList<Byte[]>(); int idx;// w w w . j a va 2 s . c o m while ((idx = ArrayUtils.indexOf(bytesToProcess, splitByte)) != -1) { bytesList.add(ArrayUtils.toObject(Arrays.copyOfRange(bytesToProcess, 0, idx))); if (idx + 1 < bytesToProcess.length) { bytesToProcess = Arrays.copyOfRange(bytesToProcess, idx + 1, bytesToProcess.length); } } bytesList.add(ArrayUtils.toObject(bytesToProcess)); byte[][] newBytes = new byte[bytesList.size()][]; Byte[][] objBytesArray = bytesList.toArray(new Byte[bytesList.size()][0]); for (int i = 0; i < objBytesArray.length; i++) { newBytes[i] = ArrayUtils.toPrimitive(objBytesArray[i]); } return newBytes; }
From source file:ch.epfl.data.squall.components.OperatorComponent.java
@Override public OperatorComponent setOutputPartKey(int... hashIndexes) { return setOutputPartKey(Arrays.asList(ArrayUtils.toObject(hashIndexes))); }
From source file:ch.epfl.data.squall.components.InterchangingDataSourceComponent.java
@Override public InterchangingDataSourceComponent setOutputPartKey(int... hashIndexes) { return setOutputPartKey(Arrays.asList(ArrayUtils.toObject(hashIndexes))); }
From source file:ch.epfl.data.squall.operators.AggregateAvgOperator.java
@Override public AggregateAvgOperator setGroupByColumns(int... hashIndexes) { return setGroupByColumns(Arrays.asList(ArrayUtils.toObject(hashIndexes))); }
From source file:ch.epfl.data.squall.operators.ApproximateCountSketchOperator.java
@Override public ApproximateCountSketchOperator setGroupByColumns(int... hashIndexes) { return setGroupByColumns(Arrays.asList(ArrayUtils.toObject(hashIndexes))); }