Skip to content

Commit

Permalink
Feature/one file per class (sestoft#88)
Browse files Browse the repository at this point in the history
* PascalCased folders
* One file per class etc.
* Moving to proper folders
  • Loading branch information
ondfisk authored Jun 1, 2019
1 parent de05786 commit 1823d29
Show file tree
Hide file tree
Showing 134 changed files with 10,033 additions and 9,825 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ $tf/
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
*.DotSettings

# JustCode is a .NET coding add-in
.JustCode
Expand Down
218 changes: 109 additions & 109 deletions C5.Tests/arrays/ArrayListTest.cs → C5.Tests/Arrays/ArrayListTest.cs

Large diffs are not rendered by default.

File renamed without changes.

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions C5.Tests/heaps/HeapTests.cs → C5.Tests/Heaps/HeapTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void Init()
[Test]
public void Listenable()
{
Assert.AreEqual(EventTypeEnum.Basic, queue.ListenableEvents);
Assert.AreEqual(EventType.Basic, queue.ListenableEvents);
}

private enum Acts
Expand All @@ -61,13 +61,13 @@ public void Direct()
CollectionChangedHandler<int> cch;
ItemsAddedHandler<int> iah;
ItemsRemovedHandler<int> irh;
Assert.AreEqual(EventTypeEnum.None, queue.ActiveEvents);
Assert.AreEqual(EventType.None, queue.ActiveEvents);
queue.CollectionChanged += (cch = new CollectionChangedHandler<int>(queue_CollectionChanged));
Assert.AreEqual(EventTypeEnum.Changed, queue.ActiveEvents);
Assert.AreEqual(EventType.Changed, queue.ActiveEvents);
queue.ItemsAdded += (iah = new ItemsAddedHandler<int>(queue_ItemAdded));
Assert.AreEqual(EventTypeEnum.Changed | EventTypeEnum.Added, queue.ActiveEvents);
Assert.AreEqual(EventType.Changed | EventType.Added, queue.ActiveEvents);
queue.ItemsRemoved += (irh = new ItemsRemovedHandler<int>(queue_ItemRemoved));
Assert.AreEqual(EventTypeEnum.Changed | EventTypeEnum.Added | EventTypeEnum.Removed, queue.ActiveEvents);
Assert.AreEqual(EventType.Changed | EventType.Added | EventType.Removed, queue.ActiveEvents);
queue.Add(34);
queue.Add(56);
queue.AddAll(new int[] { });
Expand All @@ -87,11 +87,11 @@ public void Direct()
Assert.AreEqual(vals[i], events[i].Value, "Value " + i);
}
queue.CollectionChanged -= cch;
Assert.AreEqual(EventTypeEnum.Added | EventTypeEnum.Removed, queue.ActiveEvents);
Assert.AreEqual(EventType.Added | EventType.Removed, queue.ActiveEvents);
queue.ItemsAdded -= iah;
Assert.AreEqual(EventTypeEnum.Removed, queue.ActiveEvents);
Assert.AreEqual(EventType.Removed, queue.ActiveEvents);
queue.ItemsRemoved -= irh;
Assert.AreEqual(EventTypeEnum.None, queue.ActiveEvents);
Assert.AreEqual(EventType.None, queue.ActiveEvents);
}

[Test]
Expand Down
File renamed without changes.
46 changes: 23 additions & 23 deletions C5.Tests/SupportClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,42 +187,42 @@ public override SCG.IEnumerator<T> GetEnumerator()
public class CollectionEventList<T>
{
private readonly ArrayList<CollectionEvent<T>> happened;
private EventTypeEnum listenTo;
private EventType listenTo;
private readonly SCG.IEqualityComparer<T> itemequalityComparer;
public CollectionEventList(SCG.IEqualityComparer<T> itemequalityComparer)
{
happened = new ArrayList<CollectionEvent<T>>();
this.itemequalityComparer = itemequalityComparer;
}
public void Listen(ICollectionValue<T> list, EventTypeEnum listenTo)
public void Listen(ICollectionValue<T> list, EventType listenTo)
{
this.listenTo = listenTo;
if ((listenTo & EventTypeEnum.Changed) != 0)
if ((listenTo & EventType.Changed) != 0)
{
list.CollectionChanged += new CollectionChangedHandler<T>(changed);
}

if ((listenTo & EventTypeEnum.Cleared) != 0)
if ((listenTo & EventType.Cleared) != 0)
{
list.CollectionCleared += new CollectionClearedHandler<T>(cleared);
}

if ((listenTo & EventTypeEnum.Removed) != 0)
if ((listenTo & EventType.Removed) != 0)
{
list.ItemsRemoved += new ItemsRemovedHandler<T>(removed);
}

if ((listenTo & EventTypeEnum.Added) != 0)
if ((listenTo & EventType.Added) != 0)
{
list.ItemsAdded += new ItemsAddedHandler<T>(added);
}

if ((listenTo & EventTypeEnum.Inserted) != 0)
if ((listenTo & EventType.Inserted) != 0)
{
list.ItemInserted += new ItemInsertedHandler<T>(inserted);
}

if ((listenTo & EventTypeEnum.RemovedAt) != 0)
if ((listenTo & EventType.RemovedAt) != 0)
{
list.ItemRemovedAt += new ItemRemovedAtHandler<T>(removedAt);
}
Expand Down Expand Up @@ -269,44 +269,44 @@ public void Print(System.IO.TextWriter writer)

private void changed(object sender)
{
happened.Add(new CollectionEvent<T>(EventTypeEnum.Changed, new EventArgs(), sender));
happened.Add(new CollectionEvent<T>(EventType.Changed, new EventArgs(), sender));
}

private void cleared(object sender, ClearedEventArgs eventArgs)
{
happened.Add(new CollectionEvent<T>(EventTypeEnum.Cleared, eventArgs, sender));
happened.Add(new CollectionEvent<T>(EventType.Cleared, eventArgs, sender));
}

private void added(object sender, ItemCountEventArgs<T> eventArgs)
{
happened.Add(new CollectionEvent<T>(EventTypeEnum.Added, eventArgs, sender));
happened.Add(new CollectionEvent<T>(EventType.Added, eventArgs, sender));
}

private void removed(object sender, ItemCountEventArgs<T> eventArgs)
{
happened.Add(new CollectionEvent<T>(EventTypeEnum.Removed, eventArgs, sender));
happened.Add(new CollectionEvent<T>(EventType.Removed, eventArgs, sender));
}

private void inserted(object sender, ItemAtEventArgs<T> eventArgs)
{
happened.Add(new CollectionEvent<T>(EventTypeEnum.Inserted, eventArgs, sender));
happened.Add(new CollectionEvent<T>(EventType.Inserted, eventArgs, sender));
}

private void removedAt(object sender, ItemAtEventArgs<T> eventArgs)
{
happened.Add(new CollectionEvent<T>(EventTypeEnum.RemovedAt, eventArgs, sender));
happened.Add(new CollectionEvent<T>(EventType.RemovedAt, eventArgs, sender));
}
}

public sealed class CollectionEvent<T>
{
public EventTypeEnum Act { get; }
public EventType Act { get; }

public EventArgs Args { get; }

public object Sender { get; }

public CollectionEvent(EventTypeEnum act, EventArgs args, object sender)
public CollectionEvent(EventType act, EventArgs args, object sender)
{
Act = act;
Args = args;
Expand All @@ -322,11 +322,11 @@ public bool Equals(CollectionEvent<T> otherEvent, SCG.IEqualityComparer<T> iteme

switch (Act)
{
case EventTypeEnum.None:
case EventType.None:
break;
case EventTypeEnum.Changed:
case EventType.Changed:
return true;
case EventTypeEnum.Cleared:
case EventType.Cleared:
if (Args is ClearedRangeEventArgs)
{
ClearedRangeEventArgs a = Args as ClearedRangeEventArgs;
Expand All @@ -347,22 +347,22 @@ public bool Equals(CollectionEvent<T> otherEvent, SCG.IEqualityComparer<T> iteme
ClearedEventArgs a = Args as ClearedEventArgs, o = otherEvent.Args as ClearedEventArgs;
return a.Full == o.Full && a.Count == o.Count;
}
case EventTypeEnum.Added:
case EventType.Added:
{
ItemCountEventArgs<T> a = Args as ItemCountEventArgs<T>, o = otherEvent.Args as ItemCountEventArgs<T>;
return itemequalityComparer.Equals(a.Item, o.Item) && a.Count == o.Count;
}
case EventTypeEnum.Removed:
case EventType.Removed:
{
ItemCountEventArgs<T> a = Args as ItemCountEventArgs<T>, o = otherEvent.Args as ItemCountEventArgs<T>;
return itemequalityComparer.Equals(a.Item, o.Item) && a.Count == o.Count;
}
case EventTypeEnum.Inserted:
case EventType.Inserted:
{
ItemAtEventArgs<T> a = Args as ItemAtEventArgs<T>, o = otherEvent.Args as ItemAtEventArgs<T>;
return a.Index == o.Index && itemequalityComparer.Equals(a.Item, o.Item);
}
case EventTypeEnum.RemovedAt:
case EventType.RemovedAt:
{
ItemAtEventArgs<T> a = Args as ItemAtEventArgs<T>, o = otherEvent.Args as ItemAtEventArgs<T>;
return a.Index == o.Index && itemequalityComparer.Equals(a.Item, o.Item);
Expand Down
File renamed without changes.
Loading

0 comments on commit 1823d29

Please sign in to comment.