Packageorg.wiiflash.utils
Classpublic final class HistoryPeakDetection
Implementsflash.events.IEventDispatcher

The HistoryPeakDetection class is analyzing a set of values to detect peaks inside. A peak is detected if current value is greater than average value of history values multiplied by given historyMultiplier. Also the current value can be interpolated using valueCount greater than one. If this is the case the current value is the average of given values. This average value will be put into the history afterwards.



Public Methods
 MethodDefined by
  
HistoryPeakDetection(valueCount:int = 2, historyCount:int = 32, historyMultiplier:Number = 16)
Creates a new HistoryPeakDetection object.
HistoryPeakDetection
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with a HistoryPeakDetection object so that the listener receives notification of an event.
HistoryPeakDetection
  
addValue(value:Number):Boolean
Adds a value to the HistoryPeakDetection object.
HistoryPeakDetection
  
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
HistoryPeakDetection
  
hasEventListener(type:String):Boolean
Checks whether the HistoryPeakDetection object has any listeners registered for a specific type of event.
HistoryPeakDetection
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the HistoryPeakDetection object.
HistoryPeakDetection
  
toString():String
Returns the string representation of the specified object.
HistoryPeakDetection
  
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this HistoryPeakDetection object or any of its ancestors for the specified event type.
HistoryPeakDetection
Events
 EventSummaryDefined by
   Dispatched when a peak has been detected.HistoryPeakDetection
Constructor detail
HistoryPeakDetection()constructor
public function HistoryPeakDetection(valueCount:int = 2, historyCount:int = 32, historyMultiplier:Number = 16)

Creates a new HistoryPeakDetection object.

Parameters
valueCount:int (default = 2) — Number of values that build current value.
 
historyCount:int (default = 32) — Number of values that are stored in the history.
 
historyMultiplier:Number (default = 16) — Multiplier for average value of history.
Method detail
addEventListener()method
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Registers an event listener object with a HistoryPeakDetection object so that the listener receives notification of an event.

Parameters
type:String — The type of event.
 
listener:Function — The listener function that processes the event.
 
useCapture:Boolean (default = false) — Determines whether the listener works in the capture phase or the target and bubbling phases.
 
priority:int (default = 0) — The priority level of the event listener.
 
useWeakReference:Boolean (default = false) — Determines whether the reference to the listener is strong or weak.

See also

addValue()method 
public function addValue(value:Number):Boolean

Adds a value to the HistoryPeakDetection object. Whenever a value is added the check to detect a peak is done.

Parameters
value:Number — The new value.

Returns
Booleantrue if peak has been detected; false otherwise.
dispatchEvent()method 
public function dispatchEvent(event:Event):Boolean

Dispatches an event into the event flow.

Parameters
event:Event — The Event object dispatched into the event flow.

Returns
Boolean

See also

hasEventListener()method 
public function hasEventListener(type:String):Boolean

Checks whether the HistoryPeakDetection object has any listeners registered for a specific type of event.

Parameters
type:String — The type of event.

Returns
Boolean — A value of true if a listener of the specified type is registered; false otherwise.

See also

removeEventListener()method 
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

Removes a listener from the HistoryPeakDetection object.

Parameters
type:String — The type of event.
 
listener:Function — The listener object to remove.
 
useCapture:Boolean (default = false) — Specifies whether the listener was registered for the capture phase or the target and bubbling phases.

See also

toString()method 
public function toString():String

Returns the string representation of the specified object.

Returns
String — A string representation of the object.
willTrigger()method 
public function willTrigger(type:String):Boolean

Checks whether an event listener is registered with this HistoryPeakDetection object or any of its ancestors for the specified event type.

Parameters
type:String — The type of event.

Returns
Boolean — A value of true if a listener of the specified type will be triggered; false otherwise.

See also

Event detail
peakevent 
Event object type: org.wiiflash.events.PeakEvent

Dispatched when a peak has been detected.