//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void test2()
        public virtual void test2()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray x = com.opengamma.strata.collect.array.DoubleArray.of(1.3423, 0.235);
            DoubleArray x = DoubleArray.of(1.3423, 0.235);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleMatrix anJac = G2.apply(x);
            DoubleMatrix anJac = G2.apply(x);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleMatrix fdFwdJac = FORWARD.differentiate(F2).apply(x);
            DoubleMatrix fdFwdJac = FORWARD.differentiate(F2).apply(x);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleMatrix fdCentGrad = CENTRAL.differentiate(F2).apply(x);
            DoubleMatrix fdCentGrad = CENTRAL.differentiate(F2).apply(x);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleMatrix fdBackGrad = BACKWARD.differentiate(F2).apply(x);
            DoubleMatrix fdBackGrad = BACKWARD.differentiate(F2).apply(x);

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    assertEquals(fdFwdJac.get(i, j), anJac.get(i, j), 10 * EPS);
                    assertEquals(fdCentGrad.get(i, j), anJac.get(i, j), 10 * EPS * EPS);
                    assertEquals(fdBackGrad.get(i, j), anJac.get(i, j), 10 * EPS);
                }
            }
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void test()
        public virtual void test()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray x = com.opengamma.strata.collect.array.DoubleArray.of(.2245, -1.2344);
            DoubleArray x = DoubleArray.of(.2245, -1.2344);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray anGrad = G.apply(x);
            DoubleArray anGrad = G.apply(x);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray fdFwdGrad = FORWARD.differentiate(F).apply(x);
            DoubleArray fdFwdGrad = FORWARD.differentiate(F).apply(x);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray fdCentGrad = CENTRAL.differentiate(F).apply(x);
            DoubleArray fdCentGrad = CENTRAL.differentiate(F).apply(x);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray fdBackGrad = BACKWARD.differentiate(F).apply(x);
            DoubleArray fdBackGrad = BACKWARD.differentiate(F).apply(x);

            for (int i = 0; i < 2; i++)
            {
                assertEquals(fdFwdGrad.get(i), anGrad.get(i), 10 * EPS);
                assertEquals(fdCentGrad.get(i), anGrad.get(i), EPS * EPS);
                assertEquals(fdBackGrad.get(i), anGrad.get(i), 10 * EPS);
            }
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testNormal()
        public virtual void testNormal()
        {
            assertEquals(SAMPLE_VARIANCE.apply(NORMAL_DATA), STD * STD, EPS);
            assertEquals(POPULATION_VARIANCE.apply(NORMAL_DATA), STD * STD, EPS);
            assertEquals(SAMPLE_STD.apply(NORMAL_DATA), STD, EPS);
            assertEquals(POPULATION_STD.apply(NORMAL_DATA), STD, EPS);
            assertEquals(SAMPLE_SKEWNESS.apply(NORMAL_DATA), 0.0, EPS);
            assertEquals(SAMPLE_FISHER_KURTOSIS.apply(NORMAL_DATA), 0.0, EPS);
        }
コード例 #4
0
        //-------------------------------------------------------------------------
        private double[] bracketRoot(double optionPrice, double sigma)
        {
            BracketRoot bracketer = new BracketRoot();

            System.Func <double, double> func = (double?volatility) =>
            {
                return(priceFunc.apply(volatility) / optionPrice - 1.0);
            };
            return(bracketer.getBracketedPoints(func, Math.Max(0.0, sigma - BRACKET_STEP), sigma + BRACKET_STEP, 0d, double.PositiveInfinity));
        }
コード例 #5
0
            public override IEnumerable <string> KeySet()
            {
                IList <string> keys = SizeConflict >= 0 ? new List <string>(SizeConflict) : new List <string>();

                Foreach((key, value) =>
                {
                    if (Filter.apply(key, value))
                    {
                        keys.Add(key);
                    }
                });

                return(keys);
            }
コード例 #6
0
        private string GetName(Element procedure)
        {
            T annotation = procedure.getAnnotation(_annotationType);
            Optional <string> customName = _customNameExtractor.apply(annotation);

            return(customName.orElse(DefaultQualifiedName(procedure)));
        }
コード例 #7
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: protected void assertYieldCurveBootstrap(final com.opengamma.strata.math.impl.rootfinding.VectorRootFinder rootFinder, final double eps)
        protected internal virtual void assertYieldCurveBootstrap(VectorRootFinder rootFinder, double eps)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int n = TIME_GRID.length;
            int n = TIME_GRID.Length;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[] flatCurve = new double[n];
            double[] flatCurve = new double[n];
            for (int i = 0; i < n; i++)
            {
                flatCurve[i] = 0.05;
            }
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray x0 = com.opengamma.strata.collect.array.DoubleArray.copyOf(flatCurve);
            DoubleArray x0 = DoubleArray.copyOf(flatCurve);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray x1 = rootFinder.getRoot(SWAP_RATES, x0);
            DoubleArray x1 = rootFinder.getRoot(SWAP_RATES, x0);

            for (int i = 0; i < n; i++)
            {
                assertEquals(-Math.Log(DUMMY_YIELD_CURVE.apply(TIME_GRID[i])) / TIME_GRID[i], x1.get(i), eps);
            }
        }
コード例 #8
0
        public CurrencyParameterSensitivities sensitivities(T trade, RatesProvider provider)
        {
            PointSensitivities             pts = sensitivityFn.apply(trade, provider);
            CurrencyParameterSensitivities ps  = provider.parameterSensitivity(pts);

            return(MQC.sensitivity(ps, provider));
        }
コード例 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void test()
        public virtual void test()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double x = RANDOM.nextDouble();
            double x = RANDOM.NextDouble();

            assertEquals(Math.Log(GAMMA.applyAsDouble(x)), LN_GAMMA.apply(x), EPS);
        }
コード例 #10
0
        /// <summary>
        /// {@inheritDoc}
        /// The inverse cdf is given by:
        /// $$
        /// \begin{align*}
        /// F(P) &= \mathrm{sign}(p - \frac{1}{2})\sqrt{\frac{\nu}{x - 1}}\\
        /// x &= B(2 \min(p, 1-p))
        /// \end{align*}
        /// $$
        /// where $B$ is the inverse incomplete Beta function (<seealso cref="InverseIncompleteBetaFunction"/>).
        /// </summary>
        public virtual double getInverseCDF(double?p)
        {
            ArgChecker.notNull(p, "p");
            ArgChecker.isTrue(p >= 0 && p <= 1, "Probability must be >= 0 and <= 1");
            double x = _beta.apply(2 * Math.Min(p, 1 - p));

            return(Math.Sign(p - 0.5) * Math.Sqrt(_degFreedom * (1.0 / x - 1)));
        }
コード例 #11
0
 public override bool Process <T1>(ISet <T1> annotations, RoundEnvironment roundEnv) where T1 : javax.lang.model.element.TypeElement
 {
     ProcessElements(roundEnv);
     if (roundEnv.processingOver())
     {
         _duplicationValidator.apply(_visitedElements).forEach(_messagePrinter.print);
     }
     return(false);
 }
コード例 #12
0
        //-------------------------------------------------------------------------
        public virtual void test_values()
        {
            ParameterizedFunctionalCurve test = ParameterizedFunctionalCurve.of(METADATA, PARAMETERS, VALUE_FUNCTION, DERIVATIVE_FUNCTION, SENSITIVITY_FUNCTION);
            double x = 5.2;

            assertEquals(test.yValue(x), VALUE_FUNCTION.apply(PARAMETERS, x));
            assertEquals(test.firstDerivative(x), DERIVATIVE_FUNCTION.apply(PARAMETERS, x));
            assertEquals(test.yValueParameterSensitivity(x), UnitParameterSensitivity.of(METADATA.CurveName, METADATA.ParameterMetadata.get(), SENSITIVITY_FUNCTION.apply(PARAMETERS, x)));
        }
コード例 #13
0
 internal override Value AsValue(GenericKey state)
 {
     T[] array = _arrayCreator.apply(state.ArrayLength);
     for (int i = 0; i < state.ArrayLength; i++)
     {
         array[i] = _valueFactory.from(state, i);
     }
     return(Values.of(array));
 }
コード例 #14
0
        public override void Init(ProcessingEnvironment processingEnv)
        {
            lock (this)
            {
                base.Init(processingEnv);

                _messagePrinter       = new MessagePrinter(processingEnv.Messager);
                _duplicationValidator = new DuplicatedExtensionValidator <ICollection <Element>, Stream <CompilationMessage> >(processingEnv.ElementUtils, _supportedAnnotationType, _customNameFunction);
                _visitor = _visitorSupplier.apply(processingEnv);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void test()
        public virtual void test()
        {
            double      a     = 2.3;
            double      theta = 0.34;
            DoubleArray x     = DoubleArray.of(a, theta);

            VectorFieldSecondOrderDifferentiator fd = new VectorFieldSecondOrderDifferentiator();

            System.Func <DoubleArray, DoubleMatrix[]> fdFuncs = fd.differentiate(FUNC);
            DoubleMatrix[] fdValues = fdFuncs(x);

            DoubleMatrix t1 = DW1.apply(x);
            DoubleMatrix t2 = DW2.apply(x);

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    assertEquals("first observation " + i + " " + j, t1.get(i, j), fdValues[0].get(i, j), 1e-6);
                    assertEquals("second observation " + i + " " + j, t2.get(i, j), fdValues[1].get(i, j), 1e-6);
                }
            }
        }
コード例 #16
0
        public virtual ProtocolSelection <U, T> GetAll(Org.Neo4j.causalclustering.protocol.Protocol_Category <T> category, ICollection <U> versions)
        {
//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:
            ISet <U> selectedVersions = _protocolMap.SetOfKeyValuePairs().Select(DictionaryEntry.getKey).Where(pair => pair.first().Equals(category.CanonicalName())).Select(Pair::other).Where(version => versions.Count == 0 || versions.Contains(version)).collect(Collectors.toSet());

            if (selectedVersions.Count == 0)
            {
                throw new System.ArgumentException(string.Format("Attempted to select protocols for {0} versions {1} but no match in known protocols {2}", category, versions, _protocolMap));
            }
            else
            {
                return(_protocolSelectionFactory.apply(category.CanonicalName(), selectedVersions));
            }
        }
コード例 #17
0
        public override double?apply(double[] x)
        {
            ArgChecker.notNull(x, "x");
            ArgChecker.isTrue(x.Length >= 3, "Need at least three points to calculate sample skewness");
            double sum      = 0;
            double variance = 0;
            double mean     = MEAN.apply(x);

            foreach (double d in x)
            {
                double diff = d - mean;
                variance += diff * diff;
                sum      += diff * diff * diff;
            }
            int n = x.Length;

            variance /= n - 1;
            return(Math.Sqrt(n - 1.0) * sum / (Math.Pow(variance, 1.5) * Math.Sqrt(n) * (n - 2)));
        }
コード例 #18
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public java.util.Optional<org.neo4j.internal.kernel.api.procs.DefaultParameterValue> defaultValue(org.neo4j.procedure.Name parameter) throws org.neo4j.internal.kernel.api.exceptions.ProcedureException
            public Optional <DefaultParameterValue> DefaultValue(Name parameter)
            {
                string defaultValue = parameter.defaultValue();

                if (defaultValue.Equals(Name.DEFAULT_VALUE))
                {
                    return(null);
                }
                else
                {
                    try
                    {
                        return(Parser.apply(defaultValue));
                    }
                    catch (Exception)
                    {
                        throw new ProcedureException(Org.Neo4j.Kernel.Api.Exceptions.Status_Procedure.ProcedureRegistrationFailed, "Default value `%s` could not be parsed as a %s", parameter.defaultValue(), JavaClass.Name);
                    }
                }
            }
コード例 #19
0
        public virtual Stream <CompilationMessage> ValidateName(ExecutableElement method)
        {
            Optional <string> customName = _customNameExtractor.apply(method.getAnnotation(_annotationType));

            if (customName.Present)
            {
                if (IsInRootNamespace(customName.get()))
                {
                    return(Stream.of(RootNamespaceError(method, customName.get())));
                }
                return(Stream.empty());
            }

            PackageElement @namespace = _elements.getPackageOf(method);

            if (@namespace == null)
            {
                return(Stream.of(RootNamespaceError(method)));
            }
            return(Stream.empty());
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void test()
        public virtual void test()
        {
            System.Func <DoubleArray, DoubleMatrix[]> analDiffFunc = DIFF.differentiate(F);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.collect.array.DoubleArray x = com.opengamma.strata.collect.array.DoubleArray.of(1.3423, 0.235);
            DoubleArray x = DoubleArray.of(1.3423, 0.235);

            DoubleMatrix[] alRes = analDiffFunc(x);
            DoubleMatrix[] fdRes = G.apply(x);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int p = fdRes.length;
            int p = fdRes.Length;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int n = fdRes[0].rowCount();
            int n = fdRes[0].rowCount();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int m = fdRes[0].columnCount();
            int m = fdRes[0].columnCount();

            assertEquals(p, alRes.Length);
            assertEquals(n, alRes[0].rowCount());
            assertEquals(m, alRes[0].columnCount());

            for (int k = 0; k < p; k++)
            {
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < m; j++)
                    {
                        assertEquals(fdRes[k].get(i, j), alRes[k].get(i, j), 1e-8);
                    }
                }
            }
        }
コード例 #21
0
 public override double?apply(double[] x)
 {
     ArgChecker.notNull(x, "x");
     ArgChecker.isTrue(x.Length >= 2, "Need at least two points to calculate standard deviation");
     return(Math.Sqrt(VARIANCE.apply(x)));
 }
コード例 #22
0
 internal virtual string Describe()
 {
     return(Descriptor.apply(Entity));
 }
コード例 #23
0
 public virtual void AvailableMember(MemberIsAvailable memberIsAvailable)
 {
     AvailableMembers = asList(NextSnapshotFunction.apply(AvailableMembers, memberIsAvailable));
 }
コード例 #24
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testLimits()
        public virtual void testLimits()
        {
            assertEquals(FUNCTION.apply(0.0), 0, EPS);
            assertEquals(FUNCTION.apply(100.0), 1, EPS);
        }
コード例 #25
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void testNullArray()
        public virtual void testNullArray()
        {
            GEOMETRIC.apply(null);
        }
コード例 #26
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void test()
        public virtual void test()
        {
            assertEquals(GEOMETRIC.apply(FLAT), 2, 0);
            assertEquals(GEOMETRIC.apply(X), Math.Exp(ARITHMETIC.apply(LN_X)), 1e-15);
        }
コード例 #27
0
ファイル: ScopeAwareSetting.cs プロジェクト: Neo4Net/Neo4Net
 public override string Name()
 {
     return(_scopingRule.apply(ProvideName()));
 }
コード例 #28
0
        static GeneralizedLeastSquareTest()
        {
            SIN_FUNCTIONS = new List <>();
            for (int i = 0; i < WEIGHTS.Length; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int k = i;
                int k = i;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.function.Function<double, double> func = new java.util.function.Function<double, double>()
                System.Func <double, double> func = (final double?x) =>
                {
                    return(Math.Sin((2 * k + 1) * x));
                };
                SIN_FUNCTIONS.Add(func);
            }
            TEST_FUNCTION = new BasisFunctionAggregation <>(SIN_FUNCTIONS, WEIGHTS);

            VECTOR_TRIG_FUNCTIONS = new List <>();
            for (int i = 0; i < WEIGHTS.Length; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int k = i;
                int k = i;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.function.Function<com.opengamma.strata.collect.array.DoubleArray, double> func = new java.util.function.Function<com.opengamma.strata.collect.array.DoubleArray, double>()
                System.Func <DoubleArray, double> func = (final DoubleArray x) =>
                {
                    ArgChecker.isTrue(x.size() == 2);
                    return(Math.Sin((2 * k + 1) * x.get(0)) * Math.Cos((2 * k + 1) * x.get(1)));
                };
                VECTOR_TRIG_FUNCTIONS.Add(func);
            }
            VECTOR_TEST_FUNCTION = new BasisFunctionAggregation <>(VECTOR_TRIG_FUNCTIONS, WEIGHTS);

            SIN_EXP_FUNCTION = (final double[] x) =>
            {
                return(Math.Sin(Math.PI * x[0] / 10.0) * Math.Exp(-x[1] / 5.0));
            };

            const int n = 10;

            X          = new double?[n];
            Y          = new double[n];
            SIGMA      = new double[n];
            X_TRIG     = new List <>();
            Y_TRIG     = new List <>();
            SIGMA_TRIG = new List <>();
            for (int i = 0; i < n; i++)
            {
                X[i] = i / 5.0;
                Y[i] = TEST_FUNCTION.apply(X[i]);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[] temp = new double[2];
                double[] temp = new double[2];
                temp[0] = 2.0 * RANDOM.NextDouble();
                temp[1] = 2.0 * RANDOM.NextDouble();
                X_TRIG.Add(DoubleArray.copyOf(temp));
                Y_TRIG.Add(VECTOR_TEST_FUNCTION.apply(X_TRIG[i]));
                SIGMA[i] = 0.01;
                SIGMA_TRIG.Add(0.01);
            }

            SIGMA_COS_EXP = new List <>();
            X_SIN_EXP     = new List <>();
            Y_SIN_EXP     = new List <>();
            for (int i = 0; i < 20; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[] temp = new double[2];
                double[] temp = new double[2];
                temp[0] = 10.0 * RANDOM.NextDouble();
                temp[1] = 10.0 * RANDOM.NextDouble();
                X_SIN_EXP.Add(temp);
                Y_SIN_EXP.Add(SIN_EXP_FUNCTION.apply(X_SIN_EXP[i]));
                SIGMA_COS_EXP.Add(0.01);
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.opengamma.strata.math.impl.interpolation.BasisFunctionGenerator generator = new com.opengamma.strata.math.impl.interpolation.BasisFunctionGenerator();
            BasisFunctionGenerator generator = new BasisFunctionGenerator();

            BASIS_FUNCTIONS = generator.generateSet(BasisFunctionKnots.fromUniform(0.0, 2.0, 20, 3));
            BasisFunctionKnots[] knots = new BasisFunctionKnots[2];
            knots[0]           = BasisFunctionKnots.fromUniform(0, 10, 10, 3);
            knots[1]           = BasisFunctionKnots.fromUniform(0, 10, 10, 3);
            BASIS_FUNCTIONS_2D = generator.generateSet(knots);
        }
コード例 #29
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override protected Logger getBulkLogger(@Nonnull PrintWriter out, @Nonnull Object lock)
        protected internal override Logger GetBulkLogger(PrintWriter @out, object @lock)
        {
            return(new FormattedLogger(_formattedLog, Suppliers.singleton(@out), _prefix, DateTimeFormatter, () => DefaultCurrentDateTime.apply(_formattedLog.zoneId)));
        }
コード例 #30
0
        /// <summary>
        /// Inserts a bunch of new nodes with the label and property key currently set in the fields in this class, where
        /// running this method twice will insert nodes with duplicate property values, assuming property key or label has
        /// not changed.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: private org.neo4j.test.OtherThreadExecutor.WorkerCommand<Object,int> performInserts(final HighlyAvailableGraphDatabase slave, final boolean constraintCompliant)
        private WorkerCommand <object, int> PerformInserts(HighlyAvailableGraphDatabase slave, bool constraintCompliant)
        {
            return(state =>
            {
                int i = 0;

                try
                {
                    for ( ; i < 100; i++)
                    {
                        using (Transaction tx = slave.BeginTx())
                        {
                            ConstraintOps.createEntity(slave, _labelOrRelType, _property, ValueGenerator.apply(i), constraintCompliant);
                            tx.success();
                        }
                    }
                }
                catch (Exception e) when(e is TransactionFailureException || e is TransientTransactionFailureException || e is ComException || e is ConstraintViolationException)
                {
                    // TransactionFailureException and TransientTransactionFailureException
                    //   Swallowed on purpose, we except it to fail sometimes due to either
                    //    - constraint violation on master
                    //    - concurrent schema operation on master

                    // ConstraintViolationException
                    //   Constraint violation detected on slave while building transaction

                    // ComException
                    //   Happens sometimes, cause:
                    //   - The lock session requested to start is already in use.
                    //     Please retry your request in a few seconds.
                }
                return i;
            });
        }