Commit Graph
58 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 e67d275665 2010-04-06 Jb Evain <[email protected]>
* SortedSet.cs: implement Count for SortedSubSet.


svn path=/trunk/mcs/; revision=154840
2010-04-06 12:39:06 +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
Raja R Harinath 5db7238202 * RBTree.cs (do_remove): Ensure the node returned is suitable for re-insertion.
svn path=/trunk/mcs/; revision=154762
2010-04-04 05:25:53 +00:00
Jb Evain 66763c7baf 2010-04-02 Jb Evain <[email protected]>
* SortedSet.cs: implement Mix and Max for subsets.


svn path=/trunk/mcs/; revision=154725
2010-04-02 15:11:48 +00:00
Jb Evain 71b91562e5 2010-04-02 Jb Evain <[email protected]>
* SortedSet.cs: implement GetViewBetween.


svn path=/trunk/mcs/; revision=154722
2010-04-02 14:56:06 +00:00
Jb Evain d71e62b2f8 2010-04-02 Jb Evain <[email protected]>
* SortedSet.cs: optimize Reverse. Add a virtual TryAdd and TryRemove
	to override in sub trees.


svn path=/trunk/mcs/; revision=154717
2010-04-02 13:36:23 +00:00
Jb Evain e1936f0a89 2010-04-02 Jb Evain <[email protected]>
* SortedSet.cs: implement Min and Max.


svn path=/trunk/mcs/; revision=154714
2010-04-02 12:28:09 +00:00
Jb Evain a902350772 2010-04-02 Jb Evain <[email protected]>
* SortedSet.cs: implement RemoveWhere.


svn path=/trunk/mcs/; revision=154709
2010-04-02 12:05:04 +00:00
Jb Evain 454311541b 2010-04-02 Jb Evain <[email protected]>
* SortedSet.cs: implement Reverse.


svn path=/trunk/mcs/; revision=154705
2010-04-02 10:53:41 +00:00
Jb Evain f9b47e69c8 2010-04-01 Jb Evain <[email protected]>
* SortedSet.cs: fix API.


svn path=/trunk/mcs/; revision=154654
2010-04-01 17:28:00 +00:00
Jb Evain ba41623fa7 2010-04-01 Jb Evain <[email protected]>
* SortedSet.cs: add new SortedSet type in .net 4.0


svn path=/trunk/mcs/; revision=154652
2010-04-01 17:05:57 +00:00
Miguel de Icaza 5845129be7 2010-03-03 Miguel de Icaza <[email protected]>
* RBTree.cs: Make these serializable, should fix the serialization
	across appdomains of SortedDictionaries

svn path=/trunk/mcs/; revision=153922
2010-03-19 21:45:57 +00:00
Sebastien Pouliot dd1802b725 In System.Diagnostics:
2010-03-11  Sebastien Pouliot  <[email protected]>

	* Debug_2_1.cs: Change type to static to match SL4

In .:
2010-03-11  Sebastien Pouliot  <[email protected]>

	* net_2_1_raw_System.dll.sources: Add existing files that are 
	part of SL4

In System.Collections.Generic:
2010-03-11  Sebastien Pouliot  <[email protected]>

	* ISet.cs: Add NET_2_1 since this is part of SL4


svn path=/trunk/mcs/; revision=153477
2010-03-11 18:15:05 +00:00
Jb Evain 654b783fc0 2009-12-01 Jb Evain <[email protected]>
* Stack.cs (Enumerator.Dispose): tag the enumerator as finished
	upon Dispose.


svn path=/trunk/mcs/; revision=147248
2009-12-01 18:18:30 +00:00
Marek Safar e8bd31c03f 2009-11-26 Marek Safar <[email protected]>
* LinkedList.cs: Allocate less.


svn path=/trunk/mcs/; revision=146981
2009-11-26 13:01:23 +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
Miguel de Icaza d90afad63e 2009-11-02 Miguel de Icaza <[email protected]>
* Copy some collections from WindowsBase here for 4.0 support.

Add a handful of methods from 4.0 as well


svn path=/trunk/mcs/; revision=145180
2009-11-02 06:25:38 +00:00
Marek Safar 4420b773d7 2009-10-20 Marek Safar <[email protected]>
* SortedList.cs, LinkedList.cs, Queue.cs, Stack.cs,
	SortedDictionary.cs: Improve debugging experience.


svn path=/trunk/mcs/; revision=144438
2009-10-20 10:34:39 +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
Miguel de Icaza 1fc0a7899a 2009-07-22 Jb Evain <[email protected]>
* monotouch_System.dll.sources: bring Process in.

svn path=/trunk/mcs/; revision=138685
2009-07-26 16:05:47 +00:00
Gonzalo Paniagua Javier 05f367e52d 2009-07-14 Gonzalo Paniagua Javier <[email protected]>
* SortedList.cs: the IComparar.Compare arguments were reversed.
	Fixes bug #521750. Patch by Kevin Fitzgerald.


svn path=/trunk/mcs/; revision=137914
2009-07-15 01:02:35 +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
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 bacf99dcd2 2009-03-11 Zoltan Varga <[email protected]>
* SortedList.cs: Add version checking to the Key/Value enumerators +
	implement support for Reset (). Fixes #483985.

svn path=/trunk/mcs/; revision=129076
2009-03-11 16:49:43 +00:00
Roei Erez 85523f250b Performance improvement for Stack, where it is popped until empty, and then pushed again.
svn path=/trunk/mcs/; revision=96531
2008-02-25 08:29:15 +00:00
Jb Evain 825886db36 2007-11-15 Jb Evain <[email protected]>
* LinkedList.cs: ifdef out manually the Serialization part of the
	LinkedList.Enumerator. As it is a struct, the field SerializationInfo
	have to be assigned in the default constructor, and the tuner cannot
	remove that. Fixes #341938 for real.

svn path=/trunk/mcs/; revision=89715
2007-11-15 22:10:14 +00:00
Jb Evain 7a7a997f4b 2007-11-15 Jb Evain <[email protected]>
* LinkedList.cs: let's not have an access to the SerializationInfo
	field outside of serializations methods (We need a gendarme rule). Fixes #341938.


svn path=/trunk/mcs/; revision=89704
2007-11-15 20:36:46 +00:00
Raja R Harinath 9f6323ba73 * RBTree.cs (get_Item, do_remove): Remove redundant code.
svn path=/trunk/mcs/; revision=87165
2007-10-09 14:19:17 +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 58dd5660cb Avoid unnecessary allocation on indexer access
* SortedDictionary.cs (NodeHelper): Rename from NodeComparer.
(NodeHelper.CreateNode): New.
(Item.set): Move responsibility of creating new nodes to RBTree.Intern.
* RBTree.cs (INodeHelper): Rename from INodeComparer.
(INodeHelper.CreateNode): New.
(Intern): Use it to create a new node if no node is passed in.

svn path=/trunk/mcs/; revision=76926
2007-05-08 12:59:50 +00:00
Igor Zelmanovich 082f8b2081 2007-05-08 Igor Zelmanovich <[email protected]>
* RBTree.cs: for TARGET_JVM used Thread Local Storage 
	istead Thread-Relative Static Fields 

	* TraceImpl.cs:
	* TraceListener.cs:
	for TARGET_JVM used Thread Local Storage istead 
	Thread-Relative Static Fields 


svn path=/trunk/mcs/; revision=76917
2007-05-08 11:18:26 +00:00
Raja R Harinath ceab758710 * RBTree.cs (Enumerator.Current): Remove nullref.
We need to have a generic IEnumerator test harness to catch these silly mistakes.

svn path=/trunk/mcs/; revision=76562
2007-05-02 11:19:37 +00:00
Raja R Harinath 2be5b62889 * SortedDictionary.cs (ICollection.Contains): Use EqualityComparer
for comparing the value field.

svn path=/trunk/mcs/; revision=76556
2007-05-02 09:26:21 +00:00
Raja R Harinath 27304bacca * RBTree.cs (do_remove): Remove some redundant assignments/checks.
(NodeEnumerator): Simplify.  Keep track of a list of
right-pennants that need to be traversed next, rather than
comparing parent pointers.

The usual nit-picking followup

svn path=/trunk/mcs/; revision=76554
2007-05-02 07:39:08 +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
Raja R Harinath 50805d6a56 * RBTree.cs: Refactor to reduce generics code.
svn path=/trunk/mcs/; revision=76498
2007-04-30 14:40:27 +00:00
Raja R Harinath 4f2c3ef75a * RBTree.cs: New red-black tree implementation for use with SortedDictionary.
I'll integrate it into SortedDictionary tomorrow, if no one else gets to it.

svn path=/trunk/mcs/; revision=76469
2007-04-29 19:15:54 +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 5e2ae92305 Bugfix for incrementing the version incorrectly in queue and stack
svn path=/trunk/mcs/; revision=75020
2007-03-27 14:39:33 +00:00
Gert Driesen c5825c88a1 * OrderedDictionary.cs: IsReadOnly, indexers, Keys and Values should
not be virtual.
* SortedList.cs: Count property, indexer and Clear method should not
be virtual. Removed unnecessary explicit interface implementation of
Add (TKey, TValue) and Remove (TKey, TValue).
* Queue.cs: Marked Enumerator as Serializable.
* Stack.cs: Marked Stack <T> and Enumerator as serializable.

svn path=/trunk/mcs/; revision=66168
2006-10-02 18:35:51 +00:00
Andrew Skiba 793cdb4dae TARGET_JVM
svn path=/trunk/mcs/; revision=66042
2006-09-28 14:48:17 +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
Miguel de Icaza a5bd130af9 2006-03-11 Miguel de Icaza <[email protected]>
* Uri.cs: Pragma disable warning 612 (Obsolete methods are being
	used by us internally).

	Ponder: should we instead move our methods to use new versions of
	the Obsoleted ones?

2006-03-11  Miguel de Icaza  <[email protected]>

	* CodeNamespaceImportCollection.cs: It turns out that a lot of the
	errors flagged with "!" were just missing explicit interface
	implementations.  

	Implement.

2006-03-11  Miguel de Icaza  <[email protected]>

	* CodeDomConfigurationHandler.cs: Comment out unused methods. 

	* TempFileCollection.cs: Implement explicitly some interface
	methods to get rid of the "!" errors on CorCompare.

2006-03-11  Miguel de Icaza  <[email protected]>

	* Queue.cs: Flag as serializable.

	* LinkedList.cs (OnDeserialization): Fix signature. 

	* SortedList.cs: Implement explicitly a few methods that were
	flagged by corcompare. 

2006-03-11  Miguel de Icaza  <[email protected]>

	* IOrderedDictionary.cs: Flag GetEnumerator as a "new" method to
	avoid warning.

2006-03-11  Miguel de Icaza  <[email protected]>

	* ConfigurationSettings.cs (ChangeConfigurationSettings): Make
	internal to avoid warnings.  This routine is called from
	System.Web with MethodInfo.Invoke.

2006-03-11  Miguel de Icaza  <[email protected]>

	* DeflateStream.cs: Comment out DllImport that was not being
	used. 

2006-03-11  Miguel de Icaza  <[email protected]>

	* y

	* SerialPort.cs: Remove unused variable (writeBuffer). 

	* SerialPortStream.cs (Dispose): override, not new.

2006-03-11  Miguel de Icaza  <[email protected]>

	* WebClient.cs: Only expose the right methods to avoid warnings. 

	* FtpDataStream.cs (Dispose): Fix signature.

	* FtpWebResponse.cs: Comment out keepAlive field (unused, sounds
	like we are missing features here).

	* IPAddress.cs: Move m_HashCode property to the end, and set
	pragmas to disable warnings.

2006-03-11  Miguel de Icaza  <[email protected]>

	* MailAddress.cs: Comment out unused field to remove warning. 

2006-03-11  Miguel de Icaza  <[email protected]>

	* NetworkChange.cs: Use pragmas to eliminate warnings from events
	that we do not trigger yet.

	This is a candidate for using Aaron's NetworkManager code.  But
	would make us depend on d-bus.

	* NetworkInformationException.cs: Use error_code for ErrorCode,
	instead of NativeErrorCode.   Fixes warning. 

2006-03-11  Miguel de Icaza  <[email protected]>

	* AuthenticatedStream.cs: Fixed normative parameter names (yes, we
	need to do this everywhere one day).

	(Close): actually obey the "leaveInnerStreamOpen" setting from the
	constructor. 

2006-03-11  Miguel de Icaza  <[email protected]>

	* NetworkStream.cs (Dispose): Use the right signature depending on
	the profile being built.

2006-03-11  Miguel de Icaza  <[email protected]>

	* X509Chain.cs: Flagged member as internal to avoid unused warning.

	* X500DistinguishedName.cs: Comment out unused names and move
	temporary unused variables inside the comments that were removed 



svn path=/trunk/mcs/; revision=57836
2006-03-11 19:07:56 +00:00
Zoltan Varga af48507239 2005-11-10 Zoltan Varga <[email protected]>
* SortedList.cs Queue.cs Stack.cs: Implement TrimExcess methods.

svn path=/trunk/mcs/; revision=52887
2005-11-10 21:37:15 +00:00
Zoltan Varga 62099c134f 2005-11-10 Zoltan Varga <[email protected]>
* SortedList.cs: Fix build.

svn path=/trunk/mcs/; revision=52843
2005-11-10 14:58:16 +00:00
Zoltan Varga 1de1152ae9 2005-11-10 Zoltan Varga <[email protected]>
* Stack.cs SortedList.cs LinkedList.cs: Update to net 2.0 RTM.

svn path=/trunk/mcs/; revision=52842
2005-11-10 13:05:09 +00:00