[Roam-commit] SF.net SVN: roam: [75] Trunk/Source
Status: Alpha
Brought to you by:
jonfroehlich
|
From: <jon...@us...> - 2007-04-12 22:41:02
|
Revision: 75
http://roam.svn.sourceforge.net/roam/?rev=75&view=rev
Author: jonfroehlich
Date: 2007-04-12 15:41:01 -0700 (Thu, 12 Apr 2007)
Log Message:
-----------
added ReadOnlyHashtable (which is self-explanatory)
slight update to comment block in PriorityQueue (removed old comment lines)
Modified Paths:
--------------
Trunk/Source/Roam.Common/Collections/PriorityQueue.cs
Trunk/Source/Roam.Common/Roam.Common.csproj
Trunk/Source/Roam.suo
Added Paths:
-----------
Trunk/Source/Roam.Common/Collections/ReadOnlyHashtable.cs
Modified: Trunk/Source/Roam.Common/Collections/PriorityQueue.cs
===================================================================
--- Trunk/Source/Roam.Common/Collections/PriorityQueue.cs 2007-04-12 07:28:43 UTC (rev 74)
+++ Trunk/Source/Roam.Common/Collections/PriorityQueue.cs 2007-04-12 22:41:01 UTC (rev 75)
@@ -28,9 +28,6 @@
/// Note that the value which is used by the priority queue to compare items
/// must be immutable
/// </summary>
- /// <summary>
- ///
- /// </summary>
/// <remarks>
///
/// </remarks>
Added: Trunk/Source/Roam.Common/Collections/ReadOnlyHashtable.cs
===================================================================
--- Trunk/Source/Roam.Common/Collections/ReadOnlyHashtable.cs (rev 0)
+++ Trunk/Source/Roam.Common/Collections/ReadOnlyHashtable.cs 2007-04-12 22:41:01 UTC (rev 75)
@@ -0,0 +1,86 @@
+#region Copyright & License
+//
+// Copyright (c) 2005 - 2007 The Regents of the University of Washington, Intel
+// Research Seattle, and the Roam project. All rights reserved.
+//
+// This software is open-source under the BSD license. You may obtain a copy
+// of this license at
+//
+// http://roam.sourceforge.net/license.txt
+//
+// Alternatively, please see "license.txt" which should be included in
+// this source code distribution.
+//
+#endregion Copyright & License
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Collections;
+
+namespace Roam.Common.Collections
+{
+ /// <summary>
+ /// Read only hashtable.
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ /// <author>Jon Froehlich</author>
+ public class ReadOnlyHashtable : Hashtable
+ {
+ public ReadOnlyHashtable(IDictionary d)
+ : base()
+ {
+ foreach (DictionaryEntry de in d)
+ {
+ base.Add(de.Key, de.Value);
+ }
+ }
+
+ #region Properties
+ public override bool IsReadOnly
+ {
+ get { return true; }
+ }
+
+ public override bool IsFixedSize
+ {
+ get { return true; }
+ }
+
+ public override object this[object key]
+ {
+ get
+ {
+ return base[key];
+ }
+ set
+ {
+ ThrowReadonlyException(string.Empty);
+ }
+ }
+ #endregion Properties
+
+ #region Methods
+ public override void Clear()
+ {
+ ThrowReadonlyException("Clear failed. ");
+ }
+
+ public override void Add(object key, object value)
+ {
+ ThrowReadonlyException("Add failed. ");
+ }
+
+ public override void Remove(object key)
+ {
+ ThrowReadonlyException("Remove failed. ");
+ }
+
+ protected virtual void ThrowReadonlyException(string prefix)
+ {
+ throw new InvalidOperationException(prefix + "The ReadOnlyHashtable is readonly");
+ }
+ #endregion Methods
+ }
+}
Modified: Trunk/Source/Roam.Common/Roam.Common.csproj
===================================================================
--- Trunk/Source/Roam.Common/Roam.Common.csproj 2007-04-12 07:28:43 UTC (rev 74)
+++ Trunk/Source/Roam.Common/Roam.Common.csproj 2007-04-12 22:41:01 UTC (rev 75)
@@ -63,6 +63,7 @@
<Compile Include="Collections\DfsTreeWalker.cs" />
<Compile Include="Collections\HashSet.cs" />
<Compile Include="Collections\PriorityQueue.cs" />
+ <Compile Include="Collections\ReadOnlyHashtable.cs" />
<Compile Include="Collections\ReverseComparer.cs" />
<Compile Include="Collections\ReverseEnumerator.cs" />
<Compile Include="Collections\Tree.cs" />
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|