diff --git a/Perspex.Base/Threading/NGenerics/Constants.cs b/NGenerics/Constants.cs
similarity index 100%
rename from Perspex.Base/Threading/NGenerics/Constants.cs
rename to NGenerics/Constants.cs
diff --git a/Perspex.Base/Threading/NGenerics/ComparisonComparer.cs b/NGenerics/DataStructures/Comparers/ComparisonComparer.cs
similarity index 96%
rename from Perspex.Base/Threading/NGenerics/ComparisonComparer.cs
rename to NGenerics/DataStructures/Comparers/ComparisonComparer.cs
index b1c5a2a860..8ba462c107 100644
--- a/Perspex.Base/Threading/NGenerics/ComparisonComparer.cs
+++ b/NGenerics/DataStructures/Comparers/ComparisonComparer.cs
@@ -19,7 +19,7 @@ namespace NGenerics.Comparers
///
/// The type of the objects to compare.
//[Serializable]
- internal sealed class ComparisonComparer : IComparer
+ public sealed class ComparisonComparer : IComparer
{
#region Globals
diff --git a/Perspex.Base/Threading/NGenerics/KeyValuePairComparer.cs b/NGenerics/DataStructures/Comparers/KeyValuePairComparer.cs
similarity index 96%
rename from Perspex.Base/Threading/NGenerics/KeyValuePairComparer.cs
rename to NGenerics/DataStructures/Comparers/KeyValuePairComparer.cs
index 05f14d1342..3cf39a1766 100644
--- a/Perspex.Base/Threading/NGenerics/KeyValuePairComparer.cs
+++ b/NGenerics/DataStructures/Comparers/KeyValuePairComparer.cs
@@ -18,7 +18,7 @@ namespace NGenerics.Comparers {
/// The key type.
/// The value type.
//[Serializable]
- internal class KeyValuePairComparer : IComparer> {
+ public class KeyValuePairComparer : IComparer> {
#region Globals
diff --git a/NGenerics/DataStructures/Comparers/ReverseComparer.cs b/NGenerics/DataStructures/Comparers/ReverseComparer.cs
new file mode 100644
index 0000000000..0b7f91b62d
--- /dev/null
+++ b/NGenerics/DataStructures/Comparers/ReverseComparer.cs
@@ -0,0 +1,83 @@
+/*
+ Copyright 2007-2013 The NGenerics Team
+ (https://github.com/ngenerics/ngenerics/wiki/Team)
+
+ This program is licensed under the GNU Lesser General Public License (LGPL). You should
+ have received a copy of the license along with the source code. If not, an online copy
+ of the license can be found at http://www.gnu.org/copyleft/lesser.html.
+*/
+
+
+using System;
+using System.Collections.Generic;
+using NGenerics.Util;
+
+namespace NGenerics.Comparers
+{
+ ///
+ /// A comparer that wraps the IComparable interface to reproduce the opposite comparison result.
+ ///
+ /// The type of the objects to compare.
+ //[Serializable]
+ public sealed class ReverseComparer : IComparer
+ {
+ #region Globals
+
+ private IComparer comparerToUse;
+
+ #endregion
+
+ #region Construction
+ ///
+ public ReverseComparer()
+ {
+ comparerToUse = Comparer.Default;
+ }
+
+
+ /// The comparer to reverse.
+ /// is a null reference (Nothing in Visual Basic).
+ public ReverseComparer(IComparer comparer)
+ {
+
+ Guard.ArgumentNotNull(comparer, "comparer");
+ comparerToUse = comparer;
+ }
+
+ #endregion
+
+ #region IComparer Members
+
+ ///
+ public int Compare(T x, T y)
+ {
+ return (comparerToUse.Compare(y, x));
+ }
+
+ #endregion
+
+ #region Public Members
+
+ ///
+ /// Gets or sets the comparer used in this instance.
+ ///
+ /// The comparer.
+ /// is a null reference (Nothing in Visual Basic).
+ public IComparer Comparer
+ {
+ get
+ {
+ return comparerToUse;
+ }
+ set
+ {
+
+ Guard.ArgumentNotNull(value, "value");
+
+ comparerToUse = value;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/NGenerics/DataStructures/General/Heap.cs b/NGenerics/DataStructures/General/Heap.cs
new file mode 100644
index 0000000000..0e00b3d1b8
--- /dev/null
+++ b/NGenerics/DataStructures/General/Heap.cs
@@ -0,0 +1,429 @@
+/*
+ Copyright 2007-2013 The NGenerics Team
+ (https://github.com/ngenerics/ngenerics/wiki/Team)
+
+ This program is licensed under the GNU Lesser General Public License (LGPL). You should
+ have received a copy of the license along with the source code. If not, an online copy
+ of the license can be found at http://www.gnu.org/copyleft/lesser.html.
+*/
+
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using NGenerics.Comparers;
+using System.Diagnostics.CodeAnalysis;
+using NGenerics.Util;
+
+namespace NGenerics.DataStructures.General
+{
+ ///
+ /// An implementation of a Heap data structure.
+ ///
+ /// The type of item stored in the .
+ //[Serializable]
+ [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+ [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
+ public class Heap : ICollection, IHeap
+ {
+ #region Globals
+
+ const string heapIsEmpty = "The heap is empty.";
+ private readonly List data;
+ private readonly IComparer comparerToUse;
+ private readonly HeapType thisType;
+
+ #endregion
+
+ #region Construction
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The type of Heap to create.
+ /// is not either or .
+ ///
+ ///
+ ///
+ ///
+ public Heap(HeapType type) : this(type, Comparer.Default) { }
+
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The type of heap.
+ /// The capacity.
+ /// is not either or .
+ /// is less than 0.
+ /// .
+ ///
+ ///
+ ///
+ ///
+ public Heap(HeapType type, int capacity) : this(type, capacity, Comparer.Default) { }
+
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The type of heap.
+ /// The comparer.
+ /// is not either or .
+ public Heap(HeapType type, Comparison comparer) : this(type, new ComparisonComparer(comparer)){}
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The type of heap.
+ /// The capacity of the heap to start with.
+ /// The comparer.
+ /// is not either or .
+ /// is less than 0.
+ public Heap(HeapType type, int capacity, Comparison comparer) : this(type, capacity, new ComparisonComparer(comparer)) { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The type of Heap to create.
+ /// The comparer to use.
+ /// is a null reference (Nothing in Visual Basic).
+ /// is not either or .
+ ///
+ ///
+ ///
+ ///
+ public Heap(HeapType type, IComparer comparer)
+ {
+ Guard.ArgumentNotNull(comparer, "comparer");
+
+ if ((type != HeapType.Minimum) && (type != HeapType.Maximum))
+ {
+ throw new ArgumentOutOfRangeException("type");
+ }
+
+ thisType = type;
+
+ data = new List {default(T)};
+
+ comparerToUse = type == HeapType.Minimum ? comparer : new ReverseComparer(comparer);
+ }
+
+
+ /// The type of heap.
+ /// The initial capacity of the Heap.
+ /// The comparer to use.
+ /// is less than 0..
+ /// is a null reference (Nothing in Visual Basic).
+ /// is not either or .
+ public Heap(HeapType type, int capacity, IComparer comparer)
+ {
+ Guard.ArgumentNotNull(comparer, "comparer");
+
+ if ((type != HeapType.Minimum) && (type != HeapType.Maximum))
+ {
+ throw new ArgumentOutOfRangeException("type");
+ }
+ thisType = type;
+
+ data = new List(capacity) {default(T)};
+
+ comparerToUse = type == HeapType.Minimum ? comparer : new ReverseComparer(comparer);
+ }
+
+ #endregion
+
+ #region Public Members
+
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public T Root
+ {
+ get
+ {
+ #region Validation
+
+ if (Count == 0)
+ {
+ throw new InvalidOperationException(heapIsEmpty);
+ }
+
+ #endregion
+
+ return data[1];
+ }
+ }
+
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public T RemoveRoot()
+ {
+ #region Validation
+
+ if (Count == 0)
+ {
+ throw new InvalidOperationException(heapIsEmpty);
+ }
+
+ #endregion
+
+ // The minimum item to return.
+ var minimum = data[1];
+
+ RemoveRootItem(minimum);
+ return minimum;
+ }
+
+
+ ///
+ /// Removes the root item.
+ ///
+ /// The item.
+ ///
+ /// Notes to Inheritors:
+ /// Derived classes can override this method to change the behavior of the method.
+ ///
+ protected virtual void RemoveRootItem(T item)
+ {
+
+ // The last item in the heap
+ var last = data[Count];
+ data.RemoveAt(Count);
+
+ // If there's still items left in this heap, re-heapify it.
+ if (Count > 0)
+ {
+ // Re-heapify the binary tree to conform to the heap property
+ var counter = 1;
+
+ while ((counter * 2) < (data.Count))
+ {
+ var child = counter * 2;
+
+ if (((child + 1) < (data.Count)) &&
+ (comparerToUse.Compare(data[child + 1], data[child]) < 0))
+ {
+ child++;
+ }
+
+ if (comparerToUse.Compare(last, data[child]) <= 0)
+ {
+ break;
+ }
+
+ data[counter] = data[child];
+ counter = child;
+ }
+
+ data[counter] = last;
+ }
+
+ }
+
+
+ ///
+ /// Gets the type of heap represented by this instance.
+ ///
+ /// The type of heap.
+ ///
+ ///
+ ///
+ ///
+ [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")]
+ public HeapType Type
+ {
+ get
+ {
+ return thisType;
+ }
+ }
+
+ #endregion
+
+ #region ICollection Members
+
+
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool IsEmpty
+ {
+ get
+ {
+ return Count == 0;
+ }
+ }
+
+
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool Contains(T item)
+ {
+ return data.Contains(item);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void CopyTo(T[] array, int arrayIndex)
+ {
+ #region Validation
+
+ Guard.ArgumentNotNull(array, "array");
+
+ if ((array.Length - arrayIndex) < Count)
+ {
+ throw new ArgumentException(Constants.NotEnoughSpaceInTheTargetArray, "array");
+ }
+
+ #endregion
+
+ for (var i = 1; i < data.Count; i++)
+ {
+ array[arrayIndex++] = data[i];
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int Count
+ {
+ get
+ {
+ return data.Count - 1;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void Add(T item)
+ {
+ AddItem(item);
+ }
+
+ ///
+ /// Adds the item.
+ ///
+ /// The item to add.
+ ///
+ /// Notes to Inheritors:
+ /// Derived classes can override this method to change the behavior of the method.
+ ///
+ protected virtual void AddItem(T item)
+ {
+ // Add a dummy to the end of the list (it will be replaced)
+ data.Add(default(T));
+
+ var counter = data.Count - 1;
+
+ while ((counter > 1) && (comparerToUse.Compare(data[counter / 2], item) > 0))
+ {
+ data[counter] = data[counter / 2];
+ counter = counter / 2;
+ }
+
+ data[counter] = item;
+ }
+
+
+
+ ///
+ /// Always.
+ [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+ bool ICollection.Remove(T item)
+ {
+ throw new NotSupportedException();
+ }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ ///
+ /// A that can be used to iterate through the collection.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IEnumerator GetEnumerator()
+ {
+ for (var i = 1; i < data.Count; i++)
+ {
+ yield return data[i];
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void Clear()
+ {
+ ClearItems();
+ }
+ ///
+ /// Clears all the objects in this instance.
+ ///
+ ///
+ /// Notes to Inheritors:
+ /// Derived classes can override this method to change the behavior of the method.
+ ///
+ protected virtual void ClearItems()
+ {
+ data.RemoveRange(1, data.Count - 1); // Clears all objects in this instance except the first dummy one.
+ }
+
+ #endregion
+
+ #region ICollection Members
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ #endregion
+
+ #region IEnumerable Members
+
+ ///
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ #endregion
+ }
+}
diff --git a/NGenerics/DataStructures/General/HeapType.cs b/NGenerics/DataStructures/General/HeapType.cs
new file mode 100644
index 0000000000..ba961f1d2b
--- /dev/null
+++ b/NGenerics/DataStructures/General/HeapType.cs
@@ -0,0 +1,29 @@
+/*
+ Copyright 2007-2013 The NGenerics Team
+ (https://github.com/ngenerics/ngenerics/wiki/Team)
+
+ This program is licensed under the GNU Lesser General Public License (LGPL). You should
+ have received a copy of the license along with the source code. If not, an online copy
+ of the license can be found at http://www.gnu.org/copyleft/lesser.html.
+*/
+
+
+
+namespace NGenerics.DataStructures.General
+{
+ ///
+ /// The type of to implemented.
+ ///
+ public enum HeapType
+ {
+ ///
+ /// Makes the heap a Minimum-Heap - the smallest item is kept in the root of the .
+ ///
+ Minimum,
+
+ ///
+ /// Makes the heap a Maximum-Heap - the largest item is kept in the root of the .
+ ///
+ Maximum
+ }
+}
\ No newline at end of file
diff --git a/NGenerics/DataStructures/General/IHeap.cs b/NGenerics/DataStructures/General/IHeap.cs
new file mode 100644
index 0000000000..2758af6391
--- /dev/null
+++ b/NGenerics/DataStructures/General/IHeap.cs
@@ -0,0 +1,41 @@
+/*
+ Copyright 2007-2013 The NGenerics Team
+ (https://github.com/ngenerics/ngenerics/wiki/Team)
+
+ This program is licensed under the GNU Lesser General Public License (LGPL). You should
+ have received a copy of the license along with the source code. If not, an online copy
+ of the license can be found at http://www.gnu.org/copyleft/lesser.html.
+*/
+
+
+using System;
+
+namespace NGenerics.DataStructures.General
+{
+ ///
+ /// An interface for the data structure.
+ ///
+ /// The type of elements in the heap.
+ public interface IHeap
+ {
+ ///
+ /// Adds the specified item.
+ ///
+ /// The item.
+ void Add(T item);
+
+ ///
+ /// Removes the root and returns it.
+ ///
+ /// The root of the .
+ /// The is empty.
+ T RemoveRoot();
+
+ ///
+ /// Gets the root.
+ ///
+ /// The root.
+ /// The is empty.
+ T Root { get; }
+ }
+}
diff --git a/Perspex.Base/Threading/NGenerics/IQueue.cs b/NGenerics/DataStructures/Queues/IQueue.cs
similarity index 97%
rename from Perspex.Base/Threading/NGenerics/IQueue.cs
rename to NGenerics/DataStructures/Queues/IQueue.cs
index 67490b4892..a113d42f13 100644
--- a/Perspex.Base/Threading/NGenerics/IQueue.cs
+++ b/NGenerics/DataStructures/Queues/IQueue.cs
@@ -18,7 +18,7 @@ namespace NGenerics.DataStructures.Queues
///
/// The type of the elements in the queue.
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
- internal interface IQueue
+ public interface IQueue
{
///
/// Enqueues the item at the back of the queue.
diff --git a/Perspex.Base/Threading/NGenerics/PriorityQueue.cs b/NGenerics/DataStructures/Queues/PriorityQueue.cs
similarity index 99%
rename from Perspex.Base/Threading/NGenerics/PriorityQueue.cs
rename to NGenerics/DataStructures/Queues/PriorityQueue.cs
index f24cc0c41c..662ae39bae 100644
--- a/Perspex.Base/Threading/NGenerics/PriorityQueue.cs
+++ b/NGenerics/DataStructures/Queues/PriorityQueue.cs
@@ -29,7 +29,7 @@ namespace NGenerics.DataStructures.Queues
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
//[Serializable]
- internal class PriorityQueue : ICollection, IQueue
+ public class PriorityQueue : ICollection, IQueue
{
#region Globals
diff --git a/Perspex.Base/Threading/NGenerics/PriorityQueueType.cs b/NGenerics/DataStructures/Queues/PriorityQueueType.cs
similarity index 95%
rename from Perspex.Base/Threading/NGenerics/PriorityQueueType.cs
rename to NGenerics/DataStructures/Queues/PriorityQueueType.cs
index 4b23aa4696..8c87d87811 100644
--- a/Perspex.Base/Threading/NGenerics/PriorityQueueType.cs
+++ b/NGenerics/DataStructures/Queues/PriorityQueueType.cs
@@ -12,7 +12,7 @@ namespace NGenerics.DataStructures.Queues
///
/// Specifies the Priority Queue type (min or max).
///
- internal enum PriorityQueueType
+ public enum PriorityQueueType
{
///
/// Specify a Minimum .
diff --git a/Perspex.Base/Threading/NGenerics/BinarySearchTreeBase.cs b/NGenerics/DataStructures/Trees/BinarySearchTreeBase.cs
similarity index 99%
rename from Perspex.Base/Threading/NGenerics/BinarySearchTreeBase.cs
rename to NGenerics/DataStructures/Trees/BinarySearchTreeBase.cs
index c4d77aa9be..ea2c44ff34 100644
--- a/Perspex.Base/Threading/NGenerics/BinarySearchTreeBase.cs
+++ b/NGenerics/DataStructures/Trees/BinarySearchTreeBase.cs
@@ -24,7 +24,7 @@ namespace NGenerics.DataStructures.Trees
///
///
//[Serializable]
- internal abstract class BinarySearchTreeBase : ISearchTree
+ public abstract class BinarySearchTreeBase : ISearchTree
{
#region Globals
diff --git a/Perspex.Base/Threading/NGenerics/BinaryTree.cs b/NGenerics/DataStructures/Trees/BinaryTree.cs
similarity index 99%
rename from Perspex.Base/Threading/NGenerics/BinaryTree.cs
rename to NGenerics/DataStructures/Trees/BinaryTree.cs
index 02f1b85096..f1bda540c1 100644
--- a/Perspex.Base/Threading/NGenerics/BinaryTree.cs
+++ b/NGenerics/DataStructures/Trees/BinaryTree.cs
@@ -23,7 +23,7 @@ namespace NGenerics.DataStructures.Trees
/// The type of elements in the .
//[Serializable]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
- internal class BinaryTree : ICollection, ITree
+ public class BinaryTree : ICollection, ITree
{
#region Globals
diff --git a/Perspex.Base/Threading/NGenerics/ISearchTree.cs b/NGenerics/DataStructures/Trees/ISearchTree.cs
similarity index 98%
rename from Perspex.Base/Threading/NGenerics/ISearchTree.cs
rename to NGenerics/DataStructures/Trees/ISearchTree.cs
index 6547a80faa..c9f5fb0534 100644
--- a/Perspex.Base/Threading/NGenerics/ISearchTree.cs
+++ b/NGenerics/DataStructures/Trees/ISearchTree.cs
@@ -21,7 +21,7 @@ namespace NGenerics.DataStructures.Trees
///
/// The type of element to hold in the tree.
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
- internal interface ISearchTree : ICollection {
+ public interface ISearchTree : ICollection {
///
/// Gets the largest item in the tree.
///
diff --git a/Perspex.Base/Threading/NGenerics/ITree.cs b/NGenerics/DataStructures/Trees/ITree.cs
similarity index 98%
rename from Perspex.Base/Threading/NGenerics/ITree.cs
rename to NGenerics/DataStructures/Trees/ITree.cs
index b7f49400d5..c80d8e8604 100644
--- a/Perspex.Base/Threading/NGenerics/ITree.cs
+++ b/NGenerics/DataStructures/Trees/ITree.cs
@@ -14,7 +14,7 @@ namespace NGenerics.DataStructures.Trees {
/// An interface for the tree data structure
///
/// The type of elements in the tree.
- internal interface ITree {
+ public interface ITree {
///
/// Adds the specified child to the tree.
///
diff --git a/Perspex.Base/Threading/NGenerics/NodeColor.cs b/NGenerics/DataStructures/Trees/NodeColor.cs
similarity index 100%
rename from Perspex.Base/Threading/NGenerics/NodeColor.cs
rename to NGenerics/DataStructures/Trees/NodeColor.cs
diff --git a/Perspex.Base/Threading/NGenerics/RedBlackTree.cs b/NGenerics/DataStructures/Trees/RedBlackTree.cs
similarity index 99%
rename from Perspex.Base/Threading/NGenerics/RedBlackTree.cs
rename to NGenerics/DataStructures/Trees/RedBlackTree.cs
index d7e2bfb699..422155aa4a 100644
--- a/Perspex.Base/Threading/NGenerics/RedBlackTree.cs
+++ b/NGenerics/DataStructures/Trees/RedBlackTree.cs
@@ -24,7 +24,7 @@ namespace NGenerics.DataStructures.Trees {
/// The type of element to keep in the tree.
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
//[Serializable]
- internal class RedBlackTree : BinarySearchTreeBase {
+ public class RedBlackTree : BinarySearchTreeBase {
#region Construction
diff --git a/Perspex.Base/Threading/NGenerics/RedBlackTreeDictionary.cs b/NGenerics/DataStructures/Trees/RedBlackTreeDictionary.cs
similarity index 98%
rename from Perspex.Base/Threading/NGenerics/RedBlackTreeDictionary.cs
rename to NGenerics/DataStructures/Trees/RedBlackTreeDictionary.cs
index 5333915862..de0d677d07 100644
--- a/Perspex.Base/Threading/NGenerics/RedBlackTreeDictionary.cs
+++ b/NGenerics/DataStructures/Trees/RedBlackTreeDictionary.cs
@@ -31,7 +31,7 @@ namespace NGenerics.DataStructures.Trees
#if (!SILVERLIGHT && !WINDOWSPHONE)
//[Serializable]
#endif
- internal class RedBlackTree : RedBlackTree>, IDictionary // BinarySearchTreeBase
+ public class RedBlackTree : RedBlackTree>, IDictionary // BinarySearchTreeBase
{
#region Construction
///
diff --git a/Perspex.Base/Threading/NGenerics/RedBlackTreeList.cs b/NGenerics/DataStructures/Trees/RedBlackTreeList.cs
similarity index 100%
rename from Perspex.Base/Threading/NGenerics/RedBlackTreeList.cs
rename to NGenerics/DataStructures/Trees/RedBlackTreeList.cs
diff --git a/Perspex.Base/Threading/NGenerics/RedBlackTreeNode.cs b/NGenerics/DataStructures/Trees/RedBlackTreeNode.cs
similarity index 100%
rename from Perspex.Base/Threading/NGenerics/RedBlackTreeNode.cs
rename to NGenerics/DataStructures/Trees/RedBlackTreeNode.cs
diff --git a/NGenerics/NGenerics.csproj b/NGenerics/NGenerics.csproj
new file mode 100644
index 0000000000..bb4044554e
--- /dev/null
+++ b/NGenerics/NGenerics.csproj
@@ -0,0 +1,76 @@
+
+
+
+
+ 11.0
+ Debug
+ AnyCPU
+ {415E048E-4611-4815-9CF2-D774E29079AC}
+ Library
+ Properties
+ NGenerics
+ NGenerics
+ en-US
+ 512
+ {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ Profile7
+ v4.5
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Perspex.Base/Threading/NGenerics/IVisitor.cs b/NGenerics/Patterns/Visitor/IVisitor.cs
similarity index 96%
rename from Perspex.Base/Threading/NGenerics/IVisitor.cs
rename to NGenerics/Patterns/Visitor/IVisitor.cs
index 6ec7cb8852..d9460e51a9 100644
--- a/Perspex.Base/Threading/NGenerics/IVisitor.cs
+++ b/NGenerics/Patterns/Visitor/IVisitor.cs
@@ -14,7 +14,7 @@ namespace NGenerics.Patterns.Visitor
/// Provides an interface for visitors.
///
/// The type of objects to be visited.
- internal interface IVisitor
+ public interface IVisitor
{
///
/// Gets a value indicating whether this instance is done performing it's work..
diff --git a/Perspex.Base/Threading/NGenerics/InOrderVisitor.cs b/NGenerics/Patterns/Visitor/InOrderVisitor.cs
similarity index 95%
rename from Perspex.Base/Threading/NGenerics/InOrderVisitor.cs
rename to NGenerics/Patterns/Visitor/InOrderVisitor.cs
index dbe64f07dc..12ba98e55e 100644
--- a/Perspex.Base/Threading/NGenerics/InOrderVisitor.cs
+++ b/NGenerics/Patterns/Visitor/InOrderVisitor.cs
@@ -14,7 +14,7 @@ namespace NGenerics.Patterns.Visitor
/// An in order implementation of the class.
///
/// The type of objects to be visited.
- internal sealed class InOrderVisitor : OrderedVisitor
+ public sealed class InOrderVisitor : OrderedVisitor
{
#region Construction
diff --git a/Perspex.Base/Threading/NGenerics/KeyTrackingVisitor.cs b/NGenerics/Patterns/Visitor/KeyTrackingVisitor.cs
similarity index 94%
rename from Perspex.Base/Threading/NGenerics/KeyTrackingVisitor.cs
rename to NGenerics/Patterns/Visitor/KeyTrackingVisitor.cs
index 4265115586..d03f935fe3 100644
--- a/Perspex.Base/Threading/NGenerics/KeyTrackingVisitor.cs
+++ b/NGenerics/Patterns/Visitor/KeyTrackingVisitor.cs
@@ -17,7 +17,7 @@ namespace NGenerics.Patterns.Visitor
///
/// The type of the keys for the items to be visited.
/// The type of the values for the items to be visited.
- internal sealed class KeyTrackingVisitor : IVisitor>
+ public sealed class KeyTrackingVisitor : IVisitor>
{
#region Globals
diff --git a/Perspex.Base/Threading/NGenerics/OrderedVisitor.cs b/NGenerics/Patterns/Visitor/OrderedVisitor.cs
similarity index 98%
rename from Perspex.Base/Threading/NGenerics/OrderedVisitor.cs
rename to NGenerics/Patterns/Visitor/OrderedVisitor.cs
index c639825d09..881c4bfda1 100644
--- a/Perspex.Base/Threading/NGenerics/OrderedVisitor.cs
+++ b/NGenerics/Patterns/Visitor/OrderedVisitor.cs
@@ -19,7 +19,7 @@ namespace NGenerics.Patterns.Visitor
/// Used primarily as a base class for Visitors specializing in a specific order type.
///
/// The type of objects to be visited.
- internal class OrderedVisitor : IVisitor
+ public class OrderedVisitor : IVisitor
{
#region Globals
diff --git a/Perspex.Base/Threading/NGenerics/TrackingVisitor.cs b/NGenerics/Patterns/Visitor/TrackingVisitor.cs
similarity index 96%
rename from Perspex.Base/Threading/NGenerics/TrackingVisitor.cs
rename to NGenerics/Patterns/Visitor/TrackingVisitor.cs
index 14f5e6f2b6..17d4c67fa4 100644
--- a/Perspex.Base/Threading/NGenerics/TrackingVisitor.cs
+++ b/NGenerics/Patterns/Visitor/TrackingVisitor.cs
@@ -18,7 +18,7 @@ namespace NGenerics.Patterns.Visitor
/// data structures.
///
/// The type of objects to be visited.
- internal sealed class TrackingVisitor : IVisitor
+ public sealed class TrackingVisitor : IVisitor
{
#region Globals
diff --git a/Perspex.Base/Threading/NGenerics/ValueTrackingVisitor.cs b/NGenerics/Patterns/Visitor/ValueTrackingVisitor.cs
similarity index 94%
rename from Perspex.Base/Threading/NGenerics/ValueTrackingVisitor.cs
rename to NGenerics/Patterns/Visitor/ValueTrackingVisitor.cs
index d0f8f0eff9..01d79e6617 100644
--- a/Perspex.Base/Threading/NGenerics/ValueTrackingVisitor.cs
+++ b/NGenerics/Patterns/Visitor/ValueTrackingVisitor.cs
@@ -17,7 +17,7 @@ namespace NGenerics.Patterns.Visitor
///
/// The type of key of the KeyValuePair.
/// The type of value of the KeyValuePair.
- internal sealed class ValueTrackingVisitor : IVisitor>
+ public sealed class ValueTrackingVisitor : IVisitor>
{
#region Globals
diff --git a/NGenerics/Properties/AssemblyInfo.cs b/NGenerics/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..f36d08c227
--- /dev/null
+++ b/NGenerics/Properties/AssemblyInfo.cs
@@ -0,0 +1,30 @@
+using System.Resources;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("NGenerics")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("NGenerics")]
+[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Perspex.Base/Threading/NGenerics/Guard.cs b/NGenerics/Util/Guard.cs
similarity index 98%
rename from Perspex.Base/Threading/NGenerics/Guard.cs
rename to NGenerics/Util/Guard.cs
index bd3de2a291..89f70a7cba 100644
--- a/Perspex.Base/Threading/NGenerics/Guard.cs
+++ b/NGenerics/Util/Guard.cs
@@ -15,7 +15,7 @@ namespace NGenerics.Util
///
/// Performs common argument validation.
///
- internal static class Guard
+ public static class Guard
{
#region Methods
diff --git a/Perspex.Application/Application.cs b/Perspex.Application/Application.cs
index f6dafd8211..c78d67f1fb 100644
--- a/Perspex.Application/Application.cs
+++ b/Perspex.Application/Application.cs
@@ -10,6 +10,8 @@ namespace Perspex
using System.Threading;
using Perspex.Controls;
using Perspex.Input;
+ using Perspex.Layout;
+ using Perspex.Rendering;
using Perspex.Styling;
using Perspex.Threading;
using Splat;
@@ -90,6 +92,9 @@ namespace Perspex
Locator.CurrentMutable.Register(() => this.FocusManager, typeof(IFocusManager));
Locator.CurrentMutable.Register(() => this.InputManager, typeof(IInputManager));
Locator.CurrentMutable.Register(() => this.styler, typeof(IStyler));
+
+ Locator.CurrentMutable.Register(() => new LayoutManager(), typeof(ILayoutManager));
+ Locator.CurrentMutable.Register(() => new RenderManager(), typeof(IRenderManager));
}
}
}
diff --git a/Perspex.Base/Perspex.Base.csproj b/Perspex.Base/Perspex.Base.csproj
index e560962bbd..18f0441456 100644
--- a/Perspex.Base/Perspex.Base.csproj
+++ b/Perspex.Base/Perspex.Base.csproj
@@ -54,28 +54,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -98,7 +76,12 @@
-
+
+
+ {415e048e-4611-4815-9cf2-d774e29079ac}
+ NGenerics
+
+
diff --git a/Perspex.Controls/Presenters/ContentPresenter.cs b/Perspex.Controls/Presenters/ContentPresenter.cs
index 3d9958cf6f..fb233d4aa2 100644
--- a/Perspex.Controls/Presenters/ContentPresenter.cs
+++ b/Perspex.Controls/Presenters/ContentPresenter.cs
@@ -15,7 +15,7 @@ namespace Perspex.Controls.Presenters
public class ContentPresenter : Control, IVisual
{
public static readonly PerspexProperty