Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,393 @@
//
// Bit Array.cs
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
// Marek Safar (marek.safar@gmail.com)
//
// (C) 2003 Ben Maurer
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections {
[ComVisible(true)]
[Serializable]
#if INSIDE_CORLIB
public
#else
internal
#endif
sealed class BitArray : ICollection, ICloneable {
int [] m_array;
int m_length;
int _version = 0;
#region Constructors
public BitArray (BitArray bits)
{
if (bits == null)
throw new ArgumentNullException ("bits");
m_length = bits.m_length;
m_array = new int [(m_length + 31) / 32];
if (m_array.Length == 1)
m_array [0] = bits.m_array [0];
else
Array.Copy(bits.m_array, m_array, m_array.Length);
}
public BitArray (bool [] values)
{
if (values == null)
throw new ArgumentNullException ("values");
m_length = values.Length;
m_array = new int [(m_length + 31) / 32];
for (int i = 0; i < values.Length; i++)
this [i] = values [i];
}
public BitArray (byte [] bytes)
{
if (bytes == null)
throw new ArgumentNullException ("bytes");
m_length = bytes.Length * 8;
m_array = new int [(m_length + 31) / 32];
for (int i = 0; i < bytes.Length; i++)
setByte (i, bytes [i]);
}
public BitArray (int [] values)
{
if (values == null)
throw new ArgumentNullException ("values");
int arrlen = values.Length;
m_length = arrlen*32;
m_array = new int [arrlen];
Array.Copy (values, m_array, arrlen);
}
public BitArray (int length)
{
if (length < 0)
throw new ArgumentOutOfRangeException ("length");
m_length = length;
m_array = new int [(m_length + 31) / 32];
}
public BitArray (int length, bool defaultValue) : this (length)
{
if (defaultValue) {
for (int i = 0; i < m_array.Length; i++)
m_array[i] = ~0;
}
}
#endregion
#region Utility Methods
byte getByte (int byteIndex)
{
int index = byteIndex / 4;
int shift = (byteIndex % 4) * 8;
int theByte = m_array [index] & (0xff << shift);
return (byte)((theByte >> shift) & 0xff);
}
void setByte (int byteIndex, byte value)
{
int index = byteIndex / 4;
int shift = (byteIndex % 4) * 8;
// clear the byte
m_array [index] &= ~(0xff << shift);
// or in the new byte
m_array [index] |= value << shift;
_version++;
}
void checkOperand (BitArray operand)
{
if (operand == null)
throw new ArgumentNullException ();
if (operand.m_length != m_length)
throw new ArgumentException ();
}
#endregion
public int Count {
get { return m_length; }
}
public bool IsReadOnly {
get { return false; }
}
public bool IsSynchronized {
get { return false; }
}
public bool this [int index] {
get { return Get (index); }
set { Set (index, value); }
}
public int Length {
get { return m_length; }
set {
if (m_length == value)
return;
if (value < 0)
throw new ArgumentOutOfRangeException ();
// Currently we never shrink the array
if (value > m_length) {
int numints = (value + 31) / 32;
int old_numints = (m_length + 31) / 32;
if (numints > m_array.Length) {
int [] newArr = new int [numints];
Array.Copy (m_array, newArr, m_array.Length);
m_array = newArr;
} else {
Array.Clear(m_array, old_numints, numints - old_numints);
}
int mask = m_length % 32;
if (mask > 0)
m_array [old_numints - 1] &= (1 << mask) - 1;
}
// set the internal state
m_length = value;
_version++;
}
}
public object SyncRoot {
get { return this; }
}
public object Clone ()
{
// LAMESPEC: docs say shallow, MS makes deep.
return new BitArray (this);
}
public void CopyTo (Array array, int index)
{
if (array == null)
throw new ArgumentNullException ("array");
if (index < 0)
throw new ArgumentOutOfRangeException ("index");
if (array.Rank != 1)
throw new ArgumentException ("array", "Array rank must be 1");
if (index >= array.Length && m_length > 0)
throw new ArgumentException ("index", "index is greater than array.Length");
// in each case, check to make sure enough space in array
if (array is bool []) {
if (array.Length - index < m_length)
throw new ArgumentException ();
bool [] barray = (bool []) array;
// Copy the bits into the array
for (int i = 0; i < m_length; i++)
barray[index + i] = this [i];
} else if (array is byte []) {
int numbytes = (m_length + 7) / 8;
if ((array.Length - index) < numbytes)
throw new ArgumentException ();
byte [] barray = (byte []) array;
// Copy the bytes into the array
for (int i = 0; i < numbytes; i++)
barray [index + i] = getByte (i);
} else if (array is int []) {
Array.Copy (m_array, 0, array, index, (m_length + 31) / 32);
} else {
throw new ArgumentException ("array", "Unsupported type");
}
}
public BitArray Not ()
{
int ints = (m_length + 31) / 32;
for (int i = 0; i < ints; i++)
m_array [i] = ~m_array [i];
_version++;
return this;
}
public BitArray And (BitArray value)
{
checkOperand (value);
int ints = (m_length + 31) / 32;
for (int i = 0; i < ints; i++)
m_array [i] &= value.m_array [i];
_version++;
return this;
}
public BitArray Or (BitArray value)
{
checkOperand (value);
int ints = (m_length + 31) / 32;
for (int i = 0; i < ints; i++)
m_array [i] |= value.m_array [i];
_version++;
return this;
}
public BitArray Xor (BitArray value)
{
checkOperand (value);
int ints = (m_length + 31) / 32;
for (int i = 0; i < ints; i++)
m_array [i] ^= value.m_array [i];
_version++;
return this;
}
public bool Get (int index)
{
if (index < 0 || index >= m_length)
throw new ArgumentOutOfRangeException ();
return (m_array [index >> 5] & (1 << (index & 31))) != 0;
}
public void Set (int index, bool value)
{
if (index < 0 || index >= m_length)
throw new ArgumentOutOfRangeException ();
if (value)
m_array [index >> 5] |= (1 << (index & 31));
else
m_array [index >> 5] &= ~(1 << (index & 31));
_version++;
}
public void SetAll (bool value)
{
if (value) {
for (int i = 0; i < m_array.Length; i++)
m_array[i] = ~0;
}
else
Array.Clear (m_array, 0, m_array.Length);
_version++;
}
public IEnumerator GetEnumerator ()
{
return new BitArrayEnumerator (this);
}
[Serializable]
class BitArrayEnumerator : IEnumerator, ICloneable {
BitArray _bitArray;
bool _current;
int _index, _version;
public object Clone () {
return MemberwiseClone ();
}
public BitArrayEnumerator (BitArray ba)
{
_index = -1;
_bitArray = ba;
_version = ba._version;
}
public object Current {
get {
if (_index == -1)
throw new InvalidOperationException ("Enum not started");
if (_index >= _bitArray.Count)
throw new InvalidOperationException ("Enum Ended");
return _current;
}
}
public bool MoveNext ()
{
checkVersion ();
if (_index < (_bitArray.Count - 1)) {
_current = _bitArray [++_index];
return true;
}
_index = _bitArray.Count;
return false;
}
public void Reset ()
{
checkVersion ();
_index = -1;
}
void checkVersion ()
{
if (_version != _bitArray._version)
throw new InvalidOperationException ();
}
}
}
}

View File

@@ -0,0 +1,108 @@
//
// System.Collections.CaseInsensitiveComparer.cs
//
// Authors:
// Sergey Chaban (serge@wildwestsoftware.com)
// Eduardo Garcia Cebollero (kiwnix@yahoo.es)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Globalization;
using System.Runtime.InteropServices;
namespace System.Collections
{
[ComVisible(true)]
[Serializable]
#if INSIDE_CORLIB
public
#else
internal
#endif
class CaseInsensitiveComparer : IComparer
{
readonly static CaseInsensitiveComparer defaultComparer = new CaseInsensitiveComparer ();
readonly static CaseInsensitiveComparer defaultInvariantComparer = new CaseInsensitiveComparer (true);
private CultureInfo culture;
// Public instance constructor
public CaseInsensitiveComparer ()
{
//LAMESPEC: This seems to be encoded while the object is created while Comparer does this at runtime.
culture = CultureInfo.CurrentCulture;
}
private CaseInsensitiveComparer (bool invariant)
{
// leave culture == null
}
public CaseInsensitiveComparer (CultureInfo culture)
{
if (culture == null)
throw new ArgumentNullException ("culture");
if (culture.LCID != CultureInfo.InvariantCulture.LCID)
this.culture = culture;
// else leave culture == null
}
//
// Public static properties
//
public static CaseInsensitiveComparer Default {
get {
return defaultComparer;
}
}
public static CaseInsensitiveComparer DefaultInvariant {
get {
return defaultInvariantComparer;
}
}
//
// IComparer
//
public int Compare (object a, object b)
{
string sa = a as string;
string sb = b as string;
if ((sa != null) && (sb != null)) {
if (culture != null)
return culture.CompareInfo.Compare (sa, sb, CompareOptions.IgnoreCase);
else
// FIXME: We should call directly into an invariant compare once available in string
return CultureInfo.InvariantCulture.CompareInfo.Compare (sa, sb, CompareOptions.IgnoreCase);
}
else
return Comparer.Default.Compare (a, b);
}
}
}

View File

@@ -0,0 +1,149 @@
//
// System.Collections.CaseInsensitiveHashCodeProvider.cs
//
// Authors:
// Sergey Chaban (serge@wildwestsoftware.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Globalization;
using System.Runtime.InteropServices;
namespace System.Collections
{
[Serializable]
[ComVisible(true)]
[Obsolete ("Please use StringComparer instead.")]
#if INSIDE_CORLIB
public
#else
internal
#endif
class CaseInsensitiveHashCodeProvider : IHashCodeProvider
{
static readonly CaseInsensitiveHashCodeProvider singletonInvariant = new CaseInsensitiveHashCodeProvider (
CultureInfo.InvariantCulture);
static CaseInsensitiveHashCodeProvider singleton;
static readonly object sync = new object ();
TextInfo m_text; // must match MS name for serialization
// Public instance constructor
public CaseInsensitiveHashCodeProvider ()
{
CultureInfo culture = CultureInfo.CurrentCulture;
if (!AreEqual (culture, CultureInfo.InvariantCulture))
m_text = CultureInfo.CurrentCulture.TextInfo;
}
public CaseInsensitiveHashCodeProvider (CultureInfo culture)
{
if (culture == null)
throw new ArgumentNullException ("culture");
if (!AreEqual (culture, CultureInfo.InvariantCulture))
m_text = culture.TextInfo;
}
//
// Public static properties
//
public static CaseInsensitiveHashCodeProvider Default {
get {
// MS actually constructs a new instance on each call, for
// performance reasons we're only constructing a new instance
// if the CurrentCulture changes
lock (sync) {
if (singleton == null) {
singleton = new CaseInsensitiveHashCodeProvider ();
} else if (singleton.m_text == null) {
if (!AreEqual (CultureInfo.CurrentCulture, CultureInfo.InvariantCulture))
singleton = new CaseInsensitiveHashCodeProvider ();
} else if (!AreEqual (singleton.m_text, CultureInfo.CurrentCulture)) {
singleton = new CaseInsensitiveHashCodeProvider ();
}
return singleton;
}
}
}
static bool AreEqual (CultureInfo a, CultureInfo b)
{
#if !NET_2_1
return a.LCID == b.LCID;
#else
return a.Name == b.Name;
#endif
}
static bool AreEqual (TextInfo info, CultureInfo culture)
{
#if !NET_2_1
return info.LCID == culture.LCID;
#else
return info.CultureName == culture.Name;
#endif
}
public
static CaseInsensitiveHashCodeProvider DefaultInvariant {
get {
return singletonInvariant;
}
}
//
// IHashCodeProvider
//
public int GetHashCode (object obj)
{
if (obj == null)
throw new ArgumentNullException ("obj");
string str = obj as string;
if (str == null)
return obj.GetHashCode ();
int h = 0;
char c;
if ((m_text != null) && !AreEqual (m_text, CultureInfo.InvariantCulture)) {
str = m_text.ToLower (str);
for (int i = 0; i < str.Length; i++) {
c = str [i];
h = h * 31 + c;
}
} else {
for (int i = 0; i < str.Length; i++) {
c = Char.ToLower (str [i], CultureInfo.InvariantCulture);
h = h * 31 + c;
}
}
return h;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,219 @@
//
// System.Collections.CollectionBase.cs
//
// Author:
// Nick Drochak II (ndrochak@gol.com)
//
// (C) 2001 Nick Drochak II
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections {
[ComVisible(true)]
[Serializable]
[System.Diagnostics.DebuggerDisplay ("Count={Count}")]
[System.Diagnostics.DebuggerTypeProxy (typeof (CollectionDebuggerView))]
#if INSIDE_CORLIB
public
#else
internal
#endif
abstract class CollectionBase : IList, ICollection, IEnumerable {
// private instance properties
private ArrayList list;
// public instance properties
public int Count { get { return InnerList.Count; } }
// Public Instance Methods
public IEnumerator GetEnumerator() { return InnerList.GetEnumerator(); }
public void Clear() {
OnClear();
InnerList.Clear();
OnClearComplete();
}
public void RemoveAt (int index) {
object objectToRemove;
objectToRemove = InnerList[index];
OnValidate(objectToRemove);
OnRemove(index, objectToRemove);
InnerList.RemoveAt(index);
OnRemoveComplete(index, objectToRemove);
}
// Protected Instance Constructors
protected CollectionBase()
{
}
protected CollectionBase (int capacity)
{
list = new ArrayList (capacity);
}
[ComVisible (false)]
public int Capacity {
get {
if (list == null)
list = new ArrayList ();
return list.Capacity;
}
set {
if (list == null)
list = new ArrayList ();
list.Capacity = value;
}
}
// Protected Instance Properties
protected ArrayList InnerList {
get {
if (list == null)
list = new ArrayList ();
return list;
}
}
protected IList List {get { return this; } }
// Protected Instance Methods
protected virtual void OnClear() { }
protected virtual void OnClearComplete() { }
protected virtual void OnInsert(int index, object value) { }
protected virtual void OnInsertComplete(int index, object value) { }
protected virtual void OnRemove(int index, object value) { }
protected virtual void OnRemoveComplete(int index, object value) { }
protected virtual void OnSet(int index, object oldValue, object newValue) { }
protected virtual void OnSetComplete(int index, object oldValue, object newValue) { }
protected virtual void OnValidate(object value) {
if (null == value) {
throw new System.ArgumentNullException("CollectionBase.OnValidate: Invalid parameter value passed to method: null");
}
}
// ICollection methods
void ICollection.CopyTo(Array array, int index) {
InnerList.CopyTo(array, index);
}
object ICollection.SyncRoot {
get { return InnerList.SyncRoot; }
}
bool ICollection.IsSynchronized {
get { return InnerList.IsSynchronized; }
}
// IList methods
int IList.Add (object value) {
int newPosition;
OnValidate(value);
newPosition = InnerList.Count;
OnInsert(newPosition, value);
InnerList.Add(value);
try {
OnInsertComplete(newPosition, value);
} catch {
InnerList.RemoveAt (newPosition);
throw;
}
return newPosition;
}
bool IList.Contains (object value) {
return InnerList.Contains(value);
}
int IList.IndexOf (object value) {
return InnerList.IndexOf(value);
}
void IList.Insert (int index, object value) {
OnValidate(value);
OnInsert(index, value);
InnerList.Insert(index, value);
try {
OnInsertComplete(index, value);
} catch {
InnerList.RemoveAt (index);
throw;
}
}
void IList.Remove (object value) {
int removeIndex;
OnValidate(value);
removeIndex = InnerList.IndexOf(value);
if (removeIndex == -1)
throw new ArgumentException ("The element cannot be found.", "value");
OnRemove(removeIndex, value);
InnerList.Remove(value);
OnRemoveComplete(removeIndex, value);
}
// IList properties
bool IList.IsFixedSize {
get { return InnerList.IsFixedSize; }
}
bool IList.IsReadOnly {
get { return InnerList.IsReadOnly; }
}
object IList.this[int index] {
get { return InnerList[index]; }
set {
if (index < 0 || index >= InnerList.Count)
throw new ArgumentOutOfRangeException ("index");
object oldValue;
// make sure we have been given a valid value
OnValidate(value);
// save a reference to the object that is in the list now
oldValue = InnerList[index];
OnSet(index, oldValue, value);
InnerList[index] = value;
try {
OnSetComplete(index, oldValue, value);
} catch {
InnerList[index] = oldValue;
throw;
}
}
}
}
}

View File

@@ -0,0 +1,56 @@
//
// CollectionDebuggerView.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Diagnostics;
namespace System.Collections
{
//
// Custom debugger type proxy to display collections as arrays
//
internal sealed class CollectionDebuggerView
{
readonly ICollection c;
public CollectionDebuggerView (ICollection col)
{
this.c = col;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public object[] Items {
get {
var o = new object [c.Count];
c.CopyTo (o, 0);
return o;
}
}
}
}

View File

@@ -0,0 +1,101 @@
//
// System.Collections.Comparer.cs
//
// Authors:
// Sergey Chaban (serge@wildwestsoftware.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Globalization;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security.Permissions;
namespace System.Collections
{
[ComVisible(true)]
[Serializable]
#if INSIDE_CORLIB
public
#else
internal
#endif
sealed class Comparer : IComparer, ISerializable {
public static readonly Comparer Default = new Comparer ();
public static readonly Comparer DefaultInvariant = new Comparer (CultureInfo.InvariantCulture);
// This field was introduced for MS kompatibility. see bug #77701
CompareInfo m_compareInfo;
private Comparer ()
{
//LAMESPEC: This seems to be encoded at runtime while CaseInsensitiveComparer does at creation
}
public Comparer (CultureInfo culture)
{
if (culture == null)
throw new ArgumentNullException ("culture");
m_compareInfo = culture.CompareInfo;
}
// IComparer
public int Compare (object a, object b)
{
if (a == b)
return 0;
else if (a == null)
return -1;
else if (b == null)
return 1;
if (m_compareInfo != null) {
string sa = a as string;
string sb = b as string;
if (sa != null && sb != null)
return m_compareInfo.Compare (sa, sb);
}
if (a is IComparable)
return (a as IComparable).CompareTo (b);
else if (b is IComparable)
return -(b as IComparable).CompareTo (a);
throw new ArgumentException (Locale.GetText ("Neither 'a' nor 'b' implements IComparable."));
}
// ISerializable
[SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
public void GetObjectData (SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException ("info");
info.AddValue ("CompareInfo", m_compareInfo, typeof (CompareInfo));
}
}
}

View File

@@ -0,0 +1,239 @@
//
// System.Collections.DictionaryBase.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections {
[ComVisible(true)]
[Serializable]
public abstract class DictionaryBase : IDictionary, ICollection, IEnumerable {
Hashtable hashtable;
protected DictionaryBase ()
{
hashtable = new Hashtable ();
}
public void Clear ()
{
OnClear ();
hashtable.Clear ();
OnClearComplete ();
}
public int Count {
get {
return hashtable.Count;
}
}
protected IDictionary Dictionary {
get {
return this;
}
}
protected Hashtable InnerHashtable {
get {
return hashtable;
}
}
public void CopyTo (Array array, int index)
{
if (array == null)
throw new ArgumentNullException ("array");
if (index < 0)
throw new ArgumentOutOfRangeException ("index must be possitive");
if (array.Rank > 1)
throw new ArgumentException ("array is multidimensional");
int size = array.Length;
if (index > size)
throw new ArgumentException ("index is larger than array size");
if (index + Count > size)
throw new ArgumentException ("Copy will overlflow array");
DoCopy (array, index);
}
private void DoCopy (Array array, int index)
{
foreach (DictionaryEntry de in hashtable)
array.SetValue (de, index++);
}
public IDictionaryEnumerator GetEnumerator ()
{
return hashtable.GetEnumerator ();
}
protected virtual void OnClear ()
{
}
protected virtual void OnClearComplete ()
{
}
protected virtual object OnGet (object key, object currentValue)
{
return currentValue;
}
protected virtual void OnInsert (object key, object value)
{
}
protected virtual void OnInsertComplete (object key, object value)
{
}
protected virtual void OnSet (object key, object oldValue, object newValue)
{
}
protected virtual void OnSetComplete (object key, object oldValue, object newValue)
{
}
protected virtual void OnRemove (object key, object value)
{
}
protected virtual void OnRemoveComplete (object key, object value)
{
}
protected virtual void OnValidate (object key, object value)
{
}
bool IDictionary.IsFixedSize {
get {
return false;
}
}
bool IDictionary.IsReadOnly {
get {
return false;
}
}
object IDictionary.this [object key] {
get {
object value = hashtable [key];
OnGet (key, value);
return value;
}
set {
OnValidate (key, value);
object current_value = hashtable [key];
OnSet (key, current_value, value);
hashtable [key] = value;
try {
OnSetComplete (key, current_value, value);
} catch {
hashtable [key] = current_value;
throw;
}
}
}
ICollection IDictionary.Keys {
get {
return hashtable.Keys;
}
}
ICollection IDictionary.Values {
get {
return hashtable.Values;
}
}
void IDictionary.Add (object key, object value)
{
OnValidate (key, value);
OnInsert (key, value);
hashtable.Add (key, value);
try {
OnInsertComplete (key, value);
} catch {
hashtable.Remove (key);
throw;
}
}
void IDictionary.Remove (object key)
{
if (!hashtable.Contains (key))
return;
object value = hashtable [key];
OnValidate (key, value);
OnRemove (key, value);
hashtable.Remove (key);
try {
OnRemoveComplete (key, value);
} catch {
hashtable [key] = value;
throw;
}
}
bool IDictionary.Contains (object key)
{
return hashtable.Contains (key);
}
bool ICollection.IsSynchronized {
get {
return hashtable.IsSynchronized;
}
}
object ICollection.SyncRoot {
get {
return hashtable.SyncRoot;
}
}
IEnumerator IEnumerable.GetEnumerator ()
{
return hashtable.GetEnumerator ();
}
}
}

View File

@@ -0,0 +1,63 @@
//
// DictionaryEntry.cs
//
// Authors:
// Paolo Molaro (lupus@ximian.com)
// Ben Maurer (bmaurer@users.sourceforge.net)
//
// (C) Ximian, Inc. http://www.ximian.com
// (C) 2003 Ben Maurer
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections {
[ComVisible(true)]
[Serializable]
public struct DictionaryEntry {
private object _key;
private object _value;
public DictionaryEntry (object key, object value)
{
_key = key;
_value = value;
}
public object Key {
get {return _key;}
set {
_key = value;
}
}
public object Value {
get {return _value;}
set {_value = value;}
}
}
}

View File

@@ -0,0 +1,107 @@
//
// HashPrimeNumbers.cs
//
// Author:
// Sergey Chaban (serge@wildwestsoftware.com)
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Collections
{
static class HashPrimeNumbers
{
static readonly int [] primeTbl = {
11,
19,
37,
73,
109,
163,
251,
367,
557,
823,
1237,
1861,
2777,
4177,
6247,
9371,
14057,
21089,
31627,
47431,
71143,
106721,
160073,
240101,
360163,
540217,
810343,
1215497,
1823231,
2734867,
4102283,
6153409,
9230113,
13845163
};
//
// Private static methods
//
public static bool TestPrime (int x)
{
if ((x & 1) != 0) {
int top = (int)Math.Sqrt (x);
for (int n = 3; n < top; n += 2) {
if ((x % n) == 0)
return false;
}
return true;
}
// There is only one even prime - 2.
return (x == 2);
}
public static int CalcPrime (int x)
{
for (int i = (x & (~1))-1; i< Int32.MaxValue; i += 2) {
if (TestPrime (i)) return i;
}
return x;
}
public static int ToPrime (int x)
{
for (int i = 0; i < primeTbl.Length; i++) {
if (x <= primeTbl [i])
return primeTbl [i];
}
return CalcPrime (x);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
//
// System.Collections.ICollection
//
// Author:
// Vladimir Vukicevic (vladimir@pobox.com)
//
// (C) 2001 Vladimir Vukicevic
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections {
[ComVisible(true)]
public interface ICollection : IEnumerable {
int Count { get; }
bool IsSynchronized { get; }
object SyncRoot { get; }
void CopyTo (Array array, int index);
}
}

View File

@@ -0,0 +1,44 @@
// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
//
// System.Collections.IComparer
//
// Author:
// Vladimir Vukicevic (vladimir@pobox.com)
//
// (C) 2001 Vladimir Vukicevic
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections {
[ComVisible(true)]
public interface IComparer {
int Compare (object x, object y);
}
}

View File

@@ -0,0 +1,65 @@
// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
//
// System.Collections.IDictionary
//
// Author:
// Vladimir Vukicevic (vladimir@pobox.com)
//
// (C) 2001 Vladimir Vukicevic
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections {
[ComVisible(true)]
public interface IDictionary : ICollection {
// properties
bool IsFixedSize { get; }
bool IsReadOnly { get; }
object this[object key] { get; set; }
ICollection Keys { get; }
ICollection Values { get; }
// methods
void Add (object key, object value);
void Clear ();
bool Contains (object key);
new IDictionaryEnumerator GetEnumerator ();
void Remove (object key);
}
}

View File

@@ -0,0 +1,45 @@
// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
//
// System.Collections.IDictionaryEnumerator
//
// Author:
// Vladimir Vukicevic (vladimir@pobox.com)
//
// (C) 2001 Vladimir Vukicevic
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections {
[ComVisible(true)]
public interface IDictionaryEnumerator : IEnumerator {
DictionaryEntry Entry { get; }
object Key { get; }
object Value { get; }
}
}

View File

@@ -0,0 +1,45 @@
// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
//
// System.Collections.IEnumerable
//
// Author:
// Vladimir Vukicevic (vladimir@pobox.com)
//
// (C) 2001 Vladimir Vukicevic
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections {
[ComVisible(true)]
[Guid("496B0ABE-CDEE-11d3-88E8-00902754C43A")]
public interface IEnumerable {
[DispId(-4)]
IEnumerator GetEnumerator();
}
}

View File

@@ -0,0 +1,50 @@
//
// System.Collections.IEnumerator.cs
//
// Author:
// Vladimir Vukicevic (vladimir@pobox.com)
//
// (C) 2001 Vladimir Vukicevic
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections
{
[ComVisible(true)]
[Guid ("496B0ABF-CDEE-11D3-88E8-00902754C43A")]
public interface IEnumerator
{
object Current { get; }
bool MoveNext ();
void Reset ();
}
}

View File

@@ -0,0 +1,42 @@
//
// System.Collections.IEqualityComparer.cs
//
// Authors:
// David Waite (mass@akuma.org)
//
// (C) 2005 David Waite
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections
{
[ComVisible(true)]
public interface IEqualityComparer
{
bool Equals (object x, object y);
int GetHashCode (object obj);
}
}

View File

@@ -0,0 +1,49 @@
// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
//
// System.Collections.IHashCodeProvider
//
// Author:
// Vladimir Vukicevic (vladimir@pobox.com)
//
// (C) 2001 Vladimir Vukicevic
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections {
[Obsolete ("Please use IEqualityComparer instead.")]
[ComVisible(true)]
#if INSIDE_CORLIB
public
#else
internal
#endif
interface IHashCodeProvider {
int GetHashCode (object obj);
}
}

Some files were not shown because too many files have changed in this diff Show More