|
From: <ad...@us...> - 2007-02-04 02:15:22
|
Revision: 45
http://svn.sourceforge.net/g3l/?rev=45&view=rev
Author: adamluk
Date: 2007-02-03 18:15:21 -0800 (Sat, 03 Feb 2007)
Log Message:
-----------
Added csUnit.dll to G3L.UnitTests output.
Finished writing queue collection, created QueueEnumerator class.
Modified Paths:
--------------
src/trunk/G3L.Core/Collections/Queue.cs
src/trunk/G3L.Core/G3L.Core.csproj
src/trunk/G3L.Core/bin/Debug/G3L.Core.dll
src/trunk/G3L.Core/bin/Debug/G3L.Core.pdb
src/trunk/G3L.Core/obj/Debug/G3L.Core.dll
src/trunk/G3L.Core/obj/Debug/G3L.Core.pdb
src/trunk/G3L.Data/bin/Debug/G3L.Data.dll
src/trunk/G3L.Data/bin/Debug/G3L.Data.pdb
src/trunk/G3L.Data/obj/Debug/G3L.Data.dll
src/trunk/G3L.Data/obj/Debug/G3L.Data.pdb
src/trunk/G3L.Debug/Log/LoggerEventHandler.cs
src/trunk/G3L.Debug/bin/Debug/G3L.Debug.dll
src/trunk/G3L.Debug/bin/Debug/G3L.Debug.pdb
src/trunk/G3L.Debug/obj/Debug/G3L.Debug.dll
src/trunk/G3L.Debug/obj/Debug/G3L.Debug.pdb
src/trunk/G3L.Framework/bin/Debug/G3L.Framework.dll
src/trunk/G3L.Framework/bin/Debug/G3L.Framework.pdb
src/trunk/G3L.Framework/obj/Debug/G3L.Framework.dll
src/trunk/G3L.Framework/obj/Debug/G3L.Framework.pdb
src/trunk/G3L.Net/bin/Debug/G3L.Net.dll
src/trunk/G3L.Net/bin/Debug/G3L.Net.pdb
src/trunk/G3L.Net/obj/Debug/G3L.Net.dll
src/trunk/G3L.Net/obj/Debug/G3L.Net.pdb
src/trunk/G3L.UnitTests/G3L.UnitTests.csproj
src/trunk/G3L.UnitTests/bin/Debug/G3L.Debug.dll
src/trunk/G3L.UnitTests/bin/Debug/G3L.Debug.pdb
src/trunk/G3L.UnitTests/bin/Debug/G3L.UnitTests.dll
src/trunk/G3L.UnitTests/bin/Debug/G3L.UnitTests.pdb
src/trunk/G3L.UnitTests/obj/Debug/G3L.UnitTests.dll
src/trunk/G3L.UnitTests/obj/Debug/G3L.UnitTests.pdb
src/trunk/G3L.UnitTests/obj/Debug/ResolveAssemblyReference.cache
src/trunk/G3L.UnitTests/obj/G3L.UnitTests.csproj.FileList.txt
src/trunk/G3L.Util/bin/Debug/G3L.Util.dll
src/trunk/G3L.Util/bin/Debug/G3L.Util.pdb
src/trunk/G3L.Util/obj/Debug/G3L.Util.dll
src/trunk/G3L.Util/obj/Debug/G3L.Util.pdb
src/trunk/G3L.suo
Added Paths:
-----------
src/trunk/G3L.Core/Collections/QueueEnumerator.cs
src/trunk/G3L.UnitTests/bin/Debug/csUnit.dll
Modified: src/trunk/G3L.Core/Collections/Queue.cs
===================================================================
--- src/trunk/G3L.Core/Collections/Queue.cs 2007-02-03 23:48:14 UTC (rev 44)
+++ src/trunk/G3L.Core/Collections/Queue.cs 2007-02-04 02:15:21 UTC (rev 45)
@@ -1,4 +1,5 @@
using System;
+using System.Collections;
using System.Collections.Generic;
namespace G3L.Core.Collections
@@ -6,11 +7,11 @@
[Serializable]
public class Queue<T> : ICollection<T>, IEnumerable<T>, ICloneable
{
- private int _Head = 0;
- private int _Count = 0;
+ private int _Head;
+ private int _Count;
private int _Capacity;
private float _GrowthFactor;
- private int _ModifiedCount = 0;
+ private int _ModifiedCount;
private T[] _Contents;
public virtual int Count
@@ -18,6 +19,11 @@
get { return this._Count; }
}
+ public int ModifiedCount
+ {
+ get { return this._ModifiedCount; }
+ }
+
public virtual bool IsSynchronized
{
get { return false; }
@@ -28,8 +34,80 @@
get { return this; }
}
- public virtual void CopyTo(Array destinationArray, int index)
+ public virtual bool IsReadOnly
{
+ get { return false; }
+ }
+
+ public Queue()
+ : this(32, 2.0F)
+ {
+
+ }
+
+ public Queue(int capacity)
+ : this(capacity, 2.0F)
+ {
+
+ }
+
+ public Queue(ICollection<T> collection)
+ : this(collection == null ? 32 : collection.Count)
+ {
+ if (collection == null)
+ {
+ throw new ArgumentNullException("collection");
+ }
+
+ this._Count = this._Capacity;
+ collection.CopyTo(this._Contents, 0);
+ }
+
+ public Queue(int capacity, float growthFactor)
+ {
+ // Check capacity isnt negative
+ if (capacity < 0)
+ {
+ throw new ArgumentOutOfRangeException("capacity");
+ }
+
+ // Check growthFactor is between 1.0 and 10.0
+ if (!(growthFactor >= 1.0F && growthFactor <= 10.0F))
+ {
+ throw new ArgumentOutOfRangeException("growthFactor");
+ }
+
+ this._Capacity = capacity;
+ this._Contents = new T[this._Capacity];
+
+ this._GrowthFactor = growthFactor;
+ }
+
+ // FIXME: Needs to interface IEnumerable.GetEnumerator()
+ public IEnumerator<T> GetEnumerator()
+ {
+ return new QueueEnumerator<T>(this);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return this.GetEnumerator();
+ }
+
+ // TODO: Add(T) ICollection method
+ public void Add(T item)
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+
+ // TODO: Remove(T) ICollection method
+ public bool Remove(T item)
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+
+ public virtual void CopyTo(T[] destinationArray, int index)
+ {
// Array cannot be null
if (destinationArray == null)
{
@@ -67,7 +145,7 @@
for (int i = this._Contents.Length - 1; i >= 0; i--)
{
- this._Contents[i] = null;
+ this._Contents[i] = default(T);
}
}
@@ -85,5 +163,117 @@
this._Capacity = newCapacity;
this._Head = 0;
}
+
+ public virtual object Clone()
+ {
+ return new object();
+ }
+
+ public virtual bool Contains(T obj)
+ {
+ int tail = this._Head + this._Count;
+
+ if (obj == null)
+ {
+ for (int i = this._Head; i < tail; i++)
+ {
+ if (this._Contents[i % this._Capacity] == null)
+ {
+ return true;
+ }
+ }
+ }
+ else
+ {
+ for (int i = this._Head; i < tail; i++)
+ {
+ if (obj.Equals(this._Contents[i % this._Capacity]))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// Private Queue Enumerator class.
+ /// </summary>
+ /// <typeparam name="J"></typeparam>
+ [Serializable]
+ private class QueueEnumerator<J> : IEnumerator<J>, ICloneable
+ {
+ private Queue<J> _Queue;
+ private int _ModifiedCount;
+ private int _Current;
+
+ public J Current
+ {
+ get
+ {
+ if (this._ModifiedCount != this._Queue.ModifiedCount || this._Current < 0 || this._Current >= this._Queue.Count)
+ {
+ throw new InvalidOperationException();
+ }
+
+ return this._Queue._Contents[(this._Queue._Head + this._Current) % this._Queue._Contents.Length];
+ }
+ }
+
+ object IEnumerator.Current
+ {
+ get { return this.Current; }
+ }
+
+ internal QueueEnumerator(Queue<J> queue)
+ {
+ this._Queue = queue;
+ this._ModifiedCount = queue.ModifiedCount;
+ this._Current = -1; // One element before the head.
+ }
+
+ public object Clone()
+ {
+ QueueEnumerator<J> queueEnumerator = new QueueEnumerator<J>(this._Queue);
+ queueEnumerator._ModifiedCount = this._ModifiedCount;
+ queueEnumerator._Current = this._Current;
+
+ return queueEnumerator;
+ }
+
+ public virtual bool MoveNext()
+ {
+ if (this._ModifiedCount != this._Queue.ModifiedCount)
+ {
+ throw new InvalidOperationException();
+ }
+
+ if (this._Current >= this._Queue.Count - 1)
+ {
+ return false;
+ }
+ else
+ {
+ this._Current++;
+ return true;
+ }
+ }
+
+ public virtual void Reset()
+ {
+ if (this._ModifiedCount != this._Queue.ModifiedCount)
+ {
+ throw new InvalidOperationException();
+ }
+
+ this._Current = -1;
+ }
+
+ public void Dispose()
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
}
}
Added: src/trunk/G3L.Core/Collections/QueueEnumerator.cs
===================================================================
--- src/trunk/G3L.Core/Collections/QueueEnumerator.cs (rev 0)
+++ src/trunk/G3L.Core/Collections/QueueEnumerator.cs 2007-02-04 02:15:21 UTC (rev 45)
@@ -0,0 +1,8 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace G3L.Core.Collections
+{
+
+}
Modified: src/trunk/G3L.Core/G3L.Core.csproj
===================================================================
--- src/trunk/G3L.Core/G3L.Core.csproj 2007-02-03 23:48:14 UTC (rev 44)
+++ src/trunk/G3L.Core/G3L.Core.csproj 2007-02-04 02:15:21 UTC (rev 45)
@@ -34,6 +34,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Collections\Queue.cs" />
+ <Compile Include="Collections\QueueEnumerator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Modified: src/trunk/G3L.Core/bin/Debug/G3L.Core.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Core/bin/Debug/G3L.Core.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Core/obj/Debug/G3L.Core.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Core/obj/Debug/G3L.Core.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Data/bin/Debug/G3L.Data.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Data/bin/Debug/G3L.Data.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Data/obj/Debug/G3L.Data.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Data/obj/Debug/G3L.Data.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Debug/Log/LoggerEventHandler.cs
===================================================================
--- src/trunk/G3L.Debug/Log/LoggerEventHandler.cs 2007-02-03 23:48:14 UTC (rev 44)
+++ src/trunk/G3L.Debug/Log/LoggerEventHandler.cs 2007-02-04 02:15:21 UTC (rev 45)
@@ -26,7 +26,7 @@
if (this._Alive) return;
this._Alive = true;
- this._Dispatcher = new Thread(new ThreadStart());
+ this._Dispatcher = new Thread(new ThreadStart(this.DispatchMessages));
this._Dispatcher.Start();
}
Modified: src/trunk/G3L.Debug/bin/Debug/G3L.Debug.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Debug/bin/Debug/G3L.Debug.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Debug/obj/Debug/G3L.Debug.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Debug/obj/Debug/G3L.Debug.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Framework/bin/Debug/G3L.Framework.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Framework/bin/Debug/G3L.Framework.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Framework/obj/Debug/G3L.Framework.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Framework/obj/Debug/G3L.Framework.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Net/bin/Debug/G3L.Net.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Net/bin/Debug/G3L.Net.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Net/obj/Debug/G3L.Net.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Net/obj/Debug/G3L.Net.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.UnitTests/G3L.UnitTests.csproj
===================================================================
--- src/trunk/G3L.UnitTests/G3L.UnitTests.csproj 2007-02-03 23:48:14 UTC (rev 44)
+++ src/trunk/G3L.UnitTests/G3L.UnitTests.csproj 2007-02-04 02:15:21 UTC (rev 45)
@@ -28,7 +28,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="csUnit, Version=2.1.1.6855, Culture=neutral, PublicKeyToken=6871f04765cca910, processorArchitecture=MSIL" />
+ <Reference Include="csUnit, Version=2.1.1.6855, Culture=neutral, PublicKeyToken=6871f04765cca910, processorArchitecture=MSIL">
+ <Private>True</Private>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
Modified: src/trunk/G3L.UnitTests/bin/Debug/G3L.Debug.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.UnitTests/bin/Debug/G3L.Debug.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.UnitTests/bin/Debug/G3L.UnitTests.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.UnitTests/bin/Debug/G3L.UnitTests.pdb
===================================================================
(Binary files differ)
Added: src/trunk/G3L.UnitTests/bin/Debug/csUnit.dll
===================================================================
(Binary files differ)
Property changes on: src/trunk/G3L.UnitTests/bin/Debug/csUnit.dll
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: src/trunk/G3L.UnitTests/obj/Debug/G3L.UnitTests.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.UnitTests/obj/Debug/G3L.UnitTests.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.UnitTests/obj/Debug/ResolveAssemblyReference.cache
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.UnitTests/obj/G3L.UnitTests.csproj.FileList.txt
===================================================================
--- src/trunk/G3L.UnitTests/obj/G3L.UnitTests.csproj.FileList.txt 2007-02-03 23:48:14 UTC (rev 44)
+++ src/trunk/G3L.UnitTests/obj/G3L.UnitTests.csproj.FileList.txt 2007-02-04 02:15:21 UTC (rev 45)
@@ -5,3 +5,4 @@
bin\Debug\G3L.Debug.pdb
obj\Debug\G3L.UnitTests.dll
obj\Debug\G3L.UnitTests.pdb
+bin\Debug\csUnit.dll
Modified: src/trunk/G3L.Util/bin/Debug/G3L.Util.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Util/bin/Debug/G3L.Util.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Util/obj/Debug/G3L.Util.dll
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.Util/obj/Debug/G3L.Util.pdb
===================================================================
(Binary files differ)
Modified: src/trunk/G3L.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|