Browse Source

Remove duplicate MultiDictionary.

newNRvisualizers
Daniel Grunwald 13 years ago
parent
commit
39bd1381d1
  1. 1
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/DependencyRelation.cs
  2. 7
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs
  3. 1
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  4. 116
      src/Main/Base/Project/Src/Util/MultiDictionary.cs

1
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/DependencyRelation.cs

@ -7,6 +7,7 @@ using System.Diagnostics; @@ -7,6 +7,7 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using ICSharpCode.NRefactory.Utils;
using ICSharpCode.SharpDevelop;
namespace ICSharpCode.CppBinding.Project

7
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs

@ -3,28 +3,25 @@ @@ -3,28 +3,25 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Xml;
using System.Xml.Linq;
using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Folding;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Utils;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Bookmarks;
using ICSharpCode.SharpDevelop.Debugging;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
using ICSharpCode.SharpDevelop.Gui;
using Microsoft.Win32;

1
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -741,7 +741,6 @@ @@ -741,7 +741,6 @@
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\DiscoveryNetworkCredential.cs" />
<Compile Include="Src\Services\ProjectService\ProjectLoader.cs" />
<Compile Include="Src\Util\AtomicBoolean.cs" />
<Compile Include="Src\Util\MultiDictionary.cs" />
<Compile Include="Src\Util\DotnetDetection.cs" />
<Compile Include="Src\Util\FakeXmlViewContent.cs" />
<Compile Include="Src\Util\ReactiveExtensions.cs" />

116
src/Main/Base/Project/Src/Util/MultiDictionary.cs

@ -1,116 +0,0 @@ @@ -1,116 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.NRefactory;
namespace ICSharpCode.SharpDevelop
{
/// <summary>
/// A dictionary that allows multiple pairs with the same key.
/// </summary>
public class MultiDictionary<TKey, TValue> : ILookup<TKey, TValue>
{
readonly Dictionary<TKey, List<TValue>> dict;
public MultiDictionary()
{
dict = new Dictionary<TKey, List<TValue>>();
}
public MultiDictionary(IEqualityComparer<TKey> comparer)
{
dict = new Dictionary<TKey, List<TValue>>(comparer);
}
public void Add(TKey key, TValue value)
{
List<TValue> valueList;
if (!dict.TryGetValue(key, out valueList)) {
valueList = new List<TValue>();
dict.Add(key, valueList);
}
valueList.Add(value);
}
public bool Remove(TKey key, TValue value)
{
List<TValue> valueList;
if (dict.TryGetValue(key, out valueList)) {
if (valueList.Remove(value)) {
if (valueList.Count == 0)
dict.Remove(key);
return true;
}
}
return false;
}
public void Clear()
{
dict.Clear();
}
public IReadOnlyList<TValue> this[TKey key] {
get {
List<TValue> list;
if (dict.TryGetValue(key, out list))
return list;
else
return new TValue[0];
}
}
public int Count {
get { return dict.Count; }
}
IEnumerable<TValue> ILookup<TKey, TValue>.this[TKey key] {
get { return this[key]; }
}
bool ILookup<TKey, TValue>.Contains(TKey key)
{
return dict.ContainsKey(key);
}
public IEnumerator<IGrouping<TKey, TValue>> GetEnumerator()
{
foreach (var pair in dict)
yield return new Grouping(pair.Key, pair.Value);
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
sealed class Grouping : IGrouping<TKey, TValue>
{
readonly TKey key;
readonly List<TValue> values;
public Grouping(TKey key, List<TValue> values)
{
this.key = key;
this.values = values;
}
public TKey Key {
get { return key; }
}
public IEnumerator<TValue> GetEnumerator()
{
return values.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return values.GetEnumerator();
}
}
}
}
Loading…
Cancel
Save