Commit Graph
32 Commits
Author SHA1 Message Date
Raja R Harinath 195fec2107 SortedSet: Don't maintain state in the view
* System.Collections.Generic/SortedSet.cs (SortedSubSet.count): Remove.
(SortedSubSet..ctor): Move counting loop ...
(SortedSubSet.Count): ... here.
(SortedSubSet.TryAdd, SortedSubSet.TryRemove): Update to changes.
(SortedSubSet.GetMin, SortedSubSet.GetMax): Likewise.  Use bounds
to determine if the view is empty, rather than the count.
* Test/System.Collections.Generic/SortedSetTest.cs (ViewCount):
Test that count reflects changes in underlying set.

svn path=/trunk/mcs/; revision=155125
2010-04-09 06:41:10 +00:00
Raja R Harinath c940e13b2b SortedSet: Enable set comparision operations on views, and improve performance
* RBTree.cs (Bound): New.  Returns the greatest lower bound and
least upper bound of the given key.
(GetSuffixEnumerator): New.  Returns an enumerator that starts at
the given key.
(NodeEnumerator): Provide suffix enumerator functionality.
* SortedSet.cs (GetEnumerator): Delegate to ...
(TryGetEnumerator): ... this.  New virtual function.
(Enumerator): Provide subset enumeration using RBTree's suffix enumerators.
(SortedSubSet.count): New.
(SortedSubSet.GetCount): Use it.
(SortedSubSet.TryAdd, SortedSubSet.TryRemove): Update count.
(SortedSubSet.GetMin, SortedSubSet.GetMax): Use RBTree.Bound().
(SortedSubSet.GetEnumerator): Remove.
(SortedSubSet.TryGetEnumerator): New.  Use ranged enumerators.
* SortedSetTest.cs: Update to test more view functionality,
including set comparison operators.

svn path=/trunk/mcs/; revision=154974
2010-04-07 16:31:25 +00:00
Jb Evain 8a1eb97343 2010-04-06 Jb Evain <[email protected]>
* SortedSetTest.cs: add test for SortedSubSet.Count.


svn path=/trunk/mcs/; revision=154841
2010-04-06 12:40:15 +00:00
Raja R Harinath 4478f7eb04 SortedSet: Complete implementation of more methods
* SortedSet.cs (IsProperSubsetOf, IsSubsetOf): Implement using ...
(is_subset_of): ... new helper.
(IsProperSupersetOf, IsSupersetOf): Implement using ...
(is_superset_of): ... new helper.
(covers, nodups, overlaps): New helpers.
(SetEquals): Implement.
(Overlaps): Implement using overlaps().
(SymmetricExceptWith): Use nodups() helper.

svn path=/trunk/mcs/; revision=154788
2010-04-05 09:59:41 +00:00
Raja R Harinath 40979641a2 SortedSet: implement IntersectWith, UnionWith, ExceptWith and SymmetricExceptWith
* System.Collections.Generic/SortedSet.cs (CheckArgumentNotNull): New helper.
(IntersectWith, UnionWith): Implement.
(ExceptWith, SymmetricExceptWith): Likewise.
(SortedSubSet.IntersectWith): Implement override.
* Test/System.Collections.Generic/SortedSetTest.cs: Add tests for IntersectWith,
UnionWith, ExceptWith and SymmetricExceptWith.

svn path=/trunk/mcs/; revision=154769
2010-04-04 18:22:37 +00:00
Jb Evain 67c90000b1 2010-04-02 Jb Evain <[email protected]>
* SortedSetTest.cs: add tests for Min and Max on subsets.


svn path=/trunk/mcs/; revision=154726
2010-04-02 15:12:01 +00:00
Jb Evain 84fc79215f 2010-04-02 Jb Evain <[email protected]>
* SortedSetTest.cs: add tests for GetViewBetween.


svn path=/trunk/mcs/; revision=154723
2010-04-02 14:56:27 +00:00
Jb Evain dd394b1071 2010-04-02 Jb Evain <[email protected]>
* SortedSetTest.cs: add tests for Min and Max.


svn path=/trunk/mcs/; revision=154715
2010-04-02 12:29:14 +00:00
Jb Evain 9e0adb4647 2010-04-02 Jb Evain <[email protected]>
* SortedSetTest.cs: add test for RemoveWhere.


svn path=/trunk/mcs/; revision=154710
2010-04-02 12:05:37 +00:00
Jb Evain 0717f6b5fa 2010-04-02 Jb Evain <[email protected]>
* SortedSetTest.cs: add test for Reverse.


svn path=/trunk/mcs/; revision=154706
2010-04-02 10:54:10 +00:00
Jb Evain b4a69791f4 2010-04-02 Jb Evain <[email protected]>
* SortedSetTest.cs: add new fixture.

svn path=/trunk/mcs/; revision=154702
2010-04-02 10:42:24 +00:00
Jb Evain 316aaacd09 2009-12-01 Jb Evain <[email protected]>
* StackTest.cs: add a test ensuring that disposing the stack
	enumerator prevents to iterate further.



svn path=/trunk/mcs/; revision=147249
2009-12-01 18:20:48 +00:00
Jb Evain 2ece19dfb2 in System.Collections.Generic:
2009-11-25  Jb Evain  <[email protected]>

	* Queue.cs (Enqueue): deal with the case where the tail
	is off the array when deciding to enlarge the capacity.

in Test/System.Collections.Generic:
2009-11-25  Jb Evain  <[email protected]>

	* QueueTest.cs: add test for a specific combination of
	calls that make the queue crash when enqueuing an item.

svn path=/trunk/mcs/; revision=146925
2009-11-25 17:30:16 +00:00
Jb Evain 108981cf3b in System.Collections.Generic:
2009-11-25  Jb Evain  <[email protected]>

	* Queue.cs (ICollection.CopyTo): fix typo, remove code duplication.

in Test/System.Collections.Generic:
2009-11-25  Jb Evain  <[email protected]>

	* QueueTest.cs: add tests for ICollection.CopyTo.

svn path=/trunk/mcs/; revision=146914
2009-11-25 15:43:49 +00:00
Raja R Harinath 876b8f2fb6 Fix Enumerator.Current handling in SortedDictionary<,>
* System.Collections.Generic/RBTree.cs (NodeEnumerator.check_current):
 New helper.
(NodeEnumerator.Current): Don't check invariants.
* SortedDictionary.cs (Enumerator.Current): Likewise.
(ValueCollection.Enumerator.Current): Likewise.
(KeyCollection.Enumerator.Current): Likewise.

* Test/System.Collections.Generic/SortedDictionaryTest.cs
(Enumerator_Current, KeyEnumerator_Current, ValueEnumerator_Current): New tests.

svn path=/trunk/mcs/; revision=139115
2009-07-30 19:42:04 +00:00
Gonzalo Paniagua Javier c8fd06fbe8 2009-07-14 Gonzalo Paniagua Javier <[email protected]>
* SortedListTest.cs: new tests for bug #521750 provided by
	Kevin Fitzgerald.


svn path=/trunk/mcs/; revision=137916
2009-07-15 01:05:07 +00:00
Andrés G. Aragoneses 1d1691647f 2009-05-10 Andy Hume <[email protected]>
* LinkedList.cs: Add null check. Fixes #481621.


svn path=/trunk/mcs/; revision=133864
2009-05-10 21:26:08 +00:00
Andrés G. Aragoneses 84eba90d37 2009-05-10 Andrés G. Aragoneses <[email protected]>
* LinkedListTest.cs: Added NotWorking test for #481621,
	converted from example code by Andy Hume <[email protected]>.


svn path=/trunk/mcs/; revision=133858
2009-05-10 20:18:03 +00:00
Miguel de Icaza 0f4e81e0fd Contribution from Pia Eriksson <[email protected]> that fixes
the CopyTo method in various generic containers.

Also fixes #497720


svn path=/trunk/mcs/; revision=133700
2009-05-07 00:42:16 +00:00
Zoltan Varga dfb2da7976 2009-03-11 Zoltan Varga <[email protected]>
* SortedListTest.cs: Add tests for #483985.

svn path=/trunk/mcs/; revision=129078
2009-03-11 16:51:19 +00:00
Jb Evain fb7a99f5f1 in System.Collections.Generic:
2007-08-20  Jb Evain  <[email protected]>

	* SortedList.cs: don't crash in ListKeys and ListValues
	when CopyTo targets an empty array, and that the
	sorted list is empty. Fixes #82492.

in Tests/System.Collections.Generic:
2007-08-20  Jb Evain  <[email protected]>

	* SortedListTest.cs: Tests for #82492.

svn path=/trunk/mcs/; revision=84419
2007-08-20 01:53:32 +00:00
Raja R Harinath 822e74d15d In .:
* System.dll.sources: Add RBTree.cs.

In System.Collections.Generic:
	Make add and remove operations O(log n).
	* SortedDictionary.cs: Rewrite to use the red-black tree
	implementation from RBTree.cs.
	* RBTree.cs: Some more refactoring.  Rename Insert() to Intern(),
	and modify semantics slightly.  Replace Contains() with Lookup().

In Test/System.Collections.Generic:
	* SortedDictionaryTest.cs (AddNullKeyNullable): Enable.

svn path=/trunk/mcs/; revision=76537
2007-05-01 19:07:31 +00:00
Gert Driesen 936bb390fb * QueueTest.cs: Removed usage of deprecated Assertion class. Added
test for TrimExcess. Added tests for binary serialization.
* StackTest.cs: Removed usage of deprecated Assertion class. Added
test for TrimExcess. Added tests for binary serialization.
* Queue.cs: Fixed binary serialization, based on patch provided by
Lionel Cuir. Fixes TrimExcess to use SetCapacity, before it was not
updating _head which could lead to IndexOutOfRangeException.
* Stack.cs: Fixed binary serialization, based on patch provided by
Lionel Cuir. In Pop, clear entry from array to help GC.

svn path=/trunk/mcs/; revision=76069
2007-04-22 16:21:13 +00:00
Alan McGovern 968a00b667 Fixed compilation
svn path=/trunk/mcs/; revision=75039
2007-03-27 18:46:25 +00:00
Ilya Kharmatsky 614c713079 Added 'Ignore' attribute in SortedDictionaryTest, under TARGET_JVM configuration
in order to workarround not working test.


svn path=/trunk/mcs/; revision=72469
2007-02-08 12:46:01 +00:00
Ilya Kharmatsky 5130ff839e Added 'Ignore' attribute under TARGET_JVM in order to workaround Grasshopper's bug.
svn path=/trunk/mcs/; revision=71674
2007-01-25 16:33:09 +00:00
Andrew Skiba 0cb3796ca5 TARGET_JVM to workaround CopyTo limitations
svn path=/trunk/mcs/; revision=67925
2006-11-15 14:44:13 +00:00
Atsushi Eno 3ff8295d31 2006-04-05 Atsushi Enomoto <[email protected]>
* System.dll.sources : added SortedDictionary.cs.
	* System_test.dll.sources : added SortedDictionaryTest.cs.

	* SortedDictionary.cs : new file. The original code is mostly
	  from Kazuki Oikawa.

	* SortedDictionaryTest.cs : new test.


svn path=/trunk/mcs/; revision=59052
2006-04-05 07:36:29 +00:00
Zoltan Varga 97566b8b36 2005-11-10 Zoltan Varga <[email protected]>
* StackTest.cs QueueTest.cs: Remove tests for removed TrimToSize ()
	method.

svn path=/trunk/mcs/; revision=52858
2005-11-10 17:02:50 +00:00
Zoltan Varga 4cbdd0f90a 2005-11-09 Zoltan Varga <[email protected]>
* SortedListTest.cs: New file.

svn path=/trunk/mcs/; revision=52802
2005-11-09 22:04:32 +00:00
David Waite 37f4a41d91 2005-09-04 David Waite <[email protected]>
* LinkedListTest.cs: Added tests for LinkedList<T>


svn path=/trunk/mcs/; revision=49414
2005-09-04 21:12:02 +00:00
Atsushi Eno f12881b652 2005-05-13 Atsushi Enomoto <[email protected]>
* corlib_test.dll.sources,
	  corlib.dll.sources: generic Queue.cs and Stack.cs are now in System.
	* System_test.dll.sources,
	  System.dll.sources: generic Queue.cs and Stack.cs are now in System.

	* Queue.cs, Stack.cs: moved to System.dll

	* QueueTest.cs, StackTest.cs: They are now in System.dll


svn path=/trunk/mcs/; revision=44484
2005-05-13 03:50:32 +00:00