You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2011/04/25 18:17:38 UTC
[Lucene.Net] svn commit: r1096507 [2/3] - in
/incubator/lucene.net/branches/Lucene.Net_2_9_4g: src/core/
src/core/Document/ src/core/Index/ src/core/Search/
src/core/Search/Function/ src/core/Search/Payloads/ src/core/Search/Spans/
src/core/Store/ src/core/Util/ te...
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentInfo.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentInfo.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentInfo.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using Directory = Lucene.Net.Store.Directory;
using IndexInput = Lucene.Net.Store.IndexInput;
@@ -70,7 +71,7 @@ namespace Lucene.Net.Index
// and true for newly created merged segments (both
// compound and non compound).
- private System.Collections.Generic.IList<string> files; // cached list of files that this segment uses
+ private IList<string> files; // cached list of files that this segment uses
// in the Directory
internal long sizeInBytes = - 1; // total byte size of all of our files (computed on demand)
@@ -86,7 +87,7 @@ namespace Lucene.Net.Index
private bool hasProx; // True if this segment has any fields with omitTermFreqAndPositions==false
- private System.Collections.Generic.IDictionary<string, string> diagnostics;
+ private IDictionary<string, string> diagnostics;
public override System.String ToString()
{
@@ -152,13 +153,13 @@ namespace Lucene.Net.Index
}
// must be Map<String, String>
- internal void SetDiagnostics(System.Collections.Generic.IDictionary<string, string> diagnostics)
+ internal void SetDiagnostics(IDictionary<string, string> diagnostics)
{
this.diagnostics = diagnostics;
}
// returns Map<String, String>
- public System.Collections.Generic.IDictionary<string, string> GetDiagnostics()
+ public IDictionary<string, string> GetDiagnostics()
{
return diagnostics;
}
@@ -242,7 +243,7 @@ namespace Lucene.Net.Index
}
else
{
- diagnostics = new System.Collections.Generic.Dictionary<string,string>();
+ diagnostics = new Dictionary<string,string>();
}
}
else
@@ -257,7 +258,7 @@ namespace Lucene.Net.Index
docStoreSegment = null;
delCount = - 1;
hasProx = true;
- diagnostics = new System.Collections.Generic.Dictionary<string,string>();
+ diagnostics = new Dictionary<string,string>();
}
}
@@ -294,7 +295,7 @@ namespace Lucene.Net.Index
{
if (sizeInBytes == - 1)
{
- System.Collections.Generic.IList<string> files = Files();
+ IList<string> files = Files();
int size = files.Count;
sizeInBytes = 0;
for (int i = 0; i < size; i++)
@@ -370,7 +371,7 @@ namespace Lucene.Net.Index
si.hasSingleNormFile = hasSingleNormFile;
if (this.diagnostics != null)
{
- si.diagnostics = new System.Collections.Generic.Dictionary<string, string>();
+ si.diagnostics = new Dictionary<string, string>();
foreach (string o in diagnostics.Keys)
{
si.diagnostics.Add(o,diagnostics[o]);
@@ -386,7 +387,7 @@ namespace Lucene.Net.Index
si.docStoreIsCompoundFile = docStoreIsCompoundFile;
if (this.files != null)
{
- si.files = new System.Collections.Generic.List<string>();
+ si.files = new List<string>();
foreach (string file in files)
{
si.files.Add(file);
@@ -690,7 +691,7 @@ namespace Lucene.Net.Index
return hasProx;
}
- private void AddIfExists(System.Collections.Generic.IList<string> files, System.String fileName)
+ private void AddIfExists(IList<string> files, System.String fileName)
{
if (dir.FileExists(fileName))
files.Add(fileName);
@@ -702,7 +703,7 @@ namespace Lucene.Net.Index
* modify it.
*/
- public System.Collections.Generic.IList<string> Files()
+ public IList<string> Files()
{
if (files != null)
@@ -711,7 +712,7 @@ namespace Lucene.Net.Index
return files;
}
- files = new System.Collections.Generic.List<string>();
+ files = new List<string>();
bool useCompoundFile = GetUseCompoundFile();
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentInfos.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentInfos.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentInfos.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentInfos.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using ChecksumIndexInput = Lucene.Net.Store.ChecksumIndexInput;
using ChecksumIndexOutput = Lucene.Net.Store.ChecksumIndexOutput;
@@ -126,7 +127,7 @@ namespace Lucene.Net.Index
// or wrote; this is normally the same as generation except if
// there was an IOException that had interrupted a commit
- private System.Collections.Generic.IDictionary<string, string> userData = new System.Collections.Generic.Dictionary<string, string>(); // Opaque Map<String, String> that user can specify during IndexWriter.commit
+ private IDictionary<string, string> userData = new Dictionary<string, string>(); // Opaque Map<String, String> that user can specify during IndexWriter.commit
/// <summary> If non-null, information about loading segments_N files</summary>
/// <seealso cref="setInfoStream">
@@ -314,17 +315,17 @@ namespace Lucene.Net.Index
}
else if (0 != input.ReadByte())
{
- userData = new System.Collections.Generic.Dictionary<string,string>();
+ userData = new Dictionary<string,string>();
userData.Add("userData", input.ReadString());
}
else
{
- userData = new System.Collections.Generic.Dictionary<string, string>();
+ userData = new Dictionary<string, string>();
}
}
else
{
- userData = new System.Collections.Generic.Dictionary<string, string>();
+ userData = new Dictionary<string, string>();
}
if (format <= FORMAT_CHECKSUM)
@@ -443,7 +444,7 @@ namespace Lucene.Net.Index
sis.generation = this.generation;
sis.lastGeneration = this.lastGeneration;
// sis.pendingSegnOutput = this.pendingSegnOutput; // {{Aroush-2.9}} needed?
- sis.userData = new System.Collections.Generic.Dictionary<string, string>(userData);
+ sis.userData = new Dictionary<string, string>(userData);
sis.version = this.version;
return sis;
}
@@ -482,7 +483,7 @@ namespace Lucene.Net.Index
/// <summary> Returns userData from latest segments file</summary>
/// <throws> CorruptIndexException if the index is corrupt </throws>
/// <throws> IOException if there is a low-level IO error </throws>
- public static System.Collections.Generic.IDictionary<string, string> ReadCurrentUserData(Directory directory)
+ public static IDictionary<string, string> ReadCurrentUserData(Directory directory)
{
SegmentInfos sis = new SegmentInfos();
sis.Read(directory);
@@ -911,9 +912,9 @@ namespace Lucene.Net.Index
/// The returned collection is recomputed on each
/// invocation.
/// </summary>
- public System.Collections.Generic.ICollection<string> Files(Directory dir, bool includeSegmentsFile)
+ public ICollection<string> Files(Directory dir, bool includeSegmentsFile)
{
- System.Collections.Generic.Dictionary<string, string> files = new System.Collections.Generic.Dictionary<string, string>();
+ Dictionary<string, string> files = new Dictionary<string, string>();
if (includeSegmentsFile)
{
string tmp = GetCurrentSegmentFileName();
@@ -1034,16 +1035,16 @@ namespace Lucene.Net.Index
}
}
- public System.Collections.Generic.IDictionary<string,string> GetUserData()
+ public IDictionary<string,string> GetUserData()
{
return userData;
}
- internal void SetUserData(System.Collections.Generic.IDictionary<string, string> data)
+ internal void SetUserData(IDictionary<string, string> data)
{
if (data == null)
{
- userData = new System.Collections.Generic.Dictionary<string,string>();
+ userData = new Dictionary<string,string>();
}
else
{
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentMerger.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentMerger.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentMerger.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentMerger.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using Document = Lucene.Net.Documents.Document;
using FieldSelector = Lucene.Net.Documents.FieldSelector;
@@ -254,9 +255,9 @@ namespace Lucene.Net.Index
}
}
- public /*internal*/ System.Collections.Generic.ICollection<string> GetMergedFiles()
+ public /*internal*/ ICollection<string> GetMergedFiles()
{
- System.Collections.Generic.IDictionary<string,string> fileSet = new System.Collections.Generic.Dictionary<string,string>();
+ IDictionary<string,string> fileSet = new Dictionary<string,string>();
// Basic files
for (int i = 0; i < IndexFileNames.COMPOUND_EXTENSIONS.Length; i++)
@@ -293,9 +294,9 @@ namespace Lucene.Net.Index
return fileSet.Keys;
}
- public /*internal*/ System.Collections.Generic.ICollection<string> CreateCompoundFile(System.String fileName)
+ public /*internal*/ ICollection<string> CreateCompoundFile(System.String fileName)
{
- System.Collections.Generic.ICollection<string> files = GetMergedFiles();
+ ICollection<string> files = GetMergedFiles();
CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, fileName, checkAbort);
// Now merge all added files
@@ -311,9 +312,9 @@ namespace Lucene.Net.Index
return files;
}
- private void AddIndexed(IndexReader reader, FieldInfos fInfos, System.Collections.Generic.ICollection<string> names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool storePayloads, bool omitTFAndPositions)
+ private void AddIndexed(IndexReader reader, FieldInfos fInfos, ICollection<string> names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool storePayloads, bool omitTFAndPositions)
{
- System.Collections.Generic.IEnumerator<string> i = names.GetEnumerator();
+ IEnumerator<string> i = names.GetEnumerator();
while (i.MoveNext())
{
System.String field = i.Current;
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentReader.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentReader.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentReader.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using Document = Lucene.Net.Documents.Document;
using FieldSelector = Lucene.Net.Documents.FieldSelector;
@@ -462,7 +463,7 @@ namespace Lucene.Net.Index
/// is independent of reader references (i.e. incRef, decRef).
/// </summary>
- public /*internal*/ sealed class Norm : System.ICloneable
+ public /*internal*/ sealed class Norm : System.ICloneable<Norm>
{
private void InitBlock(SegmentReader enclosingInstance)
{
@@ -685,7 +686,7 @@ namespace Lucene.Net.Index
// Returns a copy of this Norm instance that shares
// IndexInput & bytes with the original one
- public System.Object Clone()
+ public Norm Clone()
{
lock (this) //LUCENENET-375
{
@@ -767,8 +768,8 @@ namespace Lucene.Net.Index
this.dirty = false;
}
}
-
- internal System.Collections.IDictionary norms = new System.Collections.Hashtable();
+
+ internal SupportClass.Dictionary<string, Norm> norms = new SupportClass.Dictionary<string, Norm>();
/// <summary>The class which implements SegmentReader. </summary>
// @deprecated (LUCENE-1677)
@@ -1020,7 +1021,7 @@ namespace Lucene.Net.Index
}
clone.SetDisableFakeNorms(GetDisableFakeNorms());
- clone.norms = new System.Collections.Hashtable();
+ clone.norms = new SupportClass.Dictionary<string, Norm>();
// Clone norms
for (int i = 0; i < fieldNormsChanged.Length; i++)
@@ -1030,7 +1031,7 @@ namespace Lucene.Net.Index
if (doClone || !fieldNormsChanged[i])
{
System.String curField = core.fieldInfos.FieldInfo(i).name;
- Norm norm = (Norm) this.norms[curField];
+ Norm norm = this.norms[curField];
if (norm != null)
clone.norms[curField] = norm.Clone();
}
@@ -1064,7 +1065,7 @@ namespace Lucene.Net.Index
DoCommit(null);
}
- protected internal override void DoCommit(System.Collections.Generic.IDictionary<string, string> commitUserData)
+ protected internal override void DoCommit(IDictionary<string, string> commitUserData)
{
if (hasChanges)
{
@@ -1085,7 +1086,7 @@ namespace Lucene.Net.Index
}
}
- private void CommitChanges(System.Collections.Generic.IDictionary<string, string> commitUserData)
+ private void CommitChanges(IDictionary<string, string> commitUserData)
{
if (deletedDocsDirty)
{ // re-write deleted
@@ -1129,10 +1130,8 @@ namespace Lucene.Net.Index
if (normsDirty)
{ // re-write norms
si.SetNumFields(core.fieldInfos.Size());
- System.Collections.IEnumerator it = norms.Values.GetEnumerator();
- while (it.MoveNext())
+ foreach (Norm norm in norms.Values)
{
- Norm norm = (Norm)it.Current;
if (norm.dirty)
{
norm.ReWrite(si);
@@ -1161,12 +1160,12 @@ namespace Lucene.Net.Index
// null so if an app hangs on to us we still free most ram
deletedDocs = null;
}
+
+ foreach (Norm norm in norms.Values)
+ {
+ norm.DecRef();
+ }
- System.Collections.IEnumerator it = norms.Values.GetEnumerator();
- while (it.MoveNext())
- {
- ((Norm) it.Current).DecRef();
- }
if (core != null)
{
core.DecRef();
@@ -1237,7 +1236,7 @@ namespace Lucene.Net.Index
}
}
- internal virtual System.Collections.Generic.IList<string> Files()
+ internal virtual IList<string> Files()
{
return si.Files();
}
@@ -1324,11 +1323,11 @@ namespace Lucene.Net.Index
/// <seealso cref="IndexReader.GetFieldNames(IndexReader.FieldOption)">
/// </seealso>
- public override System.Collections.Generic.ICollection<string> GetFieldNames(IndexReader.FieldOption fieldOption)
+ public override ICollection<string> GetFieldNames(IndexReader.FieldOption fieldOption)
{
EnsureOpen();
- System.Collections.Generic.IDictionary<string, string> fieldSet = new System.Collections.Generic.Dictionary<string, string>();
+ IDictionary<string, string> fieldSet = new Dictionary<string, string>();
for (int i = 0; i < core.fieldInfos.Size(); i++)
{
FieldInfo fi = core.fieldInfos.FieldInfo(i);
@@ -1386,7 +1385,7 @@ namespace Lucene.Net.Index
lock (this)
{
EnsureOpen();
- return norms.Contains(field);
+ return norms.ContainsKey(field);
}
}
@@ -1415,7 +1414,7 @@ namespace Lucene.Net.Index
{
lock (this)
{
- Norm norm = (Norm) norms[field];
+ Norm norm = norms[field];
if (norm == null)
return null; // not indexed, or norms not stored
return norm.Bytes();
@@ -1437,7 +1436,7 @@ namespace Lucene.Net.Index
protected internal override void DoSetNorm(int doc, System.String field, byte value_Renamed)
{
- Norm norm = (Norm) norms[field];
+ Norm norm = norms[field];
if (norm == null)
// not an indexed field
return ;
@@ -1453,7 +1452,7 @@ namespace Lucene.Net.Index
{
EnsureOpen();
- Norm norm = (Norm) norms[field];
+ Norm norm = norms[field];
if (norm == null)
{
for (int i = offset; i < bytes.Length; i++)
@@ -1475,7 +1474,7 @@ namespace Lucene.Net.Index
for (int i = 0; i < core.fieldInfos.Size(); i++)
{
FieldInfo fi = core.fieldInfos.FieldInfo(i);
- if (norms.Contains(fi.name))
+ if (norms.ContainsKey(fi.name))
{
// in case this SegmentReader is being re-opened, we might be able to
// reuse some norm instances and skip loading them here
@@ -1546,22 +1545,20 @@ namespace Lucene.Net.Index
{
return false;
}
- System.Collections.IEnumerator it = norms.Values.GetEnumerator();
- while (it.MoveNext())
- {
- Norm norm = (Norm) it.Current;
- if (norm.refCount > 0)
- {
- return false;
- }
- }
+ foreach (Norm norm in norms.Values)
+ {
+ if (norm.refCount > 0)
+ {
+ return false;
+ }
+ }
return true;
}
// for testing only
public /*internal*/ virtual bool NormsClosed(System.String field)
{
- Norm norm = (Norm) norms[field];
+ Norm norm = norms[field];
return norm.refCount == 0;
}
@@ -1692,12 +1689,10 @@ namespace Lucene.Net.Index
rollbackDeletedDocsDirty = deletedDocsDirty;
rollbackNormsDirty = normsDirty;
rollbackPendingDeleteCount = pendingDeleteCount;
- System.Collections.IEnumerator it = norms.Values.GetEnumerator();
- while (it.MoveNext())
- {
- Norm norm = (Norm) it.Current;
- norm.rollbackDirty = norm.dirty;
- }
+ foreach (Norm norm in norms.Values)
+ {
+ norm.rollbackDirty = norm.dirty;
+ }
}
internal virtual void RollbackCommit()
@@ -1707,12 +1702,10 @@ namespace Lucene.Net.Index
deletedDocsDirty = rollbackDeletedDocsDirty;
normsDirty = rollbackNormsDirty;
pendingDeleteCount = rollbackPendingDeleteCount;
- System.Collections.IEnumerator it = norms.Values.GetEnumerator();
- while (it.MoveNext())
- {
- Norm norm = (Norm) it.Current;
- norm.dirty = norm.rollbackDirty;
- }
+ foreach (Norm norm in norms.Values)
+ {
+ norm.dirty = norm.rollbackDirty;
+ }
}
/// <summary>Returns the directory this index resides in. </summary>
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SnapshotDeletionPolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SnapshotDeletionPolicy.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SnapshotDeletionPolicy.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SnapshotDeletionPolicy.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using Directory = Lucene.Net.Store.Directory;
@@ -141,7 +142,7 @@ namespace Lucene.Net.Index
{
return cp.GetSegmentsFileName();
}
- public override System.Collections.Generic.ICollection<string> GetFileNames()
+ public override ICollection<string> GetFileNames()
{
return cp.GetFileNames();
}
@@ -171,7 +172,7 @@ namespace Lucene.Net.Index
{
return cp.GetGeneration();
}
- public override System.Collections.Generic.IDictionary<string, string> GetUserData()
+ public override IDictionary<string, string> GetUserData()
{
return cp.GetUserData();
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SortedTermVectorMapper.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SortedTermVectorMapper.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SortedTermVectorMapper.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SortedTermVectorMapper.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
namespace Lucene.Net.Index
{
@@ -32,7 +33,7 @@ namespace Lucene.Net.Index
{
- private System.Collections.Generic.SortedDictionary<System.Object, System.Object> currentSet;
+ private SortedDictionary<System.Object, System.Object> currentSet;
private System.Collections.IDictionary termToTVE = new System.Collections.Hashtable();
private bool storeOffsets;
private bool storePositions;
@@ -42,14 +43,14 @@ namespace Lucene.Net.Index
/// <summary> </summary>
/// <param name="comparator">A Comparator for sorting {@link TermVectorEntry}s
/// </param>
- public SortedTermVectorMapper(System.Collections.Generic.IComparer<System.Object> comparator):this(false, false, comparator)
+ public SortedTermVectorMapper(IComparer<System.Object> comparator):this(false, false, comparator)
{
}
- public SortedTermVectorMapper(bool ignoringPositions, bool ignoringOffsets, System.Collections.Generic.IComparer<System.Object> comparator):base(ignoringPositions, ignoringOffsets)
+ public SortedTermVectorMapper(bool ignoringPositions, bool ignoringOffsets, IComparer<System.Object> comparator):base(ignoringPositions, ignoringOffsets)
{
- currentSet = new System.Collections.Generic.SortedDictionary<System.Object, System.Object>(comparator);
+ currentSet = new SortedDictionary<System.Object, System.Object>(comparator);
}
/// <summary> </summary>
@@ -124,7 +125,7 @@ namespace Lucene.Net.Index
/// </summary>
/// <returns> The SortedSet of {@link TermVectorEntry}.
/// </returns>
- public virtual System.Collections.Generic.SortedDictionary<Object, Object> GetTermVectorEntrySet()
+ public virtual SortedDictionary<Object, Object> GetTermVectorEntrySet()
{
return currentSet;
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorEntryFreqSortedComparator.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorEntryFreqSortedComparator.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorEntryFreqSortedComparator.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorEntryFreqSortedComparator.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
namespace Lucene.Net.Index
{
@@ -26,7 +27,7 @@ namespace Lucene.Net.Index
///
/// </summary>
//public class TermVectorEntryFreqSortedComparator : System.Collections.IComparer
- public class TermVectorEntryFreqSortedComparator : System.Collections.Generic.IComparer<System.Object>
+ public class TermVectorEntryFreqSortedComparator : IComparer<System.Object>
{
public virtual int Compare(System.Object object_Renamed, System.Object object1)
{
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorsTermsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorsTermsWriter.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorsTermsWriter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorsTermsWriter.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using IndexOutput = Lucene.Net.Store.IndexOutput;
using RAMOutputStream = Lucene.Net.Store.RAMOutputStream;
@@ -57,8 +58,8 @@ namespace Lucene.Net.Index
for (int i = start; i < end; i++)
postings[i] = new PostingList();
}
-
- public override void Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
+
+ public override void Flush(SupportClass.Dictionary<TermsHashConsumerPerThread, IList<TermsHashConsumerPerField>> threadsAndFields, SegmentWriteState state)
{
lock (this)
{
@@ -82,17 +83,14 @@ namespace Lucene.Net.Index
tvf.Flush();
}
- System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
- while (it.MoveNext())
- {
- System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry) it.Current;
- System.Collections.IEnumerator it2 = ((System.Collections.ICollection) entry.Value).GetEnumerator();
- while (it2.MoveNext())
- {
- TermVectorsTermsWriterPerField perField = (TermVectorsTermsWriterPerField) ((System.Collections.DictionaryEntry) it2.Current).Key;
- perField.termsHashPerField.Reset();
- perField.ShrinkHash();
- }
+ foreach(KeyValuePair<TermsHashConsumerPerThread,IList<TermsHashConsumerPerField>> entry in threadsAndFields) {
+ foreach (TermsHashConsumerPerField field in entry.Value )
+ {
+ TermVectorsTermsWriterPerField perField = (TermVectorsTermsWriterPerField) field;
+ perField.termsHashPerField.Reset();
+ perField.ShrinkHash();
+ }
+
TermVectorsTermsWriterPerThread perThread = (TermVectorsTermsWriterPerThread) entry.Key;
perThread.termsHashPerThread.Reset(true);
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermsHash.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermsHash.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermsHash.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermsHash.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using ArrayUtil = Lucene.Net.Util.ArrayUtil;
@@ -120,48 +121,44 @@ namespace Lucene.Net.Index
nextTermsHash.CloseDocStore(state);
}
}
-
- internal override void Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
+
+ internal override void Flush(SupportClass.Dictionary<InvertedDocConsumerPerThread, IList<InvertedDocConsumerPerField>> threadsAndFields, SegmentWriteState state)
{
lock (this)
{
- System.Collections.IDictionary childThreadsAndFields = new System.Collections.Hashtable();
- System.Collections.IDictionary nextThreadsAndFields;
+ SupportClass.Dictionary<TermsHashConsumerPerThread, IList<TermsHashConsumerPerField>> childThreadsAndFields = new SupportClass.Dictionary<TermsHashConsumerPerThread, IList<TermsHashConsumerPerField>>();
+ SupportClass.Dictionary<InvertedDocConsumerPerThread,IList<InvertedDocConsumerPerField>> nextThreadsAndFields;
if (nextTermsHash != null)
{
- nextThreadsAndFields = new System.Collections.Hashtable();
+ nextThreadsAndFields = new SupportClass.Dictionary<InvertedDocConsumerPerThread, IList<InvertedDocConsumerPerField>>();
}
else
nextThreadsAndFields = null;
- System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
- while (it.MoveNext())
- {
-
- System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry) it.Current;
-
+ foreach (KeyValuePair<InvertedDocConsumerPerThread, IList<InvertedDocConsumerPerField>> entry in threadsAndFields)
+ {
TermsHashPerThread perThread = (TermsHashPerThread) entry.Key;
+
+ IList<InvertedDocConsumerPerField> fields = entry.Value;
- System.Collections.ICollection fields = (System.Collections.ICollection) entry.Value;
-
- System.Collections.IEnumerator fieldsIt = fields.GetEnumerator();
- System.Collections.Hashtable childFields = new System.Collections.Hashtable();
- System.Collections.Hashtable nextChildFields;
+ IEnumerator<InvertedDocConsumerPerField> fieldsIt = fields.GetEnumerator();
+ List<TermsHashConsumerPerField> childFields = new List<TermsHashConsumerPerField>();
+ List<InvertedDocConsumerPerField> nextChildFields;
if (nextTermsHash != null)
{
- nextChildFields = new System.Collections.Hashtable();
+ nextChildFields = new List<InvertedDocConsumerPerField>();
}
else
nextChildFields = null;
while (fieldsIt.MoveNext())
{
- TermsHashPerField perField = (TermsHashPerField) ((System.Collections.DictionaryEntry) fieldsIt.Current).Key;
- childFields[perField.consumer] = perField.consumer;
+ TermsHashPerField perField = (TermsHashPerField) fieldsIt.Current;
+ childFields.Add(perField.consumer);
if (nextTermsHash != null)
- nextChildFields[perField.nextPerField] = perField.nextPerField;
+ nextChildFields.Add(perField.nextPerField);
}
childThreadsAndFields[perThread.consumer] = childFields;
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermsHashConsumer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermsHashConsumer.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermsHashConsumer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermsHashConsumer.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
namespace Lucene.Net.Index
{
@@ -25,7 +26,7 @@ namespace Lucene.Net.Index
internal abstract int BytesPerPosting();
internal abstract void CreatePostings(RawPostingList[] postings, int start, int count);
public abstract TermsHashConsumerPerThread AddThread(TermsHashPerThread perThread);
- public abstract void Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state);
+ public abstract void Flush(SupportClass.Dictionary<TermsHashConsumerPerThread, IList<TermsHashConsumerPerField>> threadsAndFields, SegmentWriteState state);
public abstract void Abort();
internal abstract void CloseDocStore(SegmentWriteState state);
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/BooleanQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/BooleanQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/BooleanQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/BooleanQuery.cs Mon Apr 25 16:17:36 2011
@@ -586,7 +586,7 @@ namespace Lucene.Net.Search
}
// inherit javadoc
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
for (System.Collections.IEnumerator i = clauses.GetEnumerator(); i.MoveNext(); )
{
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/ConstantScoreQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/ConstantScoreQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/ConstantScoreQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/ConstantScoreQuery.cs Mon Apr 25 16:17:36 2011
@@ -50,7 +50,7 @@ namespace Lucene.Net.Search
return this;
}
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
// OK to not add any terms when used for MultiSearcher,
// but may not be OK for highlighting
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/DisjunctionMaxQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/DisjunctionMaxQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/DisjunctionMaxQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/DisjunctionMaxQuery.cs Mon Apr 25 16:17:36 2011
@@ -264,7 +264,7 @@ namespace Lucene.Net.Search
}
// inherit javadoc
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
for (System.Collections.IEnumerator iter = disjuncts.GetEnumerator(); iter.MoveNext(); )
{
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/FilteredQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/FilteredQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/FilteredQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/FilteredQuery.cs Mon Apr 25 16:17:36 2011
@@ -298,7 +298,7 @@ namespace Lucene.Net.Search
}
// inherit javadoc
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
GetQuery().ExtractTerms(terms);
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Function/CustomScoreQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Function/CustomScoreQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Function/CustomScoreQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Function/CustomScoreQuery.cs Mon Apr 25 16:17:36 2011
@@ -113,7 +113,7 @@ namespace Lucene.Net.Search.Function
}
/*(non-Javadoc) @see Lucene.Net.Search.Query#extractTerms(java.util.Set) */
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
subQuery.ExtractTerms(terms);
for (int i = 0; i < valSrcQueries.Length; i++)
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Function/ValueSourceQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Function/ValueSourceQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Function/ValueSourceQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Function/ValueSourceQuery.cs Mon Apr 25 16:17:36 2011
@@ -60,7 +60,7 @@ namespace Lucene.Net.Search.Function
}
/*(non-Javadoc) @see Lucene.Net.Search.Query#extractTerms(java.util.Set) */
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
// no terms involved here
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MatchAllDocsQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MatchAllDocsQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MatchAllDocsQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MatchAllDocsQuery.cs Mon Apr 25 16:17:36 2011
@@ -199,7 +199,7 @@ namespace Lucene.Net.Search
return new MatchAllDocsWeight(this, searcher);
}
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiPhraseQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiPhraseQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiPhraseQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiPhraseQuery.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using IndexReader = Lucene.Net.Index.IndexReader;
using MultipleTermPositions = Lucene.Net.Index.MultipleTermPositions;
@@ -40,7 +41,7 @@ namespace Lucene.Net.Search
public class MultiPhraseQuery:Query
{
private System.String field;
- private System.Collections.ArrayList termArrays = new System.Collections.ArrayList();
+ private List<Term[]> termArrays = new List<Term[]>();
private System.Collections.ArrayList positions = new System.Collections.ArrayList();
private int slop = 0;
@@ -128,14 +129,14 @@ namespace Lucene.Net.Search
}
// inherit javadoc
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
for (System.Collections.IEnumerator iter = termArrays.GetEnumerator(); iter.MoveNext(); )
{
Term[] arr = (Term[]) iter.Current;
for (int i = 0; i < arr.Length; i++)
{
- SupportClass.CollectionsHelper.AddIfNotContains(terms, arr[i]);
+ terms.Add(arr[i]);
}
}
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiSearcher.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiSearcher.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiSearcher.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiSearcher.cs Mon Apr 25 16:17:36 2011
@@ -394,15 +394,17 @@ namespace Lucene.Net.Search
Query rewrittenQuery = Rewrite(original);
// step 2
- System.Collections.Hashtable terms = new System.Collections.Hashtable();
+ SupportClass.Set<Lucene.Net.Index.Term> terms = new SupportClass.Set<Term>();
rewrittenQuery.ExtractTerms(terms);
// step3
Term[] allTermsArray = new Term[terms.Count];
int index = 0;
- System.Collections.IEnumerator e = terms.Keys.GetEnumerator();
- while (e.MoveNext())
- allTermsArray[index++] = e.Current as Term;
+ foreach (Term t in terms)
+ {
+ allTermsArray[index++] = t;
+ }
+
int[] aggregatedDfs = new int[terms.Count];
for (int i = 0; i < searchables.Length; i++)
{
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Payloads/PayloadSpanUtil.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Payloads/PayloadSpanUtil.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Payloads/PayloadSpanUtil.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Payloads/PayloadSpanUtil.cs Mon Apr 25 16:17:36 2011
@@ -200,7 +200,7 @@ namespace Lucene.Net.Search.Payloads
if (spans.IsPayloadAvailable())
{
//ICollection<byte[]> payload = spans.GetPayload();
- System.Collections.Generic.ICollection<byte[]> payload = spans.GetPayload();
+ ICollection<byte[]> payload = spans.GetPayload();
//IEnumerator<byte[]> it = payload.GetEnumerator();
foreach (byte[] bytes in payload)
{
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/PhraseQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/PhraseQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/PhraseQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/PhraseQuery.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using IndexReader = Lucene.Net.Index.IndexReader;
using Term = Lucene.Net.Index.Term;
@@ -35,7 +36,7 @@ namespace Lucene.Net.Search
public class PhraseQuery:Query
{
private System.String field;
- private SupportClass.EquatableList<Term> terms = new SupportClass.EquatableList<Term>(4);
+ private List<Term> terms = new List<Term>();
private SupportClass.EquatableList<int> positions = new SupportClass.EquatableList<int>(4);
private int maxPosition = 0;
private int slop = 0;
@@ -93,7 +94,7 @@ namespace Lucene.Net.Search
{
if (terms.Count == 0)
field = term.Field();
- else if ((System.Object) term.Field() != (System.Object) field)
+ else if (term.Field() != field)
{
throw new System.ArgumentException("All phrase terms must be in the same field: " + term);
}
@@ -147,7 +148,7 @@ namespace Lucene.Net.Search
InitBlock(enclosingInstance);
this.similarity = Enclosing_Instance.GetSimilarity(searcher);
- idfExp = similarity.idfExplain(Enclosing_Instance.terms, searcher);
+ idfExp = similarity.idfExplain(Enclosing_Instance.terms.ToArray(), searcher);
idf = idfExp.GetIdf();
}
@@ -185,6 +186,7 @@ namespace Lucene.Net.Search
return null;
TermPositions[] tps = new TermPositions[Enclosing_Instance.terms.Count];
+
for (int i = 0; i < Enclosing_Instance.terms.Count; i++)
{
TermPositions p = reader.TermPositions((Term) Enclosing_Instance.terms[i]);
@@ -290,9 +292,10 @@ namespace Lucene.Net.Search
/// <seealso cref="Lucene.Net.Search.Query.ExtractTerms(java.util.Set)">
/// </seealso>
- public override void ExtractTerms(System.Collections.Hashtable queryTerms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> queryTerms)
{
- SupportClass.CollectionsHelper.AddAllIfNotContains(queryTerms, terms);
+ queryTerms.Add(terms);
+ //SupportClass.CollectionsHelper.AddAllIfNotContains(queryTerms, terms);
}
/// <summary>Prints a user-readable version of this query. </summary>
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Query.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Query.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Query.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Query.cs Mon Apr 25 16:17:36 2011
@@ -185,7 +185,7 @@ namespace Lucene.Net.Search
///
/// </summary>
/// <throws> UnsupportedOperationException if this query is not yet rewritten </throws>
- public virtual void ExtractTerms(System.Collections.Hashtable terms)
+ public virtual void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
// needs to be implemented by query subclasses
throw new System.NotSupportedException();
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Similarity.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Similarity.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Similarity.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Similarity.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using FieldInvertState = Lucene.Net.Index.FieldInvertState;
using Term = Lucene.Net.Index.Term;
@@ -713,7 +714,7 @@ namespace Lucene.Net.Search
/// <deprecated> see {@link #idfExplain(Collection, Searcher)}
/// </deprecated>
[Obsolete("see IdfExplain(Collection, Searcher)")]
- public virtual float Idf(System.Collections.ICollection terms, Searcher searcher)
+ public virtual float Idf(IList<Lucene.Net.Index.Term> terms, Searcher searcher)
{
float idf = 0.0f;
System.Collections.IEnumerator i = terms.GetEnumerator();
@@ -740,7 +741,7 @@ namespace Lucene.Net.Search
/// for each term.
/// </returns>
/// <throws> IOException </throws>
- public virtual IDFExplanation idfExplain(System.Collections.ICollection terms, Searcher searcher)
+ public virtual IDFExplanation idfExplain(IList<Lucene.Net.Index.Term> terms, Searcher searcher)
{
if (SupportedMethods.overridesCollectionIDF)
{
@@ -881,15 +882,22 @@ namespace Lucene.Net.Search
private static bool IsMethodOverridden(System.Type clazz, System.String name, System.Type[] params_Renamed)
{
- try
- {
- return clazz.GetMethod(name, (params_Renamed == null)?new System.Type[0]:(System.Type[]) params_Renamed).DeclaringType != typeof(Similarity);
- }
- catch (System.MethodAccessException e)
- {
- // should not happen
- throw new System.SystemException(e.Message, e);
- }
+ try
+ {
+ System.Reflection.MemberInfo mi = clazz.GetMethod(name, params_Renamed);
+ if (mi == null) throw new SystemException("Can not find method \"" + name + "\"");
+ return mi.DeclaringType != typeof(Similarity);
+ //return clazz.GetMethod(name, (params_Renamed == null) ? new System.Type[0] : (System.Type[])params_Renamed).DeclaringType != typeof(Similarity);
+ }
+ catch (System.MethodAccessException e)
+ {
+ // should not happen
+ throw new System.SystemException(e.Message, e);
+ }
+ catch (Exception ex)
+ {
+ throw new SystemException(ex.Message);
+ }
}
/// <deprecated> Remove this when old API is removed!
/// </deprecated>
@@ -899,7 +907,7 @@ namespace Lucene.Net.Search
/// <deprecated> Remove this when old API is removed!
/// </deprecated>
[Obsolete("Remove this when old API is removed! ")]
- private static readonly System.Type[] C_IDF_METHOD_PARAMS = new System.Type[]{typeof(System.Collections.ICollection), typeof(Searcher)};
+ private static readonly System.Type[] C_IDF_METHOD_PARAMS = new System.Type[]{typeof(System.Collections.Generic.IList<Term>), typeof(Searcher)};
}
/// <deprecated> Remove this when old API is removed!
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/FieldMaskingSpanQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/FieldMaskingSpanQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/FieldMaskingSpanQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/FieldMaskingSpanQuery.cs Mon Apr 25 16:17:36 2011
@@ -106,7 +106,7 @@ namespace Lucene.Net.Search.Spans
return maskedQuery.GetTerms();
}
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
maskedQuery.ExtractTerms(terms);
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/NearSpansOrdered.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/NearSpansOrdered.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/NearSpansOrdered.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/NearSpansOrdered.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using IndexReader = Lucene.Net.Index.IndexReader;
@@ -87,7 +88,7 @@ namespace Lucene.Net.Search.Spans
private int matchDoc = - 1;
private int matchStart = - 1;
private int matchEnd = - 1;
- private System.Collections.Generic.List<byte[]> matchPayload;
+ private List<byte[]> matchPayload;
private Spans[] subSpansByDoc;
private System.Collections.IComparer spanDocComparator;
@@ -110,7 +111,7 @@ namespace Lucene.Net.Search.Spans
allowedSlop = spanNearQuery.GetSlop();
SpanQuery[] clauses = spanNearQuery.GetClauses();
subSpans = new Spans[clauses.Length];
- matchPayload = new System.Collections.Generic.List<byte[]>();
+ matchPayload = new List<byte[]>();
subSpansByDoc = new Spans[clauses.Length];
for (int i = 0; i < clauses.Length; i++)
{
@@ -145,7 +146,7 @@ namespace Lucene.Net.Search.Spans
// TODO: Remove warning after API has been finalized
// TODO: Would be nice to be able to lazy load payloads
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
+ public override ICollection<byte[]> GetPayload()
{
return matchPayload;
}
@@ -323,10 +324,10 @@ namespace Lucene.Net.Search.Spans
{
matchStart = subSpans[subSpans.Length - 1].Start();
matchEnd = subSpans[subSpans.Length - 1].End();
- System.Collections.Generic.Dictionary<byte[], byte[]> possibleMatchPayloads = new System.Collections.Generic.Dictionary<byte[], byte[]>();
+ Dictionary<byte[], byte[]> possibleMatchPayloads = new Dictionary<byte[], byte[]>();
if (subSpans[subSpans.Length - 1].IsPayloadAvailable())
{
- System.Collections.Generic.ICollection<byte[]> payload = subSpans[subSpans.Length - 1].GetPayload();
+ ICollection<byte[]> payload = subSpans[subSpans.Length - 1].GetPayload();
foreach(byte[] pl in payload)
{
if (!possibleMatchPayloads.ContainsKey(pl))
@@ -336,7 +337,7 @@ namespace Lucene.Net.Search.Spans
}
}
- System.Collections.Generic.List<byte[]> possiblePayload = null;
+ List<byte[]> possiblePayload = null;
int matchSlop = 0;
int lastStart = matchStart;
@@ -346,8 +347,8 @@ namespace Lucene.Net.Search.Spans
Spans prevSpans = subSpans[i];
if (collectPayloads && prevSpans.IsPayloadAvailable())
{
- System.Collections.Generic.ICollection<byte[]> payload = prevSpans.GetPayload();
- possiblePayload = new System.Collections.Generic.List<byte[]>(payload.Count);
+ ICollection<byte[]> payload = prevSpans.GetPayload();
+ possiblePayload = new List<byte[]>(payload.Count);
possiblePayload.AddRange(payload);
}
@@ -382,8 +383,8 @@ namespace Lucene.Net.Search.Spans
prevEnd = ppEnd;
if (collectPayloads && prevSpans.IsPayloadAvailable())
{
- System.Collections.Generic.ICollection<byte[]> payload = prevSpans.GetPayload();
- possiblePayload = new System.Collections.Generic.List<byte[]>(payload.Count);
+ ICollection<byte[]> payload = prevSpans.GetPayload();
+ possiblePayload = new List<byte[]>(payload.Count);
possiblePayload.AddRange(payload);
}
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/NearSpansUnordered.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/NearSpansUnordered.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/NearSpansUnordered.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/NearSpansUnordered.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using IndexReader = Lucene.Net.Index.IndexReader;
using PriorityQueue = Lucene.Net.Util.PriorityQueue;
@@ -155,7 +156,7 @@ namespace Lucene.Net.Search.Spans
return spans.End();
}
// TODO: Remove warning after API has been finalized
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
+ public override ICollection<byte[]> GetPayload()
{
return spans.GetPayload();
}
@@ -318,15 +319,15 @@ namespace Lucene.Net.Search.Spans
/// <returns> Collection of <code>byte[]</code> payloads
/// </returns>
/// <throws> IOException </throws>
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
+ public override ICollection<byte[]> GetPayload()
{
//mgarski: faking out another HashSet<T>...
- System.Collections.Generic.Dictionary<byte[], byte[]> matchPayload = new System.Collections.Generic.Dictionary<byte[], byte[]>();
+ Dictionary<byte[], byte[]> matchPayload = new Dictionary<byte[], byte[]>();
for (SpansCell cell = first; cell != null; cell = cell.next)
{
if (cell.IsPayloadAvailable())
{
- System.Collections.Generic.ICollection<byte[]> cellPayload = cell.GetPayload();
+ ICollection<byte[]> cellPayload = cell.GetPayload();
foreach (byte[] val in cellPayload)
{
if (!matchPayload.ContainsKey(val))
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanFirstQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanFirstQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanFirstQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanFirstQuery.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using IndexReader = Lucene.Net.Index.IndexReader;
using ToStringUtils = Lucene.Net.Util.ToStringUtils;
@@ -85,9 +86,9 @@ namespace Lucene.Net.Search.Spans
}
// TODO: Remove warning after API has been finalized
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
+ public override ICollection<byte[]> GetPayload()
{
- System.Collections.Generic.ICollection<byte[]> result = null;
+ ICollection<byte[]> result = null;
if (spans.IsPayloadAvailable())
{
result = spans.GetPayload();
@@ -165,7 +166,7 @@ namespace Lucene.Net.Search.Spans
return spanFirstQuery;
}
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
match.ExtractTerms(terms);
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanNearQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanNearQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanNearQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanNearQuery.cs Mon Apr 25 16:17:36 2011
@@ -112,7 +112,7 @@ namespace Lucene.Net.Search.Spans
return terms;
}
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
foreach (SpanQuery clause in clauses)
{
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanNotQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanNotQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanNotQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanNotQuery.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using IndexReader = Lucene.Net.Index.IndexReader;
using ToStringUtils = Lucene.Net.Util.ToStringUtils;
@@ -121,9 +122,9 @@ namespace Lucene.Net.Search.Spans
}
// TODO: Remove warning after API has been finalizedb
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
+ public override ICollection<byte[]> GetPayload()
{
- System.Collections.Generic.ICollection<byte[]> result = null;
+ ICollection<byte[]> result = null;
if (includeSpans.IsPayloadAvailable())
{
result = includeSpans.GetPayload();
@@ -185,7 +186,7 @@ namespace Lucene.Net.Search.Spans
return include.GetTerms();
}
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
include.ExtractTerms(terms);
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanOrQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanOrQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanOrQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanOrQuery.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using IndexReader = Lucene.Net.Index.IndexReader;
using PriorityQueue = Lucene.Net.Util.PriorityQueue;
@@ -138,9 +139,9 @@ namespace Lucene.Net.Search.Spans
}
// TODO: Remove warning after API has been finalized
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
+ public override ICollection<byte[]> GetPayload()
{
- System.Collections.Generic.ICollection<byte[]> result = null;
+ ICollection<byte[]> result = null;
Spans theTop = Top();
if (theTop != null && theTop.IsPayloadAvailable())
{
@@ -215,7 +216,7 @@ namespace Lucene.Net.Search.Spans
return terms;
}
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
System.Collections.IEnumerator i = clauses.GetEnumerator();
while (i.MoveNext())
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanTermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanTermQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanTermQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanTermQuery.cs Mon Apr 25 16:17:36 2011
@@ -59,9 +59,9 @@ namespace Lucene.Net.Search.Spans
terms.Add(term);
return terms;
}
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
- SupportClass.CollectionsHelper.AddIfNotContains(terms, term);
+ terms.Add(term);
}
public override System.String ToString(System.String field)
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanWeight.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanWeight.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanWeight.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/SpanWeight.cs Mon Apr 25 16:17:36 2011
@@ -34,7 +34,7 @@ namespace Lucene.Net.Search.Spans
protected internal float queryNorm;
protected internal float queryWeight;
- protected internal System.Collections.Hashtable terms;
+ protected internal SupportClass.Set<Lucene.Net.Index.Term> terms;
protected internal SpanQuery query;
private IDFExplanation idfExp;
@@ -42,9 +42,9 @@ namespace Lucene.Net.Search.Spans
{
this.similarity = query.GetSimilarity(searcher);
this.query = query;
- terms = new System.Collections.Hashtable();
+ terms = new SupportClass.Set<Lucene.Net.Index.Term>();
query.ExtractTerms(terms);
- idfExp = similarity.idfExplain(new System.Collections.ArrayList(terms.Values), searcher);
+ idfExp = similarity.idfExplain(terms.ToArray(), searcher);
idf = idfExp.GetIdf();
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/TermSpans.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/TermSpans.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/TermSpans.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/TermSpans.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using Term = Lucene.Net.Index.Term;
using TermPositions = Lucene.Net.Index.TermPositions;
@@ -96,11 +97,11 @@ namespace Lucene.Net.Search.Spans
}
// TODO: Remove warning after API has been finalized
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
+ public override ICollection<byte[]> GetPayload()
{
byte[] bytes = new byte[positions.GetPayloadLength()];
bytes = positions.GetPayload(bytes, 0);
- System.Collections.Generic.List<byte[]> val = new System.Collections.Generic.List<byte[]>();
+ List<byte[]> val = new List<byte[]>();
val.Add(bytes);
return val;
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/TermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/TermQuery.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/TermQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/TermQuery.cs Mon Apr 25 16:17:36 2011
@@ -176,9 +176,9 @@ namespace Lucene.Net.Search
return new TermWeight(this, searcher);
}
- public override void ExtractTerms(System.Collections.Hashtable terms)
+ public override void ExtractTerms(SupportClass.Set<Lucene.Net.Index.Term> terms)
{
- SupportClass.CollectionsHelper.AddIfNotContains(terms, GetTerm());
+ terms.Add(GetTerm());
}
/// <summary>Prints a user-readable version of this query. </summary>
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/IndexInput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/IndexInput.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/IndexInput.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/IndexInput.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
namespace Lucene.Net.Store
{
@@ -260,9 +261,9 @@ namespace Lucene.Net.Store
}
// returns Map<String, String>
- public virtual System.Collections.Generic.IDictionary<string,string> ReadStringStringMap()
+ public virtual IDictionary<string,string> ReadStringStringMap()
{
- System.Collections.Generic.Dictionary<string, string> map = new System.Collections.Generic.Dictionary<string, string>();
+ Dictionary<string, string> map = new Dictionary<string, string>();
int count = ReadInt();
for (int i = 0; i < count; i++)
{
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/SupportClass.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/SupportClass.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/SupportClass.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/SupportClass.cs Mon Apr 25 16:17:36 2011
@@ -1406,6 +1406,68 @@ public class SupportClass
}
#endregion
+ public class Dictionary<K, V> : System.Collections.Generic.Dictionary<K, V>
+ {
+ public Dictionary() : base()
+ {
+ }
+
+ public Dictionary(System.Collections.Generic.Dictionary<K, V> dict) : base(dict)
+ {
+ }
+
+ public Dictionary(int capacity) : base(capacity)
+ {
+ }
+
+ public new V this[K key]
+ {
+ set
+ {
+ base[key] = value;
+ }
+ get
+ {
+ V val = default(V);
+ base.TryGetValue(key, out val);
+ return val;
+ }
+ }
+ }
+
+ [Serializable]
+ public class Set<T> : System.Collections.Generic.List<T>
+ {
+ System.Collections.Generic.HashSet<T> _Set = new System.Collections.Generic.HashSet<T>();
+
+ public new void Add(T item)
+ {
+ if (_Set.Contains(item)) return;
+ _Set.Add(item);
+ base.Add(item);
+ }
+
+ public void Add(SupportClass.Set<T> items)
+ {
+ foreach(T item in items)
+ {
+ if(_Set.Contains(item)) continue;
+ _Set.Add(item);
+ base.Add(item);
+ }
+ }
+
+ public void Add(System.Collections.Generic.IList<T> items)
+ {
+ foreach (T item in items)
+ {
+ if (_Set.Contains(item)) continue;
+ _Set.Add(item);
+ base.Add(item);
+ }
+ }
+ }
+
public class Cryptography
{
static public bool FIPSCompliant = false;
@@ -1525,6 +1587,17 @@ public class SupportClass
}
+ public static System.String CollectionToString<T>(System.Collections.Generic.IList<T> c)
+ {
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ for(int i=0;i<c.Count;i++)
+ {
+ sb.Append(c[i].ToString());
+ if (i != c.Count - 1) sb.Append(", ");
+ }
+ return sb.ToString();
+ }
+
public static System.String CollectionToString(System.Collections.Generic.IDictionary<string, string> c)
{
Hashtable t = new Hashtable();
@@ -1647,6 +1720,13 @@ public class SupportClass
}
}
+ public static void Sort<T1>(System.Collections.Generic.IList<T1> list,System.Collections.Generic.IComparer<T1> Comparator)
+ {
+ if(list.IsReadOnly) throw new System.NotSupportedException();
+ if (Comparator == null) ((System.Collections.Generic.List<T1>)list).Sort();
+ else ((System.Collections.Generic.List<T1>)list).Sort(Comparator);
+ }
+
/// <summary>
/// Fills the array with an specific value from an specific index to an specific index.
/// </summary>
@@ -2303,3 +2383,12 @@ public class SupportClass
#endif
}
}
+
+namespace System
+{
+ public interface ICloneable<T>
+ {
+ T Clone();
+ }
+}
+
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/AttributeSource.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/AttributeSource.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/AttributeSource.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/AttributeSource.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using TokenStream = Lucene.Net.Analysis.TokenStream;
@@ -138,7 +139,7 @@ namespace Lucene.Net.Util
/// Note that this return value is different from Java in that it enumerates over the values
/// and not the keys
/// </summary>
- public virtual System.Collections.Generic.IEnumerable<Type> GetAttributeClassesIterator()
+ public virtual IEnumerable<Type> GetAttributeClassesIterator()
{
foreach (SupportClass.AttributeImplItem item in this.attributes)
{
@@ -151,7 +152,7 @@ namespace Lucene.Net.Util
/// if one instance implements more than one Attribute interface.
/// Signature for Java 1.5: <code>public Iterator<AttributeImpl> getAttributeImplsIterator()</code>
/// </summary>
- public virtual System.Collections.Generic.IEnumerable<AttributeImpl> GetAttributeImplsIterator()
+ public virtual IEnumerable<AttributeImpl> GetAttributeImplsIterator()
{
if (HasAttributes())
{
@@ -335,7 +336,7 @@ namespace Lucene.Net.Util
{
currentState = new State();
State c = currentState;
- System.Collections.Generic.IEnumerator<SupportClass.AttributeImplItem> it = attributeImpls.GetEnumerator();
+ IEnumerator<SupportClass.AttributeImplItem> it = attributeImpls.GetEnumerator();
if (it.MoveNext())
c.attribute = it.Current.Value;
while (it.MoveNext())
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/IndexableBinaryStringTools.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/IndexableBinaryStringTools.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/IndexableBinaryStringTools.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/IndexableBinaryStringTools.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
// {{Aroush-2.9}} Port issue? Both of those were treated as: System.IO.MemoryStream
//using CharBuffer = java.nio.CharBuffer;
@@ -68,7 +69,7 @@ namespace Lucene.Net.Util
/// <returns> The number of chars required to encode the given byte sequence
/// </returns>
/// <throws> IllegalArgumentException If the given ByteBuffer is not backed by an array </throws>
- public static int GetEncodedLength(System.Collections.Generic.List<byte> original)
+ public static int GetEncodedLength(List<byte> original)
{
return (original.Count == 0) ? 0 : ((original.Count * 8 + 14) / 15) + 1;
}
@@ -81,7 +82,7 @@ namespace Lucene.Net.Util
/// <returns> The number of bytes required to decode the given char sequence
/// </returns>
/// <throws> IllegalArgumentException If the given CharBuffer is not backed by an array </throws>
- public static int GetDecodedLength(System.Collections.Generic.List<char> encoded)
+ public static int GetDecodedLength(List<char> encoded)
{
int numChars = encoded.Count - 1;
if (numChars <= 0)
@@ -109,7 +110,7 @@ namespace Lucene.Net.Util
/// <throws> IllegalArgumentException If either the input or the output buffer </throws>
/// <summary> is not backed by an array
/// </summary>
- public static void Encode(System.Collections.Generic.List<byte> input, System.Collections.Generic.List<char> output)
+ public static void Encode(List<byte> input, List<char> output)
{
int outputLength = GetEncodedLength(input);
// only adjust capacity if needed
@@ -189,7 +190,7 @@ namespace Lucene.Net.Util
/// <throws> IllegalArgumentException If either the input or the output buffer </throws>
/// <summary> is not backed by an array
/// </summary>
- public static void Decode(System.Collections.Generic.List<char> input, System.Collections.Generic.List<byte> output)
+ public static void Decode(List<char> input, List<byte> output)
{
int numOutputBytes = GetDecodedLength(input);
if (output.Capacity < numOutputBytes)
@@ -283,10 +284,10 @@ namespace Lucene.Net.Util
/// <throws> IllegalArgumentException If the input buffer is not backed by an </throws>
/// <summary> array
/// </summary>
- public static System.Collections.Generic.List<byte> Decode(System.Collections.Generic.List<char> input)
+ public static List<byte> Decode(List<char> input)
{
- System.Collections.Generic.List<byte> output =
- new System.Collections.Generic.List<byte>(new byte[GetDecodedLength(input)]);
+ List<byte> output =
+ new List<byte>(new byte[GetDecodedLength(input)]);
Decode(input, output);
return output;
}
@@ -302,10 +303,10 @@ namespace Lucene.Net.Util
/// <throws> IllegalArgumentException If the input buffer is not backed by an </throws>
/// <summary> array
/// </summary>
- public static System.Collections.Generic.List<char> Encode(System.Collections.Generic.List<byte> input)
+ public static List<char> Encode(List<byte> input)
{
- System.Collections.Generic.List<char> output =
- new System.Collections.Generic.List<char>(new char[GetEncodedLength(input)]);
+ List<char> output =
+ new List<char>(new char[GetEncodedLength(input)]);
Encode(input, output);
return output;
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/MapOfSets.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/MapOfSets.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/MapOfSets.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/MapOfSets.cs Mon Apr 25 16:17:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
namespace Lucene.Net.Util
{
@@ -25,18 +26,18 @@ namespace Lucene.Net.Util
{
// TODO: This will be a HashSet<T> when we start using .NET Framework 3.5
- private System.Collections.Generic.IDictionary<T, System.Collections.Generic.Dictionary<V, V>> theMap;
+ private IDictionary<T, Dictionary<V, V>> theMap;
/// <param name="m">the backing store for this object
/// </param>
- public MapOfSets(System.Collections.Generic.IDictionary<T, System.Collections.Generic.Dictionary<V, V>> m)
+ public MapOfSets(IDictionary<T, Dictionary<V, V>> m)
{
theMap = m;
}
/// <returns> direct access to the map backing this object.
/// </returns>
- public virtual System.Collections.Generic.IDictionary<T, System.Collections.Generic.Dictionary<V, V>> GetMap()
+ public virtual IDictionary<T, Dictionary<V, V>> GetMap()
{
return theMap;
}
@@ -49,10 +50,10 @@ namespace Lucene.Net.Util
public virtual int Put(T key, V val)
{
// TODO: This will be a HashSet<T> when we start using .NET Framework 3.5
- System.Collections.Generic.Dictionary<V, V> theSet;
+ Dictionary<V, V> theSet;
if (!theMap.TryGetValue(key, out theSet))
{
- theSet = new System.Collections.Generic.Dictionary<V, V>(23);
+ theSet = new Dictionary<V, V>(23);
theMap[key] = theSet;
}
if (!theSet.ContainsKey(val))
@@ -67,13 +68,13 @@ namespace Lucene.Net.Util
/// </summary>
/// <returns> the size of the Set associated with key once val is added to it.
/// </returns>
- public virtual int PutAll(T key, System.Collections.Generic.Dictionary<V, V> vals)
+ public virtual int PutAll(T key, Dictionary<V, V> vals)
{
// TODO: This will be a HashSet<T> when we start using .NET Framework 3.5
- System.Collections.Generic.Dictionary<V, V> theSet;
+ Dictionary<V, V> theSet;
if (!theMap.TryGetValue(key, out theSet))
{
- theSet = new System.Collections.Generic.Dictionary<V, V>(23);
+ theSet = new Dictionary<V, V>(23);
theMap[key] = theSet;
}
foreach(V item in vals.Keys)
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/AssemblyInfo.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/AssemblyInfo.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/AssemblyInfo.cs Mon Apr 25 16:17:36 2011
@@ -29,7 +29,7 @@ using System.Runtime.CompilerServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("2.9.4.001")]
+[assembly: AssemblyVersion("2.9.4.002")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestBackwardsCompatibility.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestBackwardsCompatibility.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestBackwardsCompatibility.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestBackwardsCompatibility.cs Mon Apr 25 16:17:36 2011
@@ -210,7 +210,7 @@ namespace Lucene.Net.Index
if (!reader.IsDeleted(i))
{
Document d = reader.Document(i);
- System.Collections.IList fields = d.GetFields();
+ System.Collections.Generic.IList<Lucene.Net.Documents.Fieldable> fields = d.GetFields();
if (!oldName.StartsWith("19.") && !oldName.StartsWith("20.") && !oldName.StartsWith("21.") && !oldName.StartsWith("22."))
{
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestFieldsReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestFieldsReader.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestFieldsReader.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestFieldsReader.cs Mon Apr 25 16:17:36 2011
@@ -249,7 +249,7 @@ namespace Lucene.Net.Index
Document doc = reader.Doc(0, fieldSelector);
Assert.IsTrue(doc != null, "doc is null and it shouldn't be");
int count = 0;
- System.Collections.IList l = doc.GetFields();
+ System.Collections.Generic.IList<Lucene.Net.Documents.Fieldable> l = doc.GetFields();
for (System.Collections.IEnumerator iter = l.GetEnumerator(); iter.MoveNext(); )
{
Field field = (Field) iter.Current;
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestIndexReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestIndexReader.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestIndexReader.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestIndexReader.cs Mon Apr 25 16:17:36 2011
@@ -1544,8 +1544,8 @@ namespace Lucene.Net.Index
System.Collections.Generic.ICollection<string> fieldsNames1 = index1.GetFieldNames(FieldOption.ALL);
System.Collections.Generic.ICollection<string> fieldsNames2 = index1.GetFieldNames(FieldOption.ALL);
- System.Collections.ICollection fields1 = null;
- System.Collections.ICollection fields2 = null;
+ System.Collections.Generic.IList<Fieldable> fields1 = null;
+ System.Collections.Generic.IList<Fieldable> fields2 = null;
Assert.AreEqual(fieldsNames1.Count, fieldsNames2.Count, "IndexReaders have different numbers of fields.");
System.Collections.IEnumerator it1 = fieldsNames1.GetEnumerator();
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestLazyBug.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestLazyBug.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestLazyBug.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestLazyBug.cs Mon Apr 25 16:17:36 2011
@@ -102,7 +102,7 @@ namespace Lucene.Net.Index
Document d = reader.Document(docs[i], SELECTOR);
d.Get(MAGIC_FIELD);
- System.Collections.IList fields = d.GetFields();
+ System.Collections.Generic.IList<Fieldable> fields = d.GetFields();
for (System.Collections.IEnumerator fi = fields.GetEnumerator(); fi.MoveNext(); )
{
Fieldable f = null;
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestOmitTf.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestOmitTf.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestOmitTf.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestOmitTf.cs Mon Apr 25 16:17:36 2011
@@ -224,10 +224,10 @@ namespace Lucene.Net.Index
{
return 2.0f;
}
- public override float Idf(System.Collections.ICollection terms, Searcher searcher)
- {
- return 1.0f;
- }
+ public override float Idf(System.Collections.Generic.IList<Term> terms, Searcher searcher)
+ {
+ return 1.0f;
+ }
public override float Idf(int docFreq, int numDocs)
{
return 1.0f;
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestParallelReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestParallelReader.cs?rev=1096507&r1=1096506&r2=1096507&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestParallelReader.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestParallelReader.cs Mon Apr 25 16:17:36 2011
@@ -97,7 +97,7 @@ namespace Lucene.Net.Index
pr.Add(IndexReader.Open(dir2));
Document doc11 = pr.Document(0, new MapFieldSelector(new System.String[]{"f1"}));
- Document doc24 = pr.Document(1, new MapFieldSelector(new System.Collections.ArrayList(new System.String[]{"f4"})));
+ Document doc24 = pr.Document(1, new MapFieldSelector(new System.Collections.Generic.List<string>(new System.String[]{"f4"})));
Document doc223 = pr.Document(1, new MapFieldSelector(new System.String[]{"f2", "f3"}));
Assert.AreEqual(1, doc11.GetFields().Count);