Merge pull request #4198 from vkargov/vk-prevbb
[mono.git] / mcs / class / Mono.C5 / C5 / Exceptions.cs
index ccf6c8e99880ea7635f714f468b93f41b48c4d11..7be7625f8b23940654e5485cbc86aad0a071d676 100644 (file)
-#if NET_2_0
-/*\r
- Copyright (c) 2003-2006 Niels Kokholm and Peter Sestoft\r
- Permission is hereby granted, free of charge, to any person obtaining a copy\r
- of this software and associated documentation files (the "Software"), to deal\r
- in the Software without restriction, including without limitation the rights\r
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
- copies of the Software, and to permit persons to whom the Software is\r
- furnished to do so, subject to the following conditions:\r
\r
- The above copyright notice and this permission notice shall be included in\r
- all copies or substantial portions of the Software.\r
\r
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- SOFTWARE.\r
-*/\r
-\r
-using System;\r
-using System.Diagnostics;\r
-using SCG = System.Collections.Generic;\r
-\r
-namespace C5\r
-{\r
-  /// <summary>\r
-  /// An exception to throw from library code when an internal inconsistency is encountered.\r
-  /// </summary>\r
-  public class InternalException : Exception\r
-  {\r
-    internal InternalException(string message) : base(message) { }\r
-  }\r
-\r
-  /// <summary>\r
-  /// An exception thrown by an update operation on a Read-Only collection or dictionary.\r
-  /// <para>This exception will be thrown unconditionally when an update operation \r
-  /// (method or set property) is called. No check is made to see if the update operation, \r
-  /// if allowed, would actually change the collection. </para>\r
-  /// </summary>\r
-  [Serializable]\r
-  public class ReadOnlyCollectionException : Exception\r
-  {\r
-    /// <summary>\r
-    /// Create a simple exception with no further explanation.\r
-    /// </summary>\r
-    public ReadOnlyCollectionException() : base() { }\r
-    /// <summary>\r
-    /// Create the exception with an explanation of the reason.\r
-    /// </summary>\r
-    /// <param name="message"></param>\r
-    public ReadOnlyCollectionException(string message) : base(message) { }\r
-  }\r
-\r
-  /// <summary>\r
-  /// \r
-  /// </summary>\r
-  [Serializable]\r
-  public class FixedSizeCollectionException : Exception\r
-  {\r
-    /// <summary>\r
-    /// Create a simple exception with no further explanation.\r
-    /// </summary>\r
-    public FixedSizeCollectionException() : base() { }\r
-    /// <summary>\r
-    /// Create the exception with an explanation of the reason.\r
-    /// </summary>\r
-    /// <param name="message"></param>\r
-    public FixedSizeCollectionException(string message) : base(message) { }\r
-  }\r
-\r
-  /// <summary>\r
-  /// \r
-  /// </summary>\r
-  [Serializable]\r
-  public class UnlistenableEventException : Exception\r
-  {\r
-    /// <summary>\r
-    /// Create a simple exception with no further explanation.\r
-    /// </summary>\r
-    public UnlistenableEventException() : base() { }\r
-    /// <summary>\r
-    /// Create the exception with an explanation of the reason.\r
-    /// </summary>\r
-    /// <param name="message"></param>\r
-    public UnlistenableEventException(string message) : base(message) { }\r
-  }\r
-\r
-  /// <summary>\r
-  /// An exception thrown by enumerators, range views etc. when accessed after \r
-  /// the underlying collection has been modified.\r
-  /// </summary>\r
-  [Serializable]\r
-  public class CollectionModifiedException : Exception\r
-  {\r
-    /// <summary>\r
-    /// Create a simple exception with no further explanation.\r
-    /// </summary>\r
-    public CollectionModifiedException() : base() { }\r
-    /// <summary>\r
-    /// Create the exception with an explanation of the reason.\r
-    /// </summary>\r
-    /// <param name="message"></param>\r
-    public CollectionModifiedException(string message) : base(message) { }\r
-  }\r
-\r
-  /// <summary>\r
-  /// An excption thrown when trying to access a view (a list view on a <see cref="T:C5.IList`1"/> or \r
-  /// a snapshot on a <see cref="T:C5.IPersistentSorted`1"/>)\r
-  /// that has been invalidated by some earlier operation.\r
-  /// <para>\r
-  /// The typical scenario is a view on a list that hash been invalidated by a call to \r
-  /// Sort, Reverse or Shuffle on some other, overlapping view or the whole list.\r
-  /// </para>\r
-  /// </summary>\r
-  [Serializable]\r
-  public class ViewDisposedException : Exception\r
-  {\r
-    /// <summary>\r
-    /// Create a simple exception with no further explanation.\r
-    /// </summary>\r
-    public ViewDisposedException() : base() { }\r
-    /// <summary>\r
-    /// Create the exception with an explanation of the reason.\r
-    /// </summary>\r
-    /// <param name="message"></param>\r
-    public ViewDisposedException(string message) : base(message) { }\r
-  }\r
-\r
-  /// <summary>\r
-  /// An exception thrown by a lookup or lookup with update operation that does not \r
-  /// find the lookup item and has no other means to communicate failure.\r
-  /// <para>The typical scenario is a lookup by key in a dictionary with an indexer,\r
-  /// see e.g. <see cref="P:C5.IDictionary`2.Item(`0)"/></para>\r
-  /// </summary>\r
-  [Serializable]\r
-  public class NoSuchItemException : Exception\r
-  {\r
-    /// <summary>\r
-    /// Create a simple exception with no further explanation.\r
-    /// </summary>\r
-    public NoSuchItemException() : base() { }\r
-    /// <summary>\r
-    /// Create the exception with an explanation of the reason.\r
-    /// </summary>\r
-    /// <param name="message"></param>\r
-    public NoSuchItemException(string message) : base(message) { }\r
-  }\r
-\r
-  /// <summary>\r
-  /// An exception thrown by an operation on a list (<see cref="T:C5.IList`1"/>)\r
-  /// that only makes sense for a view, not for an underlying list.\r
-  /// </summary>\r
-  [Serializable]\r
-  public class NotAViewException : Exception\r
-  {\r
-    /// <summary>\r
-    /// Create a simple exception with no further explanation.\r
-    /// </summary>\r
-    public NotAViewException() : base() { }\r
-    /// <summary>\r
-    /// Create the exception with an explanation of the reason.\r
-    /// </summary>\r
-    /// <param name="message"></param>\r
-    public NotAViewException(string message) : base(message) { }\r
-  }\r
-\r
-  /// <summary>\r
-  /// An exception thrown when an operation attempts to create a duplicate in a collection with set semantics \r
-  /// (<see cref="P:C5.IExtensible`1.AllowsDuplicates"/> is false) or attempts to create a duplicate key in a dictionary.\r
-  /// <para>With collections this can only happen with Insert operations on lists, since the Add operations will\r
-  /// not try to create duplictes and either ignore the failure or report it in a bool return value.\r
-  /// </para>\r
-  /// <para>With dictionaries this can happen with the <see cref="M:C5.IDictionary`2.Add(`0,`1)"/> metod.</para>\r
-  /// </summary>\r
-  [Serializable]\r
-  public class DuplicateNotAllowedException : Exception\r
-  {\r
-    /// <summary>\r
-    /// Create a simple exception with no further explanation.\r
-    /// </summary>\r
-    public DuplicateNotAllowedException() : base() { }\r
-    /// <summary>\r
-    /// Create the exception with an explanation of the reason.\r
-    /// </summary>\r
-    /// <param name="message"></param>\r
-    public DuplicateNotAllowedException(string message) : base(message) { }\r
-  }\r
-\r
-  /// <summary>\r
-  /// \r
-  /// </summary>\r
-  [Serializable]\r
-  public class InvalidPriorityQueueHandleException : Exception\r
-  {\r
-    /// <summary>\r
-    /// Create a simple exception with no further explanation.\r
-    /// </summary>\r
-    public InvalidPriorityQueueHandleException() : base() { }\r
-    /// <summary>\r
-    /// Create the exception with an explanation of the reason.\r
-    /// </summary>\r
-    /// <param name="message"></param>\r
-    public InvalidPriorityQueueHandleException(string message) : base(message) { }\r
-  }\r
-\r
-  /// <summary>\r
-  /// An exception thrown by an operation that need to construct a natural\r
-  /// comparer for a type.\r
-  /// </summary>\r
-  [Serializable]\r
-  public class NotComparableException : Exception\r
-  {\r
-    /// <summary>\r
-    /// Create a simple exception with no further explanation.\r
-    /// </summary>\r
-    public NotComparableException() : base() { }\r
-    /// <summary>\r
-    /// Create the exception with an explanation of the reason.\r
-    /// </summary>\r
-    /// <param name="message"></param>\r
-    public NotComparableException(string message) : base(message) { }\r
-  }\r
-\r
-  /// <summary>\r
-  /// An exception thrown by operations on a list that expects an argument\r
-  /// that is a view on the same underlying list.\r
-  /// </summary>\r
-  [Serializable]\r
-  public class IncompatibleViewException : Exception\r
-  {\r
-    /// <summary>\r
-    /// Create a simple exception with no further explanation.\r
-    /// </summary>\r
-    public IncompatibleViewException() : base() { }\r
-    /// <summary>\r
-    /// Create the exception with an explanation of the reason.\r
-    /// </summary>\r
-    /// <param name="message"></param>\r
-    public IncompatibleViewException(string message) : base(message) { }\r
-  }\r
-\r
-}
-#endif
+/*
+ Copyright (c) 2003-2006 Niels Kokholm and Peter Sestoft
+ 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;
+using SCG = System.Collections.Generic;
+
+namespace C5
+{
+  /// <summary>
+  /// An exception to throw from library code when an internal inconsistency is encountered.
+  /// </summary>
+  public class InternalException : Exception
+  {
+    internal InternalException(string message) : base(message) { }
+  }
+
+  /// <summary>
+  /// An exception thrown by an update operation on a Read-Only collection or dictionary.
+  /// <para>This exception will be thrown unconditionally when an update operation 
+  /// (method or set property) is called. No check is made to see if the update operation, 
+  /// if allowed, would actually change the collection. </para>
+  /// </summary>
+  [Serializable]
+  public class ReadOnlyCollectionException : Exception
+  {
+    /// <summary>
+    /// Create a simple exception with no further explanation.
+    /// </summary>
+    public ReadOnlyCollectionException() : base() { }
+    /// <summary>
+    /// Create the exception with an explanation of the reason.
+    /// </summary>
+    /// <param name="message"></param>
+    public ReadOnlyCollectionException(string message) : base(message) { }
+  }
+
+  /// <summary>
+  /// 
+  /// </summary>
+  [Serializable]
+  public class FixedSizeCollectionException : Exception
+  {
+    /// <summary>
+    /// Create a simple exception with no further explanation.
+    /// </summary>
+    public FixedSizeCollectionException() : base() { }
+    /// <summary>
+    /// Create the exception with an explanation of the reason.
+    /// </summary>
+    /// <param name="message"></param>
+    public FixedSizeCollectionException(string message) : base(message) { }
+  }
+
+  /// <summary>
+  /// 
+  /// </summary>
+  [Serializable]
+  public class UnlistenableEventException : Exception
+  {
+    /// <summary>
+    /// Create a simple exception with no further explanation.
+    /// </summary>
+    public UnlistenableEventException() : base() { }
+    /// <summary>
+    /// Create the exception with an explanation of the reason.
+    /// </summary>
+    /// <param name="message"></param>
+    public UnlistenableEventException(string message) : base(message) { }
+  }
+
+  /// <summary>
+  /// An exception thrown by enumerators, range views etc. when accessed after 
+  /// the underlying collection has been modified.
+  /// </summary>
+  [Serializable]
+  public class CollectionModifiedException : Exception
+  {
+    /// <summary>
+    /// Create a simple exception with no further explanation.
+    /// </summary>
+    public CollectionModifiedException() : base() { }
+    /// <summary>
+    /// Create the exception with an explanation of the reason.
+    /// </summary>
+    /// <param name="message"></param>
+    public CollectionModifiedException(string message) : base(message) { }
+  }
+
+  /// <summary>
+  /// An excption thrown when trying to access a view (a list view on a <see cref="T:C5.IList`1"/> or 
+  /// a snapshot on a <see cref="T:C5.IPersistentSorted`1"/>)
+  /// that has been invalidated by some earlier operation.
+  /// <para>
+  /// The typical scenario is a view on a list that hash been invalidated by a call to 
+  /// Sort, Reverse or Shuffle on some other, overlapping view or the whole list.
+  /// </para>
+  /// </summary>
+  [Serializable]
+  public class ViewDisposedException : Exception
+  {
+    /// <summary>
+    /// Create a simple exception with no further explanation.
+    /// </summary>
+    public ViewDisposedException() : base() { }
+    /// <summary>
+    /// Create the exception with an explanation of the reason.
+    /// </summary>
+    /// <param name="message"></param>
+    public ViewDisposedException(string message) : base(message) { }
+  }
+
+  /// <summary>
+  /// An exception thrown by a lookup or lookup with update operation that does not 
+  /// find the lookup item and has no other means to communicate failure.
+  /// <para>The typical scenario is a lookup by key in a dictionary with an indexer,
+  /// see e.g. <see cref="P:C5.IDictionary`2.Item(`0)"/></para>
+  /// </summary>
+  [Serializable]
+  public class NoSuchItemException : Exception
+  {
+    /// <summary>
+    /// Create a simple exception with no further explanation.
+    /// </summary>
+    public NoSuchItemException() : base() { }
+    /// <summary>
+    /// Create the exception with an explanation of the reason.
+    /// </summary>
+    /// <param name="message"></param>
+    public NoSuchItemException(string message) : base(message) { }
+  }
+
+  /// <summary>
+  /// An exception thrown by an operation on a list (<see cref="T:C5.IList`1"/>)
+  /// that only makes sense for a view, not for an underlying list.
+  /// </summary>
+  [Serializable]
+  public class NotAViewException : Exception
+  {
+    /// <summary>
+    /// Create a simple exception with no further explanation.
+    /// </summary>
+    public NotAViewException() : base() { }
+    /// <summary>
+    /// Create the exception with an explanation of the reason.
+    /// </summary>
+    /// <param name="message"></param>
+    public NotAViewException(string message) : base(message) { }
+  }
+
+  /// <summary>
+  /// An exception thrown when an operation attempts to create a duplicate in a collection with set semantics 
+  /// (<see cref="P:C5.IExtensible`1.AllowsDuplicates"/> is false) or attempts to create a duplicate key in a dictionary.
+  /// <para>With collections this can only happen with Insert operations on lists, since the Add operations will
+  /// not try to create duplictes and either ignore the failure or report it in a bool return value.
+  /// </para>
+  /// <para>With dictionaries this can happen with the <see cref="M:C5.IDictionary`2.Add(`0,`1)"/> metod.</para>
+  /// </summary>
+  [Serializable]
+  public class DuplicateNotAllowedException : Exception
+  {
+    /// <summary>
+    /// Create a simple exception with no further explanation.
+    /// </summary>
+    public DuplicateNotAllowedException() : base() { }
+    /// <summary>
+    /// Create the exception with an explanation of the reason.
+    /// </summary>
+    /// <param name="message"></param>
+    public DuplicateNotAllowedException(string message) : base(message) { }
+  }
+
+  /// <summary>
+  /// 
+  /// </summary>
+  [Serializable]
+  public class InvalidPriorityQueueHandleException : Exception
+  {
+    /// <summary>
+    /// Create a simple exception with no further explanation.
+    /// </summary>
+    public InvalidPriorityQueueHandleException() : base() { }
+    /// <summary>
+    /// Create the exception with an explanation of the reason.
+    /// </summary>
+    /// <param name="message"></param>
+    public InvalidPriorityQueueHandleException(string message) : base(message) { }
+  }
+
+  /// <summary>
+  /// An exception thrown by an operation that need to construct a natural
+  /// comparer for a type.
+  /// </summary>
+  [Serializable]
+  public class NotComparableException : Exception
+  {
+    /// <summary>
+    /// Create a simple exception with no further explanation.
+    /// </summary>
+    public NotComparableException() : base() { }
+    /// <summary>
+    /// Create the exception with an explanation of the reason.
+    /// </summary>
+    /// <param name="message"></param>
+    public NotComparableException(string message) : base(message) { }
+  }
+
+  /// <summary>
+  /// An exception thrown by operations on a list that expects an argument
+  /// that is a view on the same underlying list.
+  /// </summary>
+  [Serializable]
+  public class IncompatibleViewException : Exception
+  {
+    /// <summary>
+    /// Create a simple exception with no further explanation.
+    /// </summary>
+    public IncompatibleViewException() : base() { }
+    /// <summary>
+    /// Create the exception with an explanation of the reason.
+    /// </summary>
+    /// <param name="message"></param>
+    public IncompatibleViewException(string message) : base(message) { }
+  }
+
+}
\ No newline at end of file