//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private com.opengamma.strata.market.explain.ExplainKey<?> mapKey(com.opengamma.strata.market.explain.ExplainKey<?> key, boolean isFlow) private ExplainKey <object> mapKey <T1>(ExplainKey <T1> key, bool isFlow) { if (!isFlow && key.Equals(ExplainKey.FORECAST_VALUE)) { return(INTERIM_AMOUNT_KEY); } return(key); }
private object mapValue <T1>(ExplainKey <T1> key, object value, int level) { if (ExplainKey.ENTRY_TYPE.Equals(key) && level > 0) { return(humanizeUpperCamelCase((string)value)); } return(value); }
private string mapHeader <T1>(ExplainKey <T1> key) { string header = HEADER_MAP[key]; if (!string.ReferenceEquals(header, null)) { return(header); } return(humanizeUpperCamelCase(key.Name)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") private void flatten(com.opengamma.strata.market.explain.ExplainMap explainMap, boolean parentVisible, java.util.Map<com.opengamma.strata.market.explain.ExplainKey<?>, Object> parentRow, java.util.Map<com.opengamma.strata.market.explain.ExplainKey<?>, Object> currentRow, int level, java.util.List<com.opengamma.strata.market.explain.ExplainMap> accumulator) private void flatten <T1, T2>(ExplainMap explainMap, bool parentVisible, IDictionary <T1> parentRow, IDictionary <T2> currentRow, int level, IList <ExplainMap> accumulator) { bool hasParentFlow = currentRow.ContainsKey(ExplainKey.FORECAST_VALUE); bool isFlow = explainMap.get(ExplainKey.PAYMENT_DATE).Present; bool visible = parentVisible || isFlow; //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: ISet <ExplainKey <IList <ExplainMap> > > nestedListKeys = explainMap.Map.Keys.Where(k => explainMap.get(k).get().GetType().IsAssignableFrom(typeof(System.Collections.IList))).Select(k => (ExplainKey <IList <ExplainMap> >)k).collect(toImmutableSet()); // Populate the base data //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: for (java.util.Map.Entry<com.opengamma.strata.market.explain.ExplainKey<?>, Object> entry : explainMap.getMap().entrySet()) foreach (KeyValuePair <ExplainKey <object>, object> entry in explainMap.Map.entrySet()) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: com.opengamma.strata.market.explain.ExplainKey<?> key = entry.getKey(); ExplainKey <object> key = entry.Key; if (nestedListKeys.Contains(key)) { continue; } if (key.Equals(ExplainKey.FORECAST_VALUE)) { if (hasParentFlow) { // Collapsed rows, so flow must be the same as we already have continue; } else if (isFlow) { // This is first child flow row, so flow is equal to, and replaces, calculated amount currentRow.Remove(INTERIM_AMOUNT_KEY); } } //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: com.opengamma.strata.market.explain.ExplainKey<?> mappedKey = mapKey(key, isFlow); ExplainKey <object> mappedKey = mapKey(key, isFlow); object mappedValue = mapValue(mappedKey, entry.Value, level); if (isFlow) { currentRow[mappedKey] = mappedValue; } else { if (!currentRow.ContainsKey(mappedKey)) { currentRow.Add(mappedKey, mappedValue); } } } // Repeat the inherited entries from the parent row if this row hasn't overridden them INHERITED_KEYS.Where(parentRow.containsKey).ForEach(inheritedKey => currentRow.putIfAbsent(inheritedKey, parentRow[inheritedKey])); if (nestedListKeys.Count > 0) { IList <ExplainMap> nestedListEntries = nestedListKeys.stream().flatMap(k => explainMap.get(k).get().stream()).sorted(this.compareNestedEntries).collect(Collectors.toList()); if (nestedListEntries.Count == 1) { // Soak it up into this row flatten(nestedListEntries[0], visible, currentRow, currentRow, level, accumulator); } else { // Add child rows foreach (ExplainMap nestedListEntry in nestedListEntries) { flatten(nestedListEntry, visible, currentRow, Maps.newHashMap(), level + 1, accumulator); } // Add parent row after child rows (parent flows are a result of the children) if (visible) { accumulator.Add(ExplainMap.of(currentRow)); } } } else { if (visible) { accumulator.Add(ExplainMap.of(currentRow)); } } }