Several small optimizations; improved XML comments; added a text file for storing general ideas about the design of Nuclex.Support

git-svn-id: file:///srv/devel/repo-conversion/nusu@15 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2007-05-08 18:42:00 +00:00
parent 88390bc38d
commit 7ec11b91b9
6 changed files with 49 additions and 18 deletions

View file

@ -4,6 +4,10 @@ using System.IO;
namespace Nuclex.Support.Collections {
/// <summary>Specialized memory stream for ring buffers</summary>
/// <remarks>
/// This ring buffer class is specialized for binary data and tries to achieve
/// optimal efficiency for storing and retrieving chunks of multiple bytes at once.
/// </remarks>
public class RingMemoryStream : Stream {
/// <summary>Initializes a new ring memory stream</summary>
@ -16,7 +20,8 @@ namespace Nuclex.Support.Collections {
/// <summary>Maximum amount of data that will fit into the ring memory stream</summary>
/// <exception cref="ArgumentOutOfRangeException">
/// If the reduced capacity is too small for the ring buffer's current data
/// Thrown if the new capacity is too small for the data already contained
/// in the ring buffer.
/// </exception>
public long Capacity {
get { return this.ringBuffer.Length; }

View file

@ -253,7 +253,7 @@ namespace Nuclex.Support.Collections {
/// This method is used to transform an item in the wrapped collection into
/// the exposed item type whenever the user accesses an item. Expect it to
/// be called frequently, because the TransformingReadOnlyCollection does
/// not cache otherwise store the transformed items.
/// not cache or otherwise store the transformed items.
/// </remarks>
protected abstract ExposedItemType Transform(ContainedItemType item);

View file

@ -62,8 +62,10 @@ namespace Nuclex.Support.Tracking {
asyncDisconnectEvents(); // We don't need those anymore!
this.progress = 1.0f;
progressUpdateCallback();
if(this.progress != 1.0f) {
this.progress = 1.0f;
progressUpdateCallback();
}
endedCallback();
}

View file

@ -14,12 +14,6 @@ namespace Nuclex.Support.Tracking {
/// <summary>Performs common initialization for the public constructors</summary>
private SetProgression() {
this.childs = new List<ObservedProgression<ProgressionType>>();
this.asyncProgressUpdatedDelegate =
new ObservedProgression<ProgressionType>.ReportDelegate(asyncProgressUpdated);
this.asyncEndedDelegate =
new ObservedProgression<ProgressionType>.ReportDelegate(asyncEnded);
}
/// <summary>Initializes a new set progression</summary>
@ -36,7 +30,8 @@ namespace Nuclex.Support.Tracking {
this.childs.Add(
new ObservedProgression<ProgressionType>(
new WeightedProgression<ProgressionType>(progression),
this.asyncProgressUpdatedDelegate, this.asyncEndedDelegate
new ObservedProgression<ProgressionType>.ReportDelegate(asyncProgressUpdated),
new ObservedProgression<ProgressionType>.ReportDelegate(asyncEnded)
)
);
}
@ -60,7 +55,8 @@ namespace Nuclex.Support.Tracking {
this.childs.Add(
new ObservedProgression<ProgressionType>(
progression,
this.asyncProgressUpdatedDelegate, this.asyncEndedDelegate
new ObservedProgression<ProgressionType>.ReportDelegate(asyncProgressUpdated),
new ObservedProgression<ProgressionType>.ReportDelegate(asyncEnded)
)
);
@ -160,12 +156,6 @@ namespace Nuclex.Support.Tracking {
/// <summary>Summed weight of all progression in the set</summary>
private float totalWeight;
/// <summary>Delegate for the asyncProgressUpdated() method</summary>
private ObservedProgression<ProgressionType>.ReportDelegate asyncProgressUpdatedDelegate;
/// <summary>Delegate for the asyncEnded() method</summary>
private ObservedProgression<ProgressionType>.ReportDelegate asyncEndedDelegate;
}
} // namespace Nuclex.Support.Tracking