From f3632a1cac52d5c7a820d26a71a975f19b8e1d07 Mon Sep 17 00:00:00 2001 From: Larz White Date: Fri, 12 Feb 2016 09:42:11 -0600 Subject: [PATCH] Switched to using properties for the order and InvervalBegin/IntervalEnd. --- src/Numerics/Integration/GaussLegendreRule.cs | 24 ++++++++++++------- .../IntegrationTests/IntegrationTest.cs | 10 ++++---- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/Numerics/Integration/GaussLegendreRule.cs b/src/Numerics/Integration/GaussLegendreRule.cs index 8ecf8f3c..238a945e 100644 --- a/src/Numerics/Integration/GaussLegendreRule.cs +++ b/src/Numerics/Integration/GaussLegendreRule.cs @@ -74,28 +74,34 @@ namespace MathNet.Numerics.Integration /// /// Getter for the order. /// - /// The order, which defines an Nth order Gauss-Legendre rule. The order also defines the number of abscissas and weights for the rule. - public int GetOrder() + public int Order { - return gaussLegendrePoint.Order; + get + { + return gaussLegendrePoint.Order; + } } /// /// Getter for the InvervalBegin. /// - /// Where the interval starts, inclusive and finite. - public double GetIntervalBegin() + public double IntervalBegin { - return gaussLegendrePoint.IntervalBegin; + get + { + return gaussLegendrePoint.IntervalBegin; + } } /// /// Getter for the InvervalEnd. /// - /// Where the interval stops, inclusive and finite. - public double GetIntervalEnd() + public double IntervalEnd { - return gaussLegendrePoint.IntervalEnd; + get + { + return gaussLegendrePoint.IntervalEnd; + } } /// diff --git a/src/UnitTests/IntegrationTests/IntegrationTest.cs b/src/UnitTests/IntegrationTests/IntegrationTest.cs index 2a6f3fe0..a0bc3dfb 100644 --- a/src/UnitTests/IntegrationTests/IntegrationTest.cs +++ b/src/UnitTests/IntegrationTests/IntegrationTest.cs @@ -273,12 +273,12 @@ namespace MathNet.Numerics.UnitTests.IntegrationTests [TestCase(20)] [TestCase(21)] [TestCase(22)] - public void TestGaussLegendreRuleGetAbscissasGetWeightsGetOrderViaIntegration(int order) + public void TestGaussLegendreRuleGetAbscissasGetWeightsOrderViaIntegration(int order) { GaussLegendreRule gaussLegendre = new GaussLegendreRule(StartA, StopA, order); double appoximateArea = 0; - for (int i = 0; i < gaussLegendre.GetOrder(); i++) + for (int i = 0; i < gaussLegendre.Order; i++) { appoximateArea += gaussLegendre.GetWeight(i) * TargetFunctionA(gaussLegendre.GetAbscissa(i)); } @@ -295,18 +295,18 @@ namespace MathNet.Numerics.UnitTests.IntegrationTests { const int order = 19; GaussLegendreRule gaussLegendre = new GaussLegendreRule(StartA, StopA, order); - Assert.AreEqual(gaussLegendre.GetIntervalBegin(), StartA); + Assert.AreEqual(gaussLegendre.IntervalBegin, StartA); } /// /// Gauss-Legendre rule supports obtaining IntervalEnd. /// [TestCase] - public void TestGaussLegendreRuleGetIntervalEnd() + public void TestGaussLegendreRuleIntervalEnd() { const int order = 19; GaussLegendreRule gaussLegendre = new GaussLegendreRule(StartA, StopA, order); - Assert.AreEqual(gaussLegendre.GetIntervalEnd(), StopA); + Assert.AreEqual(gaussLegendre.IntervalEnd, StopA); } } } \ No newline at end of file