CurrencySeriesConversionFunction extends AbstractFunction.NonCompiledInvoker { @VisibleForTesting TenorLabelledLocalDateDoubleTimeSeriesMatrix1D convertLabelledMatrix(final LabelledObjectMatrix1D<Tenor, LocalDateDoubleTimeSeries, Period> values, final DoubleTimeSeries<LocalDate> conversionRates) { LocalDateDoubleTimeSeries[] convertedValues = new LocalDateDoubleTimeSeries[values.size()]; for (int i = 0; i < values.size(); i++) { convertedValues[i] = (LocalDateDoubleTimeSeries) convertTimeSeries(values.getValues()[i], conversionRates); } return new TenorLabelledLocalDateDoubleTimeSeriesMatrix1D(values.getKeys(), values.getLabels(), values.getLabelsTitle(), convertedValues, values.getValuesTitle()); } CurrencySeriesConversionFunction(final String valueName);  CurrencySeriesConversionFunction(final String... valueNames); void setAllowViewDefaultCurrency(final boolean allowViewDefaultCurrency); boolean isAllowViewDefaultCurrency(); @SuppressWarnings("unchecked") @Override Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues); @Override Set<ValueRequirement> getRequirements(final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue); @Override Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target); @Override Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs); @Override Set<ValueRequirement> getAdditionalRequirements(final FunctionCompilationContext context, final ComputationTarget target, final Set<ValueSpecification> inputs,
      final Set<ValueSpecification> outputs); @Override ComputationTargetType getTargetType();  }
@Test public void testConvertLabelledMatrix() throws Exception { final double conversionFactor = 0.5; final Tenor[] tenors = new Tenor[] {Tenor.ONE_DAY, Tenor.TWO_DAYS, Tenor.THREE_DAYS}; final LocalDateDoubleTimeSeries[] dateArray = new LocalDateDoubleTimeSeries[] { ImmutableLocalDateDoubleTimeSeries.of(new LocalDate[] {LocalDate.now()}, new double[] { 2.0 }), ImmutableLocalDateDoubleTimeSeries.of(new LocalDate[] {LocalDate.now()}, new double[] { 3.0 }), ImmutableLocalDateDoubleTimeSeries.of(new LocalDate[] {LocalDate.now()}, new double[] { 4.0 })}; final TenorLabelledLocalDateDoubleTimeSeriesMatrix1D instance = new TenorLabelledLocalDateDoubleTimeSeriesMatrix1D(tenors, dateArray); final DoubleTimeSeries<LocalDate> conversionRates = ImmutableLocalDateDoubleTimeSeries.of(new LocalDate[] {LocalDate.now()},new double[] {conversionFactor} ); final CurrencySeriesConversionFunction function = new CurrencySeriesConversionFunction("Blah"); final TenorLabelledLocalDateDoubleTimeSeriesMatrix1D result = function.convertLabelledMatrix(instance, conversionRates); assertEquals(instance.getValues()[0].getEarliestValueFast() / conversionFactor, result.getValues()[0].getEarliestValueFast()); assertEquals(instance.getValues()[1].getEarliestValueFast() / conversionFactor, result.getValues()[1].getEarliestValueFast()); assertEquals(instance.getValues()[2].getEarliestValueFast() / conversionFactor, result.getValues()[2].getEarliestValueFast()); }