コード例 #1
0
        public void ValidateMatrixFactoryParse()
        {
            denseMatObj = GetDenseMatrix();

            MatrixFactory<String, String, Double> mfObj =
                MatrixFactory<String, String, Double>.GetInstance();

            ParallelOptions poObj = new ParallelOptions();

            TryParseMatrixDelegate<string, string, double> a =
                new TryParseMatrixDelegate<string, string, double>(this.TryParseMatrix);
            mfObj.RegisterMatrixParser(a);
            // Writes the text file
            denseMatObj.WritePaddedDouble(Constants.FastQTempTxtFileName, poObj);

            Matrix<string, string, double> newMatObj =
                mfObj.Parse(Constants.FastQTempTxtFileName, double.NaN, poObj);

            Assert.AreEqual(denseMatObj.RowCount, newMatObj.RowCount);
            Assert.AreEqual(denseMatObj.RowKeys.Count, newMatObj.RowKeys.Count);
            Assert.AreEqual(denseMatObj.ColCount, newMatObj.ColCount);
            Assert.AreEqual(denseMatObj.ColKeys.Count, newMatObj.ColKeys.Count);
            Assert.AreEqual(denseMatObj.Values.Count(), newMatObj.Values.Count());

            ApplicationLog.WriteLine(
                "MatrixFactory BVT : Successfully validated Parse() method");
        }
コード例 #2
0
        public void ValidateMatrixFactoryParse()
        {
            _denseMatObj = GetDenseMatrix();

            MatrixFactory <String, String, Double> mfObj =
                MatrixFactory <String, String, Double> .GetInstance();

            ParallelOptions poObj = new ParallelOptions();

            TryParseMatrixDelegate <string, string, double> a =
                new TryParseMatrixDelegate <string, string, double>(this.TryParseMatrix);

            mfObj.RegisterMatrixParser(a);
            // Writes the text file
            _denseMatObj.WritePaddedDouble(Constants.FastQTempTxtFileName, poObj);

            Matrix <string, string, double> newMatObj =
                mfObj.Parse(Constants.FastQTempTxtFileName, double.NaN, poObj);

            Assert.AreEqual(_denseMatObj.RowCount, newMatObj.RowCount);
            Assert.AreEqual(_denseMatObj.RowKeys.Count, newMatObj.RowKeys.Count);
            Assert.AreEqual(_denseMatObj.ColCount, newMatObj.ColCount);
            Assert.AreEqual(_denseMatObj.ColKeys.Count, newMatObj.ColKeys.Count);
            Assert.AreEqual(_denseMatObj.Values.Count(), newMatObj.Values.Count());

            Console.WriteLine(
                "MatrixFactory BVT : Successfully validated Parse() method");
            ApplicationLog.WriteLine(
                "MatrixFactory BVT : Successfully validated Parse() method");
        }
コード例 #3
0
        public void ValidateMatrixFactoryRegisterMatrixParser()
        {
            MatrixFactory<String, String, Double> mfactObj =
                MatrixFactory<String, String, Double>.GetInstance();

            TryParseMatrixDelegate<string, string, double> tryParseDelObj =
                new TryParseMatrixDelegate<string, string, double>(TryParseMatrix);

            mfactObj.RegisterMatrixParser(tryParseDelObj);
            Assert.IsTrue(true,
                "No exceptions were thrown on running RegisterMatrixParser() method");
        }
コード例 #4
0
        public void ValidateMatrixFactoryRegisterMatrixParser()
        {
            MatrixFactory <String, String, Double> mfactObj =
                MatrixFactory <String, String, Double> .GetInstance();

            TryParseMatrixDelegate <string, string, double> tryParseDelObj =
                new TryParseMatrixDelegate <string, string, double>(TryParseMatrix);

            mfactObj.RegisterMatrixParser(tryParseDelObj);
            Assert.IsTrue(true,
                          "No exceptions were thrown on running RegisterMatrixParser() method");
        }
コード例 #5
0
 /// <summary>
 /// Adds the specificed parsing function to the MatrixFactory
 /// </summary>
 /// <param name="tryParseMatrixDelegate">The function to add.</param>
 public void RegisterMatrixParser(TryParseMatrixDelegate <TRowKey, TColKey, TValue> tryParseMatrixDelegate)
 {
     _registeredParsers.Add(tryParseMatrixDelegate);
 }
コード例 #6
0
 /// </summary>
 /// <param name="tryParseMatrixDelegate">The function to add.</param>
 public void RegisterMatrixParser(TryParseMatrixDelegate <TRowKey, TColKey, TValue> tryParseMatrixDelegate)
 {
     /// <summary>
     /// Adds the specificed parsing function to the MatrixFactory
     _registeredParsers.Add(tryParseMatrixDelegate);
 }