From f9b47e69c825de52c13f63f7f91b6ea8d6c5380d Mon Sep 17 00:00:00 2001 From: Jb Evain Date: Thu, 1 Apr 2010 17:28:00 +0000 Subject: [PATCH] 2010-04-01 Jb Evain * SortedSet.cs: fix API. svn path=/trunk/mcs/; revision=154654 --- .../System/System.Collections.Generic/ChangeLog | 4 ++ .../System/System.Collections.Generic/SortedSet.cs | 52 ++++++++++++++-------- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/mcs/class/System/System.Collections.Generic/ChangeLog b/mcs/class/System/System.Collections.Generic/ChangeLog index 200ed5345d6..9b4d4d01bcc 100644 --- a/mcs/class/System/System.Collections.Generic/ChangeLog +++ b/mcs/class/System/System.Collections.Generic/ChangeLog @@ -1,5 +1,9 @@ 2010-04-01 Jb Evain + * SortedSet.cs: fix API. + +2010-04-01 Jb Evain + * SortedSet.cs: add new SortedSet type in .net 4.0 2010-03-03 Miguel de Icaza diff --git a/mcs/class/System/System.Collections.Generic/SortedSet.cs b/mcs/class/System/System.Collections.Generic/SortedSet.cs index 3793dadc567..55100e94e14 100644 --- a/mcs/class/System/System.Collections.Generic/SortedSet.cs +++ b/mcs/class/System/System.Collections.Generic/SortedSet.cs @@ -100,10 +100,25 @@ namespace System.Collections.Generic { SerializationInfo si; public SortedSet () - : this (null as IComparer) + : this (Comparer.Default) { } + public SortedSet (IEnumerable collection) + : this (collection, Comparer.Default) + { + } + + public SortedSet (IEnumerable collection, IComparer comparer) + : this (comparer) + { + if (collection == null) + throw new ArgumentNullException ("collection"); + + foreach (var item in collection) + Add (item); + } + public SortedSet (IComparer comparer) { this.helper = NodeHelper.GetHelper (comparer); @@ -133,7 +148,7 @@ namespace System.Collections.Generic { get { throw new NotImplementedException (); } } - public virtual bool Add (T item) + public bool Add (T item) { var node = new Node (item); return tree.Intern (item, node) == node; @@ -154,7 +169,7 @@ namespace System.Collections.Generic { CopyTo (array, 0, Count); } - public virtual void CopyTo (T [] array, int index) + public void CopyTo (T [] array, int index) { CopyTo (array, index, Count); } @@ -178,7 +193,7 @@ namespace System.Collections.Generic { } } - public virtual bool Remove (T item) + public bool Remove (T item) { return tree.Remove (item) != null; } @@ -247,13 +262,13 @@ namespace System.Collections.Generic { } [MonoTODO] - public virtual void ExceptWith (IEnumerable other) + public void ExceptWith (IEnumerable other) { throw new NotImplementedException (); } [MonoTODO] - public virtual void GetViewBetween (T lowerValue, T upperValue) + public virtual SortedSet GetViewBetween (T lowerValue, T upperValue) { throw new NotImplementedException (); } @@ -265,62 +280,61 @@ namespace System.Collections.Generic { } [MonoTODO] - public virtual bool IsProperSubsetOf (IEnumerable other) + public bool IsProperSubsetOf (IEnumerable other) { throw new NotImplementedException (); } [MonoTODO] - public virtual bool IsProperSupersetOf (IEnumerable other) + public bool IsProperSupersetOf (IEnumerable other) { throw new NotImplementedException (); } [MonoTODO] - public virtual bool IsSubsetOf (IEnumerable other) + public bool IsSubsetOf (IEnumerable other) { throw new NotImplementedException (); } [MonoTODO] - public virtual bool IsSupersetOf (IEnumerable other) + public bool IsSupersetOf (IEnumerable other) { throw new NotImplementedException (); } [MonoTODO] - public virtual bool IsPropertSubsetOf (IEnumerable other) + public bool Overlaps (IEnumerable other) { throw new NotImplementedException (); } [MonoTODO] - public virtual bool Overlaps (IEnumerable other) + public bool SetEquals (IEnumerable other) { throw new NotImplementedException (); } [MonoTODO] - public virtual bool SetEquals (IEnumerable other) + public void SymmetricExceptWith (IEnumerable other) { throw new NotImplementedException (); } [MonoTODO] - public virtual void SymmetricExceptWith (IEnumerable other) + public void UnionWith (IEnumerable other) { throw new NotImplementedException (); } - [MonoTODO] - public virtual void UnionWith (IEnumerable other) + void ICollection.Add (T item) { - throw new NotImplementedException (); + Add (item); } - void ICollection.Add (T item) + void ICollection.CopyTo (T [] array, int index) { - Add (item); + CopyTo (array, index, Count); } bool ICollection.IsReadOnly { -- 2.11.4.GIT