1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
|
/*
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) { }
}
}
|