Lucene.Net.Tests.Analysis.Common: Deleted unused files DateTimeHelperClass.cs, HashMapHelperClass.cs, and StringHelperClass.cs
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/4e4177d8 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/4e4177d8 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/4e4177d8 Branch: refs/heads/api-work Commit: 4e4177d81017cb0c2bd014e6140481694ca9761f Parents: 658afaa Author: Shad Storhaug <[email protected]> Authored: Sat Apr 15 20:50:40 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Sat Apr 15 20:50:40 2017 +0700 ---------------------------------------------------------------------- .../DateTimeHelperClass.cs | 15 ---- .../HashMapHelperClass.cs | 26 ------ .../StringHelperClass.cs | 90 -------------------- .../project.json | 8 -- 4 files changed, 139 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4e4177d8/src/Lucene.Net.Tests.Analysis.Common/DateTimeHelperClass.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Analysis.Common/DateTimeHelperClass.cs b/src/Lucene.Net.Tests.Analysis.Common/DateTimeHelperClass.cs deleted file mode 100644 index 0bd49c4..0000000 --- a/src/Lucene.Net.Tests.Analysis.Common/DateTimeHelperClass.cs +++ /dev/null @@ -1,15 +0,0 @@ -//--------------------------------------------------------------------------------------------------------- -// Copyright © 2007 - 2015 Tangible Software Solutions Inc. -// This class can be used by anyone provided that the copyright notice remains intact. -// -// This class is used to replace calls to Java's System.currentTimeMillis with the C# equivalent. -// Unix time is defined as the number of seconds that have elapsed since midnight UTC, 1 January 1970. -//--------------------------------------------------------------------------------------------------------- -internal static class DateTimeHelperClass -{ - private static readonly System.DateTime Jan1st1970 = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc); - internal static long CurrentUnixTimeMillis() - { - return (long)(System.DateTime.UtcNow - Jan1st1970).TotalMilliseconds; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4e4177d8/src/Lucene.Net.Tests.Analysis.Common/HashMapHelperClass.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Analysis.Common/HashMapHelperClass.cs b/src/Lucene.Net.Tests.Analysis.Common/HashMapHelperClass.cs deleted file mode 100644 index 0c925be..0000000 --- a/src/Lucene.Net.Tests.Analysis.Common/HashMapHelperClass.cs +++ /dev/null @@ -1,26 +0,0 @@ -//--------------------------------------------------------------------------------------------------------- -// Copyright © 2007 - 2015 Tangible Software Solutions Inc. -// This class can be used by anyone provided that the copyright notice remains intact. -// -// This class is used to replace calls to some Java HashMap or Hashtable methods. -//--------------------------------------------------------------------------------------------------------- -using System.Collections.Generic; -internal static class HashMapHelperClass -{ - internal static HashSet<KeyValuePair<TKey, TValue>> SetOfKeyValuePairs<TKey, TValue>(this IDictionary<TKey, TValue> dictionary) - { - HashSet<KeyValuePair<TKey, TValue>> entries = new HashSet<KeyValuePair<TKey, TValue>>(); - foreach (KeyValuePair<TKey, TValue> keyValuePair in dictionary) - { - entries.Add(keyValuePair); - } - return entries; - } - - internal static TValue GetValueOrNull<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) - { - TValue ret; - dictionary.TryGetValue(key, out ret); - return ret; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4e4177d8/src/Lucene.Net.Tests.Analysis.Common/StringHelperClass.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Analysis.Common/StringHelperClass.cs b/src/Lucene.Net.Tests.Analysis.Common/StringHelperClass.cs deleted file mode 100644 index 3bcece0..0000000 --- a/src/Lucene.Net.Tests.Analysis.Common/StringHelperClass.cs +++ /dev/null @@ -1,90 +0,0 @@ -//------------------------------------------------------------------------------------------- -// Copyright © 2007 - 2015 Tangible Software Solutions Inc. -// This class can be used by anyone provided that the copyright notice remains intact. -// -// This class is used to convert some aspects of the Java String class. -//------------------------------------------------------------------------------------------- -internal static class StringHelperClass -{ - //---------------------------------------------------------------------------------- - // This method replaces the Java String.substring method when 'start' is a - // method call or calculated value to ensure that 'start' is obtained just once. - //---------------------------------------------------------------------------------- - internal static string SubstringSpecial(this string self, int start, int end) - { - return self.Substring(start, end - start); - } - - //------------------------------------------------------------------------------------ - // This method is used to replace calls to the 2-arg Java String.startsWith method. - //------------------------------------------------------------------------------------ - internal static bool StartsWith(this string self, string prefix, int toffset) - { - return self.IndexOf(prefix, toffset, System.StringComparison.Ordinal) == toffset; - } - - //------------------------------------------------------------------------------ - // This method is used to replace most calls to the Java String.split method. - //------------------------------------------------------------------------------ - internal static string[] Split(this string self, string regexDelimiter, bool trimTrailingEmptyStrings) - { - string[] splitArray = System.Text.RegularExpressions.Regex.Split(self, regexDelimiter); - - if (trimTrailingEmptyStrings) - { - if (splitArray.Length > 1) - { - for (int i = splitArray.Length; i > 0; i--) - { - if (splitArray[i - 1].Length > 0) - { - if (i < splitArray.Length) - System.Array.Resize(ref splitArray, i); - - break; - } - } - } - } - - return splitArray; - } - - //----------------------------------------------------------------------------- - // These methods are used to replace calls to some Java String constructors. - //----------------------------------------------------------------------------- - internal static string NewString(sbyte[] bytes) - { - return NewString(bytes, 0, bytes.Length); - } - internal static string NewString(sbyte[] bytes, int index, int count) - { - return System.Text.Encoding.UTF8.GetString((byte[])(object)bytes, index, count); - } - internal static string NewString(sbyte[] bytes, string encoding) - { - return NewString(bytes, 0, bytes.Length, encoding); - } - internal static string NewString(sbyte[] bytes, int index, int count, string encoding) - { - return System.Text.Encoding.GetEncoding(encoding).GetString((byte[])(object)bytes, index, count); - } - - //-------------------------------------------------------------------------------- - // These methods are used to replace calls to the Java String.getBytes methods. - //-------------------------------------------------------------------------------- - internal static sbyte[] GetBytes(this string self) - { - return GetSBytesForEncoding(System.Text.Encoding.UTF8, self); - } - internal static sbyte[] GetBytes(this string self, string encoding) - { - return GetSBytesForEncoding(System.Text.Encoding.GetEncoding(encoding), self); - } - private static sbyte[] GetSBytesForEncoding(System.Text.Encoding encoding, string s) - { - sbyte[] sbytes = new sbyte[encoding.GetByteCount(s)]; - encoding.GetBytes(s, 0, s.Length, (byte[])(object)sbytes, 0); - return sbytes; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4e4177d8/src/Lucene.Net.Tests.Analysis.Common/project.json ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Analysis.Common/project.json b/src/Lucene.Net.Tests.Analysis.Common/project.json index de74c5d..69094f5 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/project.json +++ b/src/Lucene.Net.Tests.Analysis.Common/project.json @@ -19,9 +19,6 @@ "../CommonAssemblyInfo.cs" ], "excludeFiles": [ - "DateTimeHelperClass.cs", - "HashMapHelperClass.cs", - "StringHelperClass.cs", "Support/TestApiConsistency.cs" ] }, @@ -125,11 +122,6 @@ "compile": { "includeFiles": [ "../CommonAssemblyInfo.cs" - ], - "excludeFiles": [ - "DateTimeHelperClass.cs", - "HashMapHelperClass.cs", - "StringHelperClass.cs" ] }, "embed": {
