Пример #1
0
        private ImmutableTable <int, int, object> getData <T1>(IList <ExplainMap> flatMap, IList <T1> keys)
        {
            ImmutableTable.Builder <int, int, object> builder = ImmutableTable.builder();

            for (int rowIdx = 0; rowIdx < flatMap.Count; rowIdx++)
            {
                ExplainMap rowMap = flatMap[rowIdx];

                for (int colIdx = 0; colIdx < keys.Count; colIdx++)
                {
                    builder.put(rowIdx, colIdx, rowMap.get(keys[colIdx]));
                }
            }
            return(builder.build());
        }
        public TradeReport runReport(ReportCalculationResults results, TradeReportTemplate reportTemplate)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: com.google.common.collect.ImmutableTable.Builder<int, int, com.opengamma.strata.collect.result.Result<?>> resultTable = com.google.common.collect.ImmutableTable.builder();
            ImmutableTable.Builder <int, int, Result <object> > resultTable = ImmutableTable.builder();

            for (int reportColumnIdx = 0; reportColumnIdx < reportTemplate.Columns.Count; reportColumnIdx++)
            {
                TradeReportColumn reportColumn = reportTemplate.Columns[reportColumnIdx];
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<com.opengamma.strata.collect.result.Result<?>> columnResults;
                IList <Result <object> > columnResults;

                if (reportColumn.Value.Present)
                {
                    columnResults = ValuePathEvaluator.evaluate(reportColumn.Value.get(), results);
                }
                else
                {
                    columnResults = IntStream.range(0, results.Targets.Count).mapToObj(i => Result.failure(FailureReason.INVALID, "No value specified in report template")).collect(toImmutableList());
                }
                int rowCount = results.CalculationResults.RowCount;

                for (int rowIdx = 0; rowIdx < rowCount; rowIdx++)
                {
                    resultTable.put(rowIdx, reportColumnIdx, columnResults[rowIdx]);
                }
            }

            return(TradeReport.builder().runInstant(Instant.now()).valuationDate(results.ValuationDate).columns(reportTemplate.Columns).data(resultTable.build()).build());
        }