示例#1
0
        public virtual void of_map()
        {
            CalculationFunctions test = CalculationFunctions.of(ImmutableMap.of(typeof(TestTarget), TARGET));

            assertEquals(test.getFunction(new TestTarget()), TARGET);
            assertEquals(test.findFunction(new TestTarget()), TARGET);
        }
示例#2
0
        public virtual void of_list()
        {
            CalculationFunctions test = CalculationFunctions.of(ImmutableList.of(TARGET));

            assertEquals(test.getFunction(new TestTarget()), TARGET);
            assertEquals(test.findFunction(new TestTarget()), TARGET);
        }
示例#3
0
        public virtual void of_array()
        {
            CalculationFunctions test = CalculationFunctions.of(TARGET);

            assertEquals(test.getFunction(new TestTarget()), TARGET);
            assertEquals(test.findFunction(new TestTarget()), TARGET);
        }
示例#4
0
        public virtual void empty()
        {
            CalculationFunctions test = CalculationFunctions.empty();

            assertEquals(test.getFunction(new TestTarget()).supportedMeasures().size(), 0);
            assertEquals(test.findFunction(new TestTarget()), null);
        }
示例#5
0
        // determine the available measures
        internal static IList <string> measureNames(CalculationTarget target, CalculationFunctions calculationFunctions)
        {
            ISet <Measure> validMeasures = calculationFunctions.findFunction(target).map(fn => fn.supportedMeasures()).orElse(ImmutableSet.of());

//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            return(validMeasures.Select(Measure::getName).OrderBy(c => c).collect(toImmutableList()));
        }
示例#6
0
//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the Java 'super' constraint:
//ORIGINAL LINE: @Override public <T extends com.opengamma.strata.basics.CalculationTarget> java.util.Optional<CalculationFunction<? super T>> findFunction(T target)
        public Optional <CalculationFunction> findFunction <T>(T target) where T : com.opengamma.strata.basics.CalculationTarget
        {
//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the Java 'super' constraint:
//ORIGINAL LINE: java.util.Optional<CalculationFunction<? super T>> function = functions1.findFunction(target);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
            Optional <CalculationFunction> function = functions1.findFunction(target);

            return(function.Present ? function : functions2.findFunction(target));
        }