You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2015/01/11 01:33:17 UTC
[4/6] lucenenet git commit: without using UnmodifiableList
without using UnmodifiableList
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/6aef0b08
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/6aef0b08
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/6aef0b08
Branch: refs/heads/master
Commit: 6aef0b085aa84fd8cc9b1471cfff18ae09eb8ad0
Parents: da67eb0
Author: Laimonas Simutis <la...@gmail.com>
Authored: Sat Jan 10 08:43:46 2015 -0500
Committer: Laimonas Simutis <la...@gmail.com>
Committed: Sat Jan 10 08:43:46 2015 -0500
----------------------------------------------------------------------
.../Index/CompositeReaderContext.cs | 10 +--
src/Lucene.Net.Core/Lucene.Net.csproj | 1 -
src/Lucene.Net.Core/Support/UnmodifiableList.cs | 82 --------------------
3 files changed, 5 insertions(+), 88 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6aef0b08/src/Lucene.Net.Core/Index/CompositeReaderContext.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/CompositeReaderContext.cs b/src/Lucene.Net.Core/Index/CompositeReaderContext.cs
index b200077..fd425cd 100644
--- a/src/Lucene.Net.Core/Index/CompositeReaderContext.cs
+++ b/src/Lucene.Net.Core/Index/CompositeReaderContext.cs
@@ -40,7 +40,7 @@ namespace Lucene.Net.Index
/// Creates a <seealso cref="CompositeReaderContext"/> for intermediate readers that aren't
/// not top-level readers in the current context
/// </summary>
- internal CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader, int ordInParent, int docbaseInParent, IList<IndexReaderContext> children)
+ internal CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader, int ordInParent, int docbaseInParent, List<IndexReaderContext> children)
: this(parent, reader, ordInParent, docbaseInParent, children, null)
{
}
@@ -48,15 +48,15 @@ namespace Lucene.Net.Index
/// <summary>
/// Creates a <seealso cref="CompositeReaderContext"/> for top-level readers with parent set to <code>null</code>
/// </summary>
- internal CompositeReaderContext(CompositeReader reader, IList<IndexReaderContext> children, IList<AtomicReaderContext> leaves)
+ internal CompositeReaderContext(CompositeReader reader, List<IndexReaderContext> children, IList<AtomicReaderContext> leaves)
: this(null, reader, 0, 0, children, leaves)
{
}
- private CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader, int ordInParent, int docbaseInParent, IList<IndexReaderContext> children, IList<AtomicReaderContext> leaves)
+ private CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader, int ordInParent, int docbaseInParent, List<IndexReaderContext> children, IList<AtomicReaderContext> leaves)
: base(parent, ordInParent, docbaseInParent)
{
- this.children = new UnmodifiableList<IndexReaderContext>(children);
+ this.children = children.AsReadOnly();
this.leaves = leaves;
this.reader = reader;
}
@@ -114,7 +114,7 @@ namespace Lucene.Net.Index
{
CompositeReader cr = (CompositeReader)reader;
var sequentialSubReaders = cr.GetSequentialSubReaders();
- IList<IndexReaderContext> children = Arrays.AsList(new IndexReaderContext[sequentialSubReaders.Count]);
+ var children = Arrays.AsList(new IndexReaderContext[sequentialSubReaders.Count]);
CompositeReaderContext newParent;
if (parent == null)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6aef0b08/src/Lucene.Net.Core/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj
index 5454521..fec1b4f 100644
--- a/src/Lucene.Net.Core/Lucene.Net.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.csproj
@@ -675,7 +675,6 @@
<Compile Include="Support\TextSupport.cs" />
<Compile Include="Support\ThreadClass.cs" />
<Compile Include="Support\ThreadLock.cs" />
- <Compile Include="Support\UnmodifiableList.cs" />
<Compile Include="Support\WeakDictionary.cs" />
<Compile Include="Util\Accountable.cs" />
<Compile Include="Util\ArrayInPlaceMergeSorter.cs" />
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6aef0b08/src/Lucene.Net.Core/Support/UnmodifiableList.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/UnmodifiableList.cs b/src/Lucene.Net.Core/Support/UnmodifiableList.cs
deleted file mode 100644
index 44138f1..0000000
--- a/src/Lucene.Net.Core/Support/UnmodifiableList.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace Lucene.Net.Support
-{
- internal class UnmodifiableList<TValue> : IList<TValue>
- {
- private IList<TValue> _list;
-
- public UnmodifiableList(IList<TValue> list)
- {
- _list = list;
- }
-
- public IEnumerator<TValue> GetEnumerator()
- {
- return _list.GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- public void Add(TValue item)
- {
- throw new InvalidOperationException("Unable to modify this list.");
- }
-
- public void Clear()
- {
- throw new InvalidOperationException("Unable to modify this list.");
- }
-
- public bool Contains(TValue item)
- {
- return _list.Contains(item);
- }
-
- public void CopyTo(TValue[] array, int arrayIndex)
- {
- _list.CopyTo(array, arrayIndex);
- }
-
- public bool Remove(TValue item)
- {
- throw new InvalidOperationException("Unable to modify this list.");
- }
-
- public int Count
- {
- get { return _list.Count; }
- }
-
- public bool IsReadOnly
- {
- get { return true; }
- }
-
- public int IndexOf(TValue item)
- {
- return _list.IndexOf(item);
- }
-
- public void Insert(int index, TValue item)
- {
- throw new InvalidOperationException("Unable to modify this list.");
- }
-
- public void RemoveAt(int index)
- {
- throw new InvalidOperationException("Unable to modify this list.");
- }
-
- public TValue this[int index]
- {
- get { return _list[index]; }
- set { throw new InvalidOperationException("Unable to modify this list."); }
- }
- }
-}
\ No newline at end of file