Click or drag to resize

SimpleDataQueue Class

Represents a dynamic circled queue, specialized to work with double. Additionally it optionally can calculate simple statistical values It has four method of work: SingleElement: Queue store only one single element. (Useful as default method for indicators history storing) ManualControl: Support all typical operations specific to Dequeue. (Useful for some custom work). AutoStatic: Store all elements in sliding window specified by number elements to store. Automatically drop element when it out of the window. AutoDynamic: Store all elements in sliding window specified by time period. Automatically drop element when it out of the window. Also it support direct access to element. Using two indexers: by index (int) and by time (DateTime). All method has two versions, with and without DateTime parameter. Please do not use both for the same class instance. Using method with DateTime is mandatory if you want to use DateTime indexer or time period sliding window (AutoDynamic type.) You can specify number of listener (IDataQueueListener), to do some additional work when queue store or drop element.
Inheritance Hierarchy
SystemObject
  FinAnalysis.BaseSimpleDataQueue

Namespace:  FinAnalysis.Base
Assembly:  FinAnalysis (in FinAnalysis.dll) Version: 2.1.13-cc97e13414b71fde928e8f3a546ac1daf26f295f
Syntax
C#
public class SimpleDataQueue : IDataQueue<double>, 
	IEnumerable<double>, IEnumerable, IDataStorageClient

The SimpleDataQueue type exposes the following members.

Constructors
  NameDescription
Public methodSimpleDataQueue
Initializes a new instance of the FinAnalysis.Base.SimpleDataQueue class that contains circle queue of Data and DateTime (optional). Default method of use is ManualControl. Queue capacity will be dynamic. You can manage it manually Put\Remove Last or First elements as in Dequeue.
Public methodSimpleDataQueue(Boolean)
Initializes a new instance of the FinAnalysis.Base.SimpleDataQueue class that contains circle queue of Data and DateTime. Default method of use is ManualControl. Queue capacity will be dynamic. You can manage it manually Put\Remove Last or First elements as in Dequeue.
Public methodSimpleDataQueue(Int32)
Initializes a new instance of the FinAnalysis.Base.SimpleDataQueue class that contains circle queue of Data and DateTime (optional). In this case method of use will be AutoStatic, or SingleElement if you specify capacity equal to one. Queue capacity will be fixed and it will be enough for exact "capacity" elements.
Public methodSimpleDataQueue(TimeSpan)
Initializes a new instance of the FinAnalysis.Base.SimpleDataQueue class that contains circle queue of Data and DateTime (optional). In this case method of use will be AutoDynamic, Queue capacity will be dynamic and it will be enough for contain all elements on specified time period. Using Put method with DateTime is mandatory in this case. Note: You can give queue a hint, what initial arrays size it should use, by setting Capacity field.
Public methodSimpleDataQueue(Int32, Boolean)
Initializes a new instance of the FinAnalysis.Base.SimpleDataQueue class that contains circle queue of Data and DateTime (optional). In this case method of use will be AutoStatic, or SingleElement if you specify capacity equal to one. Queue capacity will be fixed and it will be enough for exact "capacity" elements.
Public methodSimpleDataQueue(TimeSpan, Boolean)
Initializes a new instance of the FinAnalysis.Base.SimpleDataQueue class that contains circle queue of Data and DateTime. In this case method of use will be AutoDynamic, Queue capacity will be dynamic and it will be enough for contain all elements on specified time period. Using Put method with DateTime is mandatory in this case. Note: You can give queue a hint, what initial arrays size it should use, by setting Capacity field.
Public methodSimpleDataQueue(Int32, Boolean, Boolean)
Initializes a new instance of the FinAnalysis.Base.SimpleDataQueue class that contains circle queue of Data and DateTime (optional). In this case method of use will be AutoStatic, or SingleElement if you specify capacity equal to one. Queue capacity will be fixed and it will be enough for exact "capacity" elements.
Public methodSimpleDataQueue(TimeSpan, Boolean, Boolean)
Initializes a new instance of the FinAnalysis.Base.SimpleDataQueue class that contains circle queue of Data and DateTime. In this case method of use will be AutoDynamic, Queue capacity will be dynamic and it will be enough for contain all elements on specified time period. Using Put method with DateTime is mandatory in this case. Note: You can give queue a hint, what initial arrays size it should use, by setting Capacity field.
Top
Properties
  NameDescription
Public propertyArithmeticMean
Get Arithmetic Mean. http://en.wikipedia.org/wiki/Average#Arithmetic_mean
Public propertyCapacity
Set or Get queue capacity (number of elements it can store) or size of sliding window if it is AutoStatic queue. Note: if for non time period auto queue, you specify capacity equal to one then queue switch to SingleElement mode. Note: if for non time period auto queue, you specify capacity not equal to one then queue switch to AutoStatic mode.
Public propertyCoefficientOfVariation
Get Coefficient Of Variation of stored set of values. http://en.wikipedia.org/wiki/Coefficient_of_variation
Public propertyCount
Get the number of elements stored in container.
Public propertyExpectedValue
Get estimation of distribution's Expected Value. http://en.wikipedia.org/wiki/Expected_value
Public propertyFirst
Get first(oldest) data element stored in container. Note: if there is not elements in queue it returns DefaultValue.
Public propertyFirstDateTime
Get first(oldest) data element DateTime stored in container. Note: if there is not elements in queue it returns DefaltDateTime.
Public propertyFirstRawMoment
Get estimation of distribution's First Raw Moment. http://en.wikipedia.org/wiki/Moment_(mathematics)
Public propertyHighPrecision
Calculate separate statistics on non-overlapped windows and update it on the window boundary for calculation error minimization at the cost of small performance decrease.
Public propertyInitialized
This flag is set if and only if queue has already initialized (you already add something to it). Note: you don't have to change Period or Capacity if queue already initialized.
Public propertyItemDateTime
Return historically latest element with smaller or equal DateTime. Note: do not try to use this method if you didn't specify DateTime to data elements.
Public propertyItemInt32
Get data which was store "index" steps ago.
Public propertyLast
Get last data element stored in container. Note: if there is not elements in queue it returns DefaultValue.
Public propertyLastDateTime
Get last data element DateTime stored in container. Note: if there is not elements in queue it returns DefaltDateTime.
Public propertyManualUpdateFactor
Update factor on statistics calculation in high precision mode in queue ManualControl mode operation. Every PutLast, PutFirst, RemoveLast, RemoveFirst operation is counted (as manualCount variable in next equation). When manualCount become greater then queue.Count * ManualUpdateFactor the statistics data are recalculated by the raw data. For example suppose ManualUpdateFactor if equal 3. First of all you have put 100 elements in queue. Than you have removed 50 elements from the queue. So the manualCount = 100 + 50, and queue.Count = 50. So on the next remove operation the manualCount becomes greater than queue.Count * ManualUpdateFactor and statistics will be recalculated.
Public propertyNeedDateTime
This flag is set if and only if queue need DateTime to be specified for data elements, which you intend to add.
Public propertyPeriod
Set or Get time period, how long container will save elements (For AutoDynamic queue). Note: As soon as you specify Time Period queue switch to Auto Dynamic mode.
Public propertyPrevious
Get previous data element stored in container. Note: if there is such not elements in queue it returns DefaltValue.
Public propertyQuadraticMean
Get Quadratic Mean. http://en.wikipedia.org/wiki/Quadratic_mean
Public propertyReady
Ready flag is set if and only if queue contain something.
Public propertySecondCentralMoment
Get estimation of distribution's Second Central Moment. http://en.wikipedia.org/wiki/Central_moment
Public propertySecondRawMoment
Get estimation of distribution's Second Raw Moment. http://en.wikipedia.org/wiki/Moment_(mathematics)
Public propertyStandardDeviation
Get distribution's Standard Deviation, same as StandardDeviationPopulation. http://en.wikipedia.org/wiki/Standard_Deviation
Public propertyStandardDeviationPopulation
Get distribution's Standard Deviation. http://en.wikipedia.org/wiki/Standard_Deviation
Public propertyStandardDeviationSample
Get estimation of distribution's Standard Deviation. http://en.wikipedia.org/wiki/Standard_Deviation
Public propertySum
Get sum of values stored in the set.
Public propertySumOfAbsoluteValues
Get sum of absolute values stored in the set.
Public propertySumOfSquares
Returns sum of squares.
Public propertyType
Return type of queue: SingleElement: Queue store only one single element. (Useful as default method for indicators history storing) ManualControl: Support all typical operations specific to Dequeue. (Useful for some custom work). AutoStatic: Store all elements in sliding window specified by number elements to store. Automatically drop element when it out of the window. AutoDynamic: Store all elements in sliding window specified by time period. Automatically drop element when it out of the window.
Public propertyVariance
Get distribution's Variance, same as VariancePopulation. http://en.wikipedia.org/wiki/Variance
Public propertyVariancePopulation
Get distribution's Variance. http://en.wikipedia.org/wiki/Variance
Public propertyVarianceSample
Get estimation distribution's Variance. http://en.wikipedia.org/wiki/Variance
Top
Methods
  NameDescription
Public methodClone
Makes full copy of this instance.
Public methodCopyTo
Sets internal state to destination object.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetEnumerator
Returns an enumerator that iterates through a collection.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetIndexByTime
Get offset index of element by element time. If there no element with such time, we return latest element with time smaller than specified. If we can't find valid index, we return -1.
Public methodGetTimeByIndex
Return time associated with specified point.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodPut(Double)
Store new data element in queue. This method for static automatic managed or single queue. Do not call it for manually managed queue or dynamic automatic queue (ManualControl, AutoDynamic types). Note: Please do not use both with and without DateTime method for one queue instance.
Public methodPut(Double, DateTime)
Stores new data element in queue. This method for automatic managed or single element queue. Do not call it for manually managed queue or dynamic automatic queue (ManualControl type). Note: Please do not use both with and without DateTime method for one queue instance.
Public methodPutFirst(Double)
Store new data element on first position in queue. This method for manual queue. Do not call it for automatic managed queue or single element queue (SingleElement, AutoDynamic, AutoStatic type). Note: Please do not use both with and without DateTime method for one queue instance.
Public methodPutFirst(Double, DateTime)
Store new data element on first position in queue. This method for manual queue. Do not call it for automatic managed queue or single element queue (SingleElement, AutoDynamic, AutoStatic type). Note: Please do not use both with and without DateTime method for one queue instance.
Public methodPutLast(Double)
Store new data element on last position in queue. This method for manual queue. Do not call it for automatic managed queue or single element queue (SingleElement, AutoDynamic, AutoStatic type). Note: Please do not use both with and without DateTime method for one queue instance.
Public methodPutLast(Double, DateTime)
Store new data element on last position in queue. This method for manual queue. Do not call it for automatic managed queue or single element queue (SingleElement, AutoDynamic, AutoStatic type). Note: Please do not use both with and without DateTime method for one queue instance.
Public methodRemoveFirst
Remove data element from first position in queue. This method for manual queue. Do not call it for automatic managed queue or single element queue (SingleElement, AutoDynamic, AutoStatic type). Note: Please do not use both with and without DateTime method for one queue instance.
Public methodRemoveLast
Remove data element from last position in queue. This method for manual queue. Do not call it for automatic managed queue or single element queue (SingleElement, AutoDynamic, AutoStatic type). Note: Please do not use both with and without DateTime method for one queue instance.
Public methodRemoveOnPopDelegate
Remove delegate that will be invoked every time a new element is dequeued.
Public methodRemoveOnPushDelegate
Remove delegate that will be invoked every time a new element is enqueued.
Public methodSetOnPopDelegate
Set delegate that will be invoked every time a new element is dequeued.
Public methodSetOnPushDelegate
Set delegate that will be invoked every time a new element is enqueued.
Public methodSetQueueListener
Set listener to queue capacity. Queue will call OnPop method every time, when queue drop some element. And OnPush method, when queue store element. Do not use listener with single element queue. Queue support any number of listeners.
Public methodToArray
Copies the elements of the SimpleDataQueue to a new array.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Fields
  NameDescription
Public fieldStatic memberDefaultDateTime
Default DateTime, which will be assumed as default date value.
Public fieldStatic memberDefaultValue
Default value, which will be returned for invalid request or request for empty queue.
Top
See Also