lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy (JIRA)" <j...@apache.org>
Subject [Lucene.Net] [jira] [Commented] (LUCENENET-412) Replacing ArrayLists, Hashtables etc. with appropriate Generics.
Date Fri, 13 May 2011 19:31:47 GMT

    [ https://issues.apache.org/jira/browse/LUCENENET-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13033235#comment-13033235
] 

Digy commented on LUCENENET-412:
--------------------------------

Some samples to show the diffs of 2.9.4 & 2.9.4g on Readability.
{code}
From:
	((System.Collections.IList) ((System.Collections.ArrayList) segmentInfos).GetRange(start,
start + merge.segments.Count - start)).Clear();
To:
	segmentInfos.RemoveRange(start, start + merge.segments.Count - start);

---------------------------------------------------------------------------------------------------------
From:
	System.Collections.IEnumerator it = ((System.Collections.ICollection) readerToFields[reader]).GetEnumerator();
	while (it.MoveNext())
	{
		if (fieldSelector.Accept((System.String) it.Current) != FieldSelectorResult.NO_LOAD)
		{
			include = true;
			break;
		}
	}
To:
	foreach (string x in readerToFields[reader])
	{
		if (fieldSelector.Accept(x) != FieldSelectorResult.NO_LOAD)
		{
			include = true;
			break;
		}
	}
		
---------------------------------------------------------------------------------------------------------
From:
	for (System.Collections.IEnumerator iter = weights.GetEnumerator(); iter.MoveNext(); )
	{
		((Weight) iter.Current).Normalize(norm);
	}
To:
	foreach(Weight w in weights)
	{
		w.Normalize(norm);
	}

---------------------------------------------------------------------------------------------------------
From:	
	public virtual System.Collections.IList GetTermArrays()
	{
		return (System.Collections.IList) System.Collections.ArrayList.ReadOnly(new System.Collections.ArrayList(termArrays));
	}
To:
	public virtual List<Term[]> GetTermArrays()
	{
		return new List<Term[]>(termArrays);
	}

---------------------------------------------------------------------------------------------------------
From:	
	System.Collections.ArrayList results = new System.Collections.ArrayList();
	....
	return (TermFreqVector[]) results.ToArray(typeof(TermFreqVector));
To:
	 List<TermFreqVector> results = new List<TermFreqVector>();
	 ...
	 return results.ToArray();
	
{code}

DIGY

> Replacing ArrayLists, Hashtables etc. with appropriate Generics.
> ----------------------------------------------------------------
>
>                 Key: LUCENENET-412
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-412
>             Project: Lucene.Net
>          Issue Type: Improvement
>    Affects Versions: Lucene.Net 2.9.4
>            Reporter: Digy
>            Priority: Minor
>             Fix For: Lucene.Net 2.9.4
>
>         Attachments: IEquatable for Query&Subclasses.patch, LUCENENET-412.patch,
lucene_2.9.4g_exceptions_fix
>
>
> This will move Lucene.Net.2.9.4 closer to lucene.3.0.3 and allow some performance gains.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message