Return-Path: X-Original-To: apmail-lucene-lucene-net-commits-archive@www.apache.org Delivered-To: apmail-lucene-lucene-net-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DC8569716 for ; Sat, 23 Jun 2012 06:40:14 +0000 (UTC) Received: (qmail 36938 invoked by uid 500); 23 Jun 2012 06:40:14 -0000 Delivered-To: apmail-lucene-lucene-net-commits-archive@lucene.apache.org Received: (qmail 36849 invoked by uid 500); 23 Jun 2012 06:40:13 -0000 Mailing-List: contact lucene-net-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucene.apache.org Delivered-To: mailing list lucene-net-commits@lucene.apache.org Received: (qmail 36799 invoked by uid 99); 23 Jun 2012 06:40:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Jun 2012 06:40:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Jun 2012 06:40:08 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5386423888CD; Sat, 23 Jun 2012 06:39:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1353077 - in /incubator/lucene.net/branches/Lucene.Net_3_5: build/vs2010/core/ src/core/ src/core/Analysis/ src/core/Index/ src/core/Search/ src/core/Search/Spans/ src/core/Store/ src/core/Support/Compatibility/ src/core/Util/ Date: Sat, 23 Jun 2012 06:39:46 -0000 To: lucene-net-commits@lucene.apache.org From: pnasser@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120623063948.5386423888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: pnasser Date: Sat Jun 23 06:39:43 2012 New Revision: 1353077 URL: http://svn.apache.org/viewvc?rev=1353077&view=rev Log: LUCENENET-480 .Net 3.5 support. Added #NET35 compiler flag to Lucene.Net core. Support/Compatibility/SortedSet.cs needs adjustments. Test and Contrib will need to be looked at Added: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/ISet.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/SetFactory.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/SortedSet.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/ThreadLocal.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/WrappedHashSet.cs Modified: incubator/lucene.net/branches/Lucene.Net_3_5/build/vs2010/core/Lucene.Net.Core.sln incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Analysis/WordlistLoader.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/DirectoryReader.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/IndexWriter.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/ParallelReader.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/SegmentMerger.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/SegmentReader.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Lucene.Net.csproj incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/MultiSearcher.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/ParallelMultiSearcher.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/Spans/NearSpansUnordered.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/Spans/SpanWeight.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Store/RAMDirectory.cs incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Util/CloseableThreadLocal.cs Modified: incubator/lucene.net/branches/Lucene.Net_3_5/build/vs2010/core/Lucene.Net.Core.sln URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/build/vs2010/core/Lucene.Net.Core.sln?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/build/vs2010/core/Lucene.Net.Core.sln (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/build/vs2010/core/Lucene.Net.Core.sln Sat Jun 23 06:39:43 2012 @@ -1,36 +1,19 @@  Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C# Express 2010 -# -# -# 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. -# -# +# Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lucene.Net", "..\..\..\src\core\Lucene.Net.csproj", "{5D4AD9BE-1FFB-41AB-9943-25737971BF57}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + NET35|Any CPU = NET35|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.NET35|Any CPU.ActiveCfg = NET35|Any CPU + {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.NET35|Any CPU.Build.0 = NET35|Any CPU {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.ActiveCfg = Release|Any CPU {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Analysis/WordlistLoader.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Analysis/WordlistLoader.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Analysis/WordlistLoader.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Analysis/WordlistLoader.cs Sat Jun 23 06:39:43 2012 @@ -34,7 +34,7 @@ namespace Lucene.Net.Analysis /// A HashSet with the file's words public static ISet GetWordSet(System.IO.FileInfo wordfile) { - ISet result = new HashSet(); + ISet result = Support.Compatibility.SetFactory.GetSet(); System.IO.StreamReader reader = null; try { @@ -82,9 +82,9 @@ namespace Lucene.Net.Analysis /// /// Reader containing the wordlist /// A HashSet with the reader's words - public static HashSet GetWordSet(System.IO.TextReader reader) + public static ISet GetWordSet(System.IO.TextReader reader) { - HashSet result = new HashSet(); + ISet result = Support.Compatibility.SetFactory.GetSet(); System.IO.TextReader br = null; try { Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/DirectoryReader.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/DirectoryReader.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/DirectoryReader.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/DirectoryReader.cs Sat Jun 23 06:39:43 2012 @@ -1066,7 +1066,7 @@ namespace Lucene.Net.Index internal static System.Collections.Generic.ICollection GetFieldNames(IndexReader.FieldOption fieldNames, IndexReader[] subReaders) { // maintain a unique set of field names - System.Collections.Generic.ISet fieldSet = new System.Collections.Generic.HashSet(); + System.Collections.Generic.ISet fieldSet = Support.Compatibility.SetFactory.GetSet(); foreach (IndexReader reader in subReaders) { fieldSet.UnionWith(reader.GetFieldNames(fieldNames)); Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/IndexWriter.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/IndexWriter.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/IndexWriter.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/IndexWriter.cs Sat Jun 23 06:39:43 2012 @@ -244,7 +244,7 @@ namespace Lucene.Net.Index private DocumentsWriter docWriter; private IndexFileDeleter deleter; - private ISet segmentsToOptimize = new HashSet(); // used by optimize to note those needing optimization + private ISet segmentsToOptimize = Support.Compatibility.SetFactory.GetSet(); // used by optimize to note those needing optimization private Lock writeLock; @@ -260,7 +260,7 @@ namespace Lucene.Net.Index private MergePolicy mergePolicy; private MergeScheduler mergeScheduler = new ConcurrentMergeScheduler(); private LinkedList pendingMerges = new LinkedList(); - private ISet runningMerges = new HashSet(); + private ISet runningMerges = Support.Compatibility.SetFactory.GetSet(); private IList mergeExceptions = new List(); private long mergeGen; private bool stopMerges; @@ -2733,7 +2733,7 @@ namespace Lucene.Net.Index lock (this) { ResetMergeExceptions(); - segmentsToOptimize = new HashSet(); + segmentsToOptimize = Support.Compatibility.SetFactory.GetSet(); optimizeMaxNumSegments = maxNumSegments; int numSegments = segmentInfos.Count; for (int i = 0; i < numSegments; i++) Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/ParallelReader.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/ParallelReader.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/ParallelReader.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/ParallelReader.cs Sat Jun 23 06:39:43 2012 @@ -531,7 +531,7 @@ namespace Lucene.Net.Index public override System.Collections.Generic.ICollection GetFieldNames(IndexReader.FieldOption fieldNames) { EnsureOpen(); - ISet fieldSet = new HashSet(); + ISet fieldSet = Support.Compatibility.SetFactory.GetSet(); foreach(var reader in readers) { ICollection names = reader.GetFieldNames(fieldNames); Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/SegmentMerger.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/SegmentMerger.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/SegmentMerger.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/SegmentMerger.cs Sat Jun 23 06:39:43 2012 @@ -232,7 +232,7 @@ namespace Lucene.Net.Index internal ICollection GetMergedFiles() { - ISet fileSet = new HashSet(); + ISet fileSet = Support.Compatibility.SetFactory.GetSet(); // Basic files for (int i = 0; i < IndexFileNames.COMPOUND_EXTENSIONS.Length; i++) Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/SegmentReader.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/SegmentReader.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/SegmentReader.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Index/SegmentReader.cs Sat Jun 23 06:39:43 2012 @@ -1273,7 +1273,7 @@ namespace Lucene.Net.Index { EnsureOpen(); - System.Collections.Generic.ISet fieldSet = new System.Collections.Generic.HashSet(); + System.Collections.Generic.ISet fieldSet = Support.Compatibility.SetFactory.GetSet(); for (int i = 0; i < core.fieldInfos.Size(); i++) { FieldInfo fi = core.fieldInfos.FieldInfo(i); Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Lucene.Net.csproj URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Lucene.Net.csproj?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Lucene.Net.csproj (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Lucene.Net.csproj Sat Jun 23 06:39:43 2012 @@ -114,6 +114,26 @@ true + + true + ..\..\build\bin\core\Net35\ + TRACE;DEBUG;NET35 + 285212672 + 4096 + 618 + full + AnyCPU + ..\..\build\bin\core\Debug\Lucene.Net.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt + BasicDesignGuidelineRules.ruleset + ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + false + ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + false + false + System @@ -858,6 +878,9 @@ + + + @@ -867,7 +890,9 @@ + + Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/MultiSearcher.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/MultiSearcher.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/MultiSearcher.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/MultiSearcher.cs Sat Jun 23 06:39:43 2012 @@ -357,7 +357,7 @@ namespace Lucene.Net.Search Query rewrittenQuery = Rewrite(original); // step 2 - ISet terms = new HashSet(); + ISet terms = Support.Compatibility.SetFactory.GetSet(); rewrittenQuery.ExtractTerms(terms); // step3 @@ -385,6 +385,14 @@ namespace Lucene.Net.Search return rewrittenQuery.Weight(cacheSim); } + +#if NET35 + public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, + T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9); + public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, + T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10); +#endif + internal Func MultiSearcherCallableNoSort = (threadLock, lockObj, searchable, weight, filter, nDocs, hq, i, starts) => { Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/ParallelMultiSearcher.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/ParallelMultiSearcher.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/ParallelMultiSearcher.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/ParallelMultiSearcher.cs Sat Jun 23 06:39:43 2012 @@ -15,6 +15,8 @@ * limitations under the License. */ +#if (!NET35) + using System; using System.Threading; using System.Threading.Tasks; @@ -210,4 +212,6 @@ namespace Lucene.Net.Search } } } -} \ No newline at end of file +} + +#endif Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/Spans/NearSpansUnordered.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/Spans/NearSpansUnordered.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/Spans/NearSpansUnordered.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/Spans/NearSpansUnordered.cs Sat Jun 23 06:39:43 2012 @@ -321,7 +321,7 @@ namespace Lucene.Net.Search.Spans /// IOException public override ICollection GetPayload() { - System.Collections.Generic.ISet matchPayload = new System.Collections.Generic.HashSet(); + System.Collections.Generic.ISet matchPayload = Support.Compatibility.SetFactory.GetSet(); for (SpansCell cell = first; cell != null; cell = cell.next) { if (cell.IsPayloadAvailable()) Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/Spans/SpanWeight.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/Spans/SpanWeight.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/Spans/SpanWeight.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Search/Spans/SpanWeight.cs Sat Jun 23 06:39:43 2012 @@ -35,7 +35,7 @@ namespace Lucene.Net.Search.Spans protected internal float queryNorm; protected internal float queryWeight; - protected internal HashSet terms; + protected internal ISet terms; protected internal SpanQuery query; private IDFExplanation idfExp; @@ -44,7 +44,7 @@ namespace Lucene.Net.Search.Spans this.similarity = query.GetSimilarity(searcher); this.query = query; - terms = new HashSet(); + terms = Support.Compatibility.SetFactory.GetSet(); query.ExtractTerms(terms); idfExp = similarity.IdfExplain(terms, searcher); Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Store/RAMDirectory.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Store/RAMDirectory.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Store/RAMDirectory.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Store/RAMDirectory.cs Sat Jun 23 06:39:43 2012 @@ -86,7 +86,7 @@ namespace Lucene.Net.Store { EnsureOpen(); // TODO: may have better performance if our HashMap implmented KeySet() instead of generating one via HashSet - System.Collections.Generic.ISet fileNames = new System.Collections.Generic.HashSet(fileMap.Keys); + System.Collections.Generic.ISet fileNames = Support.Compatibility.SetFactory.GetSet(); System.String[] result = new System.String[fileNames.Count]; int i = 0; foreach(string filename in fileNames) Added: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/ISet.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/ISet.cs?rev=1353077&view=auto ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/ISet.cs (added) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/ISet.cs Sat Jun 23 06:39:43 2012 @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#if NET35 + +namespace System.Collections.Generic +{ + public interface ISet : ICollection + { + #region METHODS + + new bool Add(T item); + + void ExceptWith(IEnumerable other); + + void IntersectWith(IEnumerable other); + + bool IsProperSubsetOf(IEnumerable other); + + bool IsProperSupersetOf(IEnumerable other); + + bool IsSubsetOf(IEnumerable other); + + bool IsSupersetOf(IEnumerable other); + + bool Overlaps(IEnumerable other); + + bool SetEquals(IEnumerable other); + + void SymmetricExceptWith(IEnumerable other); + + void UnionWith(IEnumerable other); + + #endregion + + #region EXTENSION METHODS + + + + #endregion + } + +} + +#endif \ No newline at end of file Added: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/SetFactory.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/SetFactory.cs?rev=1353077&view=auto ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/SetFactory.cs (added) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/SetFactory.cs Sat Jun 23 06:39:43 2012 @@ -0,0 +1,33 @@ +/* + * 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. + */ + +using System.Collections.Generic; + +namespace Lucene.Net.Support.Compatibility +{ + public static class SetFactory + { + public static ISet GetSet() + { + #if NET35 + return new WrappedHashSet(); + #else + return new HashSet(); + #endif + } + } +} Added: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/SortedSet.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/SortedSet.cs?rev=1353077&view=auto ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/SortedSet.cs (added) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/SortedSet.cs Sat Jun 23 06:39:43 2012 @@ -0,0 +1,209 @@ +/* + * 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. + */ + +#if NET35 + +using System.Linq; +using System.Runtime.Serialization; + +namespace System.Collections.Generic +{ + + public class SortedSet : ISet, ICollection, ISerializable, IDeserializationCallback + { + private readonly SortedDictionary _list; + + public SortedSet(IComparer comparer) + { + _list = new SortedDictionary(comparer); + } + + public T Min { get { return (_list.Count) >= 1 ? _list.Keys.First() : default(T); } } + + public T Max { get { return (_list.Count) >= 1 ? _list.Keys.Last() : default(T); } } + + + /// + /// Removes all items from the . + /// + /// The is read-only. + /// + public void Clear() + { + throw new NotImplementedException(); + } + + public bool Contains(T value) + { + return _list.ContainsKey(value); + } + + public void Add(T value) + { + //base.Add(value, 0); + } + + #region ISet Implementation + + bool ISet.Add(T item) + { + throw new NotImplementedException(); + } + + void ISet.ExceptWith(IEnumerable other) + { + throw new NotImplementedException(); + } + + void ISet.IntersectWith(IEnumerable other) + { + throw new NotImplementedException(); + } + + bool ISet.IsProperSubsetOf(IEnumerable other) + { + throw new NotImplementedException(); + } + + bool ISet.IsProperSupersetOf(IEnumerable other) + { + throw new NotImplementedException(); + } + + bool ISet.IsSubsetOf(IEnumerable other) + { + throw new NotImplementedException(); + } + + bool ISet.IsSupersetOf(IEnumerable other) + { + throw new NotImplementedException(); + } + + bool ISet.Overlaps(IEnumerable other) + { + throw new NotImplementedException(); + } + + bool ISet.SetEquals(IEnumerable other) + { + throw new NotImplementedException(); + } + + void ISet.SymmetricExceptWith(IEnumerable other) + { + throw new NotImplementedException(); + } + + void ISet.UnionWith(IEnumerable other) + { + throw new NotImplementedException(); + } + + void ICollection.Add(T item) + { + throw new NotImplementedException(); + } + + void ICollection.Clear() + { + throw new NotImplementedException(); + } + + bool ICollection.Contains(T item) + { + throw new NotImplementedException(); + } + + void ICollection.CopyTo(T[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + int ICollection.Count + { + get { throw new NotImplementedException(); } + } + + bool ICollection.IsReadOnly + { + get { throw new NotImplementedException(); } + } + + bool ICollection.Remove(T item) + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + + #region ICollection Implementation + + void ICollection.CopyTo(Array array, int index) + { + throw new NotImplementedException(); + } + + int ICollection.Count + { + get { throw new NotImplementedException(); } + } + + bool ICollection.IsSynchronized + { + get { throw new NotImplementedException(); } + } + + object ICollection.SyncRoot + { + get { throw new NotImplementedException(); } + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + + #region ISerializable Implementation + + void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) + { + throw new NotImplementedException(); + } + + #endregion + + #region IDeserializationCallback Implementation + + void IDeserializationCallback.OnDeserialization(object sender) + { + throw new NotImplementedException(); + } + + #endregion + + } +} + +#endif Added: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/ThreadLocal.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/ThreadLocal.cs?rev=1353077&view=auto ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/ThreadLocal.cs (added) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/ThreadLocal.cs Sat Jun 23 06:39:43 2012 @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#if NET35 + +using System; + +namespace Lucene.Net.Support.Compatibility +{ + + public class ThreadLocal : IDisposable + { + [ThreadStatic] + static WeakDictionary, T> slots; + + static void Init() + { + if (slots == null) slots = new WeakDictionary, T>(); + } + + public T Value + { + set + { + Init(); + slots.Add(this, value); + } + get + { + Init(); + return (T)slots[this]; + } + } + + public void Dispose() + { + if (slots != null) slots.Remove(this); + } + } +} + +#endif Added: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/WrappedHashSet.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/WrappedHashSet.cs?rev=1353077&view=auto ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/WrappedHashSet.cs (added) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Support/Compatibility/WrappedHashSet.cs Sat Jun 23 06:39:43 2012 @@ -0,0 +1,30 @@ +/* + * 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. + */ + +#if NET35 + +using System.Collections.Generic; + +namespace Lucene.Net.Support.Compatibility +{ + class WrappedHashSet : HashSet, ISet + { + + } +} + +#endif \ No newline at end of file Modified: incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Util/CloseableThreadLocal.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Util/CloseableThreadLocal.cs?rev=1353077&r1=1353076&r2=1353077&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Util/CloseableThreadLocal.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_3_5/src/core/Util/CloseableThreadLocal.cs Sat Jun 23 06:39:43 2012 @@ -166,36 +166,4 @@ namespace Lucene.Net.Util } } - //// {{DIGY}} - //// To compile against Framework 2.0 - //// Uncomment below class - //public class ThreadLocal : IDisposable - //{ - // [ThreadStatic] - // static SupportClass.WeakHashTable slots; - - // void Init() - // { - // if (slots == null) slots = new SupportClass.WeakHashTable(); - // } - - // public T Value - // { - // set - // { - // Init(); - // slots.Add(this, value); - // } - // get - // { - // Init(); - // return (T)slots[this]; - // } - // } - - // public void Dispose() - // { - // if (slots != null) slots.Remove(this); - // } - //} }