Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 842D3200C75 for ; Sun, 30 Apr 2017 23:55:46 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 82EE1160BA4; Sun, 30 Apr 2017 21:55:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2C52B160BC0 for ; Sun, 30 Apr 2017 23:55:44 +0200 (CEST) Received: (qmail 37802 invoked by uid 500); 30 Apr 2017 21:55:42 -0000 Mailing-List: contact commits-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucenenet.apache.org Delivered-To: mailing list commits@lucenenet.apache.org Received: (qmail 36765 invoked by uid 99); 30 Apr 2017 21:55:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Apr 2017 21:55:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 891FDE0005; Sun, 30 Apr 2017 21:55:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: nightowl888@apache.org To: commits@lucenenet.apache.org Date: Sun, 30 Apr 2017 21:56:11 -0000 Message-Id: <1d0961e0372e40118a63c53ddfa4c118@git.apache.org> In-Reply-To: <1522625dd0a844d99786bb56b30921dd@git.apache.org> References: <1522625dd0a844d99786bb56b30921dd@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [32/45] lucenenet git commit: SWEEP: Consolidated all RectangularArrays calls to a static generic method in Lucene.Net.Support archived-at: Sun, 30 Apr 2017 21:55:46 -0000 SWEEP: Consolidated all RectangularArrays calls to a static generic method in Lucene.Net.Support Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/609ce6db Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/609ce6db Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/609ce6db Branch: refs/heads/master Commit: 609ce6dbb0cf5ce97bb1cb2b818083ab1011fd91 Parents: fd338f6 Author: Shad Storhaug Authored: Sat Apr 29 16:48:19 2017 +0700 Committer: Shad Storhaug Committed: Mon May 1 04:48:35 2017 +0700 ---------------------------------------------------------------------- .../Egothor.Stemmer/Diff.cs | 7 +- .../Lucene.Net.Analysis.Stempel.csproj | 6 +- .../RectangularArrays.cs | 52 -------------- src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj | 8 +-- .../Memory/FSTOrdTermsReader.cs | 2 +- src/Lucene.Net.Codecs/RectangularArrays.cs | 29 -------- .../Lucene.Net.Highlighter.csproj | 6 +- .../PostingsHighlight/PostingsHighlighter.cs | 2 +- src/Lucene.Net.Highlighter/RectangularArrays.cs | 29 -------- .../Spell/LuceneLevenshteinDistance.cs | 23 +----- .../TestPostingsHighlighter.cs | 2 +- .../SimpleFragmentsBuilderTest.cs | 2 +- .../Suggest/Analyzing/FuzzySuggesterTest.cs | 22 +----- .../Index/TestConsistentFieldNumbers.cs | 2 +- src/Lucene.Net.Tests/Lucene.Net.Tests.csproj | 3 - src/Lucene.Net.Tests/RectangularArrays.cs | 73 -------------------- src/Lucene.Net.Tests/Search/TestFieldCache.cs | 2 +- .../Util/Automaton/TestLevenshteinAutomata.cs | 3 +- src/Lucene.Net/Lucene.Net.csproj | 1 + src/Lucene.Net/Support/RectangularArrays.cs | 33 +++++++++ 20 files changed, 55 insertions(+), 252 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Diff.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Diff.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Diff.cs index 8f149a9..556a8e5 100644 --- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Diff.cs +++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Diff.cs @@ -1,4 +1,5 @@ -using System; +using Lucene.Net.Support; +using System; using System.Text; /* @@ -198,8 +199,8 @@ namespace Egothor.Stemmer { sizex = maxx + 8; sizey = maxy + 8; - net = RectangularArrays.ReturnRectangularInt32Array(sizex, sizey); - way = RectangularArrays.ReturnRectangularInt32Array(sizex, sizey); + net = RectangularArrays.ReturnRectangularArray(sizex, sizey); + way = RectangularArrays.ReturnRectangularArray(sizex, sizey); } /* http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj b/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj index 02f12d7..508723f 100644 --- a/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj +++ b/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj @@ -1,4 +1,4 @@ - + - @@ -79,7 +78,6 @@ - @@ -114,4 +112,4 @@ --> - + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Analysis.Stempel/RectangularArrays.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Analysis.Stempel/RectangularArrays.cs b/src/Lucene.Net.Analysis.Stempel/RectangularArrays.cs deleted file mode 100644 index 2f2dbd0..0000000 --- a/src/Lucene.Net.Analysis.Stempel/RectangularArrays.cs +++ /dev/null @@ -1,52 +0,0 @@ -//---------------------------------------------------------------------------------------- -// Copyright © 2007 - 2013 Tangible Software Solutions Inc. -// this class can be used by anyone provided that the copyright notice remains intact. -// -// this class provides the logic to simulate Java rectangular arrays, which are jagged -// arrays with inner arrays of the same length. A size of -1 indicates unknown length. -//---------------------------------------------------------------------------------------- - -using Lucene.Net.Util; - -internal static partial class RectangularArrays -{ - internal static int[][] ReturnRectangularInt32Array(int size1, int size2) - { - int[][] Array; - if (size1 > -1) - { - Array = new int[size1][]; - if (size2 > -1) - { - for (int Array1 = 0; Array1 < size1; Array1++) - { - Array[Array1] = new int[size2]; - } - } - } - else - Array = null; - - return Array; - } - - internal static BytesRef[][] ReturnRectangularBytesRefArray(int size1, int size2) - { - BytesRef[][] Array; - if (size1 > -1) - { - Array = new BytesRef[size1][]; - if (size2 > -1) - { - for (int Array1 = 0; Array1 < size1; Array1++) - { - Array[Array1] = new BytesRef[size2]; - } - } - } - else - Array = null; - - return Array; - } -} http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj b/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj index 5440c8d..d9203f2 100644 --- a/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj +++ b/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj @@ -1,4 +1,4 @@ - + - @@ -112,7 +111,6 @@ - @@ -142,7 +140,7 @@ - + Properties\CommonAssemblyInfo.cs @@ -163,4 +161,4 @@ --> - + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs index ccf7a59..9d7e778 100644 --- a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs +++ b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs @@ -355,7 +355,7 @@ namespace Lucene.Net.Codecs.Memory this.metaLongsReader.Reset(outerInstance.metaLongsBlock); this.metaBytesReader.Reset(outerInstance.metaBytesBlock); - this.longs = RectangularArrays.ReturnRectangularInt64Array(INTERVAL, outerInstance.longsSize); + this.longs = RectangularArrays.ReturnRectangularArray(INTERVAL, outerInstance.longsSize); this.bytesStart = new int[INTERVAL]; this.bytesLength = new int[INTERVAL]; this.docFreq_Renamed = new int[INTERVAL]; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Codecs/RectangularArrays.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/RectangularArrays.cs b/src/Lucene.Net.Codecs/RectangularArrays.cs deleted file mode 100644 index a10b322..0000000 --- a/src/Lucene.Net.Codecs/RectangularArrays.cs +++ /dev/null @@ -1,29 +0,0 @@ -//---------------------------------------------------------------------------------------- -// Copyright © 2007 - 2014 Tangible Software Solutions Inc. -// This class can be used by anyone provided that the copyright notice remains intact. -// -// This class provides the logic to simulate Java rectangular arrays, which are jagged -// arrays with inner arrays of the same length. A size of -1 indicates unknown length. -//---------------------------------------------------------------------------------------- -internal static partial class RectangularArrays // LUCENENET TODO: Move to Support ? -{ - internal static long[][] ReturnRectangularInt64Array(int size1, int size2) - { - long[][] Array; - if (size1 > -1) - { - Array = new long[size1][]; - if (size2 > -1) - { - for (int Array1 = 0; Array1 < size1; Array1++) - { - Array[Array1] = new long[size2]; - } - } - } - else - Array = null; - - return Array; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj b/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj index 38274c1..c1bbe1e 100644 --- a/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj +++ b/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj @@ -1,4 +1,4 @@ - + - @@ -99,7 +98,6 @@ - @@ -152,4 +150,4 @@ --> - + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs index 63b9fef..6211042 100644 --- a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs +++ b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs @@ -441,7 +441,7 @@ namespace Lucene.Net.Search.PostingsHighlight /// protected virtual string[][] LoadFieldValues(IndexSearcher searcher, string[] fields, int[] docids, int maxLength) { - string[][] contents = RectangularArrays.ReturnRectangularStringArray(fields.Length, docids.Length); + string[][] contents = RectangularArrays.ReturnRectangularArray(fields.Length, docids.Length); char[] valueSeparators = new char[fields.Length]; for (int i = 0; i < fields.Length; i++) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Highlighter/RectangularArrays.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Highlighter/RectangularArrays.cs b/src/Lucene.Net.Highlighter/RectangularArrays.cs deleted file mode 100644 index 03f65dd..0000000 --- a/src/Lucene.Net.Highlighter/RectangularArrays.cs +++ /dev/null @@ -1,29 +0,0 @@ -//---------------------------------------------------------------------------------------- -// Copyright © 2007 - 2014 Tangible Software Solutions Inc. -// This class can be used by anyone provided that the copyright notice remains intact. -// -// This class provides the logic to simulate Java rectangular arrays, which are jagged -// arrays with inner arrays of the same length. A size of -1 indicates unknown length. -//---------------------------------------------------------------------------------------- -internal static partial class RectangularArrays -{ - internal static string[][] ReturnRectangularStringArray(int size1, int size2) - { - string[][] Array; - if (size1 > -1) - { - Array = new string[size1][]; - if (size2 > -1) - { - for (int Array1 = 0; Array1 < size1; Array1++) - { - Array[Array1] = new string[size2]; - } - } - } - else - Array = null; - - return Array; - } -} http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Suggest/Spell/LuceneLevenshteinDistance.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Suggest/Spell/LuceneLevenshteinDistance.cs b/src/Lucene.Net.Suggest/Spell/LuceneLevenshteinDistance.cs index b9f7e41..5f8988b 100644 --- a/src/Lucene.Net.Suggest/Spell/LuceneLevenshteinDistance.cs +++ b/src/Lucene.Net.Suggest/Spell/LuceneLevenshteinDistance.cs @@ -69,7 +69,7 @@ namespace Lucene.Net.Search.Spell n = targetPoints.Length; int m = otherPoints.Length; - d = ReturnRectangularInt32Array(n + 1, m + 1); + d = RectangularArrays.ReturnRectangularArray(n + 1, m + 1); if (n == 0 || m == 0) { @@ -134,26 +134,5 @@ namespace Lucene.Net.Search.Spell } return @ref; } - - // LUCENENET TODO: Move to Support ? - private static int[][] ReturnRectangularInt32Array(int size1, int size2) - { - int[][] array; - if (size1 > -1) - { - array = new int[size1][]; - if (size2 > -1) - { - for (int Array1 = 0; Array1 < size1; Array1++) - { - array[Array1] = new int[size2]; - } - } - } - else - array = null; - - return array; - } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighter.cs b/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighter.cs index 7c38b78..dd214f6 100644 --- a/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighter.cs +++ b/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighter.cs @@ -778,7 +778,7 @@ namespace Lucene.Net.Search.PostingsHighlight { Debug.Assert( fields.Length == 1); Debug.Assert( docids.Length == 1); - String[][] contents = RectangularArrays.ReturnRectangularStringArray(1, 1); //= new String[1][1]; + String[][] contents = RectangularArrays.ReturnRectangularArray(1, 1); //= new String[1][1]; contents[0][0] = text; return contents; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragmentsBuilderTest.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragmentsBuilderTest.cs b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragmentsBuilderTest.cs index b254b22..c197693 100644 --- a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragmentsBuilderTest.cs +++ b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragmentsBuilderTest.cs @@ -269,7 +269,7 @@ namespace Lucene.Net.Search.VectorHighlight for (int i = 0; i < numDocs; i++) { Document document = new Document(); - String[][] fields = RectangularArrays.ReturnRectangularStringArray(numFields, numTerms); //new String[numFields][numTerms]; + String[][] fields = RectangularArrays.ReturnRectangularArray(numFields, numTerms); //new String[numFields][numTerms]; for (int j = 0; j < numFields; j++) { String[] fieldValues = new String[numTerms]; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs index 96494cd..3380d7c 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs @@ -1340,7 +1340,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing n = targetPoints.Length; int m = otherPoints.Length; - d = ReturnRectangularIntArray(n + 1, m + 1); + d = RectangularArrays.ReturnRectangularArray(n + 1, m + 1); if (n == 0 || m == 0) @@ -1393,26 +1393,6 @@ namespace Lucene.Net.Search.Suggest.Analyzing return d[n][m]; } - internal static int[][] ReturnRectangularIntArray(int size1, int size2) - { - int[][] array; - if (size1 > -1) - { - array = new int[size1][]; - if (size2 > -1) - { - for (int Array1 = 0; Array1 < size1; Array1++) - { - array[Array1] = new int[size2]; - } - } - } - else - array = null; - - return array; - } - private static Int32sRef ToIntsRef(string s) { Int32sRef @ref = new Int32sRef(s.Length); // worst case http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Tests/Index/TestConsistentFieldNumbers.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestConsistentFieldNumbers.cs b/src/Lucene.Net.Tests/Index/TestConsistentFieldNumbers.cs index ca36407..9fef2b4 100644 --- a/src/Lucene.Net.Tests/Index/TestConsistentFieldNumbers.cs +++ b/src/Lucene.Net.Tests/Index/TestConsistentFieldNumbers.cs @@ -249,7 +249,7 @@ namespace Lucene.Net.Index int NUM_DOCS = AtLeast(200); int MAX_FIELDS = AtLeast(50); - int[][] docs = RectangularArrays.ReturnRectangularIntArray(NUM_DOCS, 4); + int[][] docs = RectangularArrays.ReturnRectangularArray(NUM_DOCS, 4); for (int i = 0; i < docs.Length; i++) { for (int j = 0; j < docs[i].Length; j++) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj index df8cea4..bc1008b 100644 --- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj +++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj @@ -360,9 +360,6 @@ - - Code - http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Tests/RectangularArrays.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/RectangularArrays.cs b/src/Lucene.Net.Tests/RectangularArrays.cs deleted file mode 100644 index fad2f5a..0000000 --- a/src/Lucene.Net.Tests/RectangularArrays.cs +++ /dev/null @@ -1,73 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -//---------------------------------------------------------------------------------------- -// Copyright � 2007 - 2013 Tangible Software Solutions Inc. -// this class can be used by anyone provided that the copyright notice remains intact. -// -// this class provides the logic to simulate Java rectangular arrays, which are jagged -// arrays with inner arrays of the same length. A size of -1 indicates unknown length. -//---------------------------------------------------------------------------------------- - -using Lucene.Net.Util; - -internal static partial class RectangularArrays -{ - internal static int[][] ReturnRectangularIntArray(int Size1, int Size2) - { - int[][] Array; - if (Size1 > -1) - { - Array = new int[Size1][]; - if (Size2 > -1) - { - for (int Array1 = 0; Array1 < Size1; Array1++) - { - Array[Array1] = new int[Size2]; - } - } - } - else - Array = null; - - return Array; - } - - internal static BytesRef[][] ReturnRectangularBytesRefArray(int Size1, int Size2) - { - BytesRef[][] Array; - if (Size1 > -1) - { - Array = new BytesRef[Size1][]; - if (Size2 > -1) - { - for (int Array1 = 0; Array1 < Size1; Array1++) - { - Array[Array1] = new BytesRef[Size2]; - } - } - } - else - Array = null; - - return Array; - } -} http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Tests/Search/TestFieldCache.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Search/TestFieldCache.cs b/src/Lucene.Net.Tests/Search/TestFieldCache.cs index 3dab2cc..b360751 100644 --- a/src/Lucene.Net.Tests/Search/TestFieldCache.cs +++ b/src/Lucene.Net.Tests/Search/TestFieldCache.cs @@ -119,7 +119,7 @@ namespace Lucene.Net.Search float theFloat = float.MaxValue; UnicodeStrings = new string[NUM_DOCS]; //MultiValued = new BytesRef[NUM_DOCS, NUM_ORDS]; - MultiValued = RectangularArrays.ReturnRectangularBytesRefArray(NUM_DOCS, NUM_ORDS); + MultiValued = RectangularArrays.ReturnRectangularArray(NUM_DOCS, NUM_ORDS); if (VERBOSE) { Console.WriteLine("TEST: setUp"); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net.Tests/Util/Automaton/TestLevenshteinAutomata.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestLevenshteinAutomata.cs b/src/Lucene.Net.Tests/Util/Automaton/TestLevenshteinAutomata.cs index 2b5df06..f23d2a2 100644 --- a/src/Lucene.Net.Tests/Util/Automaton/TestLevenshteinAutomata.cs +++ b/src/Lucene.Net.Tests/Util/Automaton/TestLevenshteinAutomata.cs @@ -1,3 +1,4 @@ +using Lucene.Net.Support; using NUnit.Framework; using System; using System.Collections.Generic; @@ -378,7 +379,7 @@ namespace Lucene.Net.Util.Automaton sa = target.ToCharArray(); n = sa.Length; int m = other.Length; - d = RectangularArrays.ReturnRectangularIntArray(n + 1, m + 1); + d = RectangularArrays.ReturnRectangularArray(n + 1, m + 1); if (n == 0 || m == 0) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net/Lucene.Net.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Lucene.Net.csproj b/src/Lucene.Net/Lucene.Net.csproj index 13e6e20..eb166ac 100644 --- a/src/Lucene.Net/Lucene.Net.csproj +++ b/src/Lucene.Net/Lucene.Net.csproj @@ -652,6 +652,7 @@ + http://git-wip-us.apache.org/repos/asf/lucenenet/blob/609ce6db/src/Lucene.Net/Support/RectangularArrays.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/RectangularArrays.cs b/src/Lucene.Net/Support/RectangularArrays.cs new file mode 100644 index 0000000..a3a33da --- /dev/null +++ b/src/Lucene.Net/Support/RectangularArrays.cs @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------------------- +// Copyright � 2007 - 2013 Tangible Software Solutions Inc. +// this class can be used by anyone provided that the copyright notice remains intact. +// +// this class provides the logic to simulate Java rectangular arrays, which are jagged +// arrays with inner arrays of the same length. A size of -1 indicates unknown length. +//---------------------------------------------------------------------------------------- + +namespace Lucene.Net.Support +{ + public static class RectangularArrays + { + public static T[][] ReturnRectangularArray(int size1, int size2) + { + T[][] array; + if (size1 > -1) + { + array = new T[size1][]; + if (size2 > -1) + { + for (int array1 = 0; array1 < size1; array1++) + { + array[array1] = new T[size2]; + } + } + } + else + array = null; + + return array; + } + } +} \ No newline at end of file