コード例 #1
0
 private SnapshotDataBundle buildMarketDataMap(final FunctionInputs inputs) {
   final Map<Identifier, Double> marketDataMap = new HashMap<Identifier, Double>();
   for (final ComputedValue value : inputs.getAllValues()) {
     final ComputationTargetSpecification targetSpecification =
         value.getSpecification().getTargetSpecification();
     if (value.getValue() instanceof Double) {
       marketDataMap.put(targetSpecification.getIdentifier(), (Double) value.getValue());
     }
   }
   SnapshotDataBundle snapshotDataBundle = new SnapshotDataBundle();
   snapshotDataBundle.setDataPoints(marketDataMap);
   return snapshotDataBundle;
 }
コード例 #2
0
 private Map<String, Object> formatExpanded(
     final SnapshotDataBundle bundle, final ValueSpecification valueSpec) {
   final List<List<String>> results = Lists.newArrayListWithCapacity(bundle.size());
   final Map<String, Object> resultsMap = Maps.newHashMap();
   for (final Map.Entry<ExternalIdBundle, Double> entry : bundle.getDataPointSet()) {
     final ExternalId id = _orderConfig.getPreferred(entry.getKey());
     final String idStr = (id != null) ? id.toString() : "";
     final String formattedValue = _doubleFormatter.formatCell(entry.getValue(), valueSpec, null);
     results.add(ImmutableList.of(idStr, formattedValue));
   }
   resultsMap.put(DATA, results);
   resultsMap.put(LABELS, ImmutableList.of(ID, VALUE));
   return resultsMap;
 }
コード例 #3
0
 @Override
 public String formatCell(
     final SnapshotDataBundle bundle, final ValueSpecification valueSpec, Object inlineKey) {
   return "Data Bundle (" + bundle.size() + " points)";
 }