lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [38/58] lucenenet git commit: QueryParser.Flexible refactor: Made TimeZone into a public property of NumberDateFormat rather than a constructor parameter
Date Tue, 06 Dec 2016 15:12:13 GMT
QueryParser.Flexible refactor: Made TimeZone into a public property of NumberDateFormat rather
than a constructor parameter


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/07007472
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/07007472
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/07007472

Branch: refs/heads/master
Commit: 07007472c5f1b1ad2601a361952e9eeadb063c6f
Parents: 70725ed
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Mon Dec 5 20:10:32 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Dec 5 20:13:47 2016 +0700

----------------------------------------------------------------------
 .../Flexible/Standard/Config/NumberDateFormat.cs         | 11 ++++++++---
 .../Flexible/Standard/TestNumericQueryParser.cs          |  5 ++++-
 2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/07007472/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumberDateFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumberDateFormat.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumberDateFormat.cs
index f1f1589..55f222e 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumberDateFormat.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumberDateFormat.cs
@@ -45,7 +45,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Config
         private readonly string dateFormat;
         private readonly DateFormat dateStyle;
         private readonly DateFormat timeStyle;
-        private readonly TimeZoneInfo timeZone;
+        private TimeZoneInfo timeZone = TimeZoneInfo.Local;
 
         /**
          * Constructs a {@link NumberDateFormat} object using the given {@link DateFormat}.
@@ -58,12 +58,17 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Config
             this.dateFormat = dateFormat;
         }
 
-        public NumberDateFormat(DateFormat dateStyle, DateFormat timeStyle, CultureInfo locale,
TimeZoneInfo timeZone)
+        public NumberDateFormat(DateFormat dateStyle, DateFormat timeStyle, CultureInfo locale)
             : base(locale)
         {
             this.dateStyle = dateStyle;
             this.timeStyle = timeStyle;
-            this.timeZone = timeZone;
+        }
+
+        public virtual TimeZoneInfo TimeZone
+        {
+            get { return this.timeZone; }
+            set { this.timeZone = value; }
         }
 
         public override string Format(double number)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/07007472/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
index 8f1c4dc..3c1e220 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
@@ -110,7 +110,10 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 //dateFormat.applyPattern(dateFormat.toPattern() + " G s Z yyyy");
                 //dateFormat.setTimeZone(TIMEZONE);
 
-                DATE_FORMAT = new NumberDateFormat(DATE_STYLE, TIME_STYLE, LOCALE, TIMEZONE);
+                DATE_FORMAT = new NumberDateFormat(DATE_STYLE, TIME_STYLE, LOCALE)
+                {
+                    TimeZone = TIMEZONE
+                };
                 dateFormat = DATE_FORMAT.GetDateFormat();
 
                 do


Mime
View raw message