/// <summary> /// Instantiate an new Fuse object from an array of properties. /// Does NOT copy the hits and volume values from activity. /// </summary> /// <param name="p_obj">The array containing the properties.</param> public Fuse(object[] p_obj) { this._Fuse_Trigger_Rule = (FuseBehavior)p_obj[0]; this._Hit_Threshold = (int)p_obj[1]; this._Volume_Threshold = (float)p_obj[2]; this._Time_Frame = (TimeSpan)p_obj[3]; this._Auto_Reset_On_Trigger = (bool)p_obj[4]; }
/// <summary> /// Instantiate with specific values. /// </summary> /// <param name="p_Fuse_Trigger_Rule">The FuseBehavior value</param> /// <param name="p_Hit_Threshold">Hit threshold: the number of hits within the time frame</param> /// <param name="p_Volume_Threshold">Volume threshold: the sum of the volume received in the timeframe</param> /// <param name="p_Time_Frame">A TimeSpan from the present time to the past representing the time frame.</param> /// <param name="p_Auto_Reset_On_Trigger">Whether the fuse should zero the hits and volume when the fuse triggers.</param> public Fuse(FuseBehavior p_Fuse_Trigger_Rule, int p_Hit_Threshold, float p_Volume_Threshold, TimeSpan p_Time_Frame, bool p_Auto_Reset_On_Trigger) { this._Fuse_Trigger_Rule = p_Fuse_Trigger_Rule; this._Hit_Threshold = p_Hit_Threshold; this._Volume_Threshold = p_Volume_Threshold; this._Time_Frame = p_Time_Frame; this._Auto_Reset_On_Trigger = p_Auto_Reset_On_Trigger; }
/// <summary> /// Load the event from an existing one. Allows an existing Fuse class to be recycled. /// </summary> /// <param name="p_obj">The existing Fuse object for the source.</param> /// <param name="Copy_State">when true, the existing hits and volume of the fuse's state are copied.</param> public void Load(Fuse p_obj, bool Copy_State) { this._Fuse_Trigger_Rule = p_obj.Fuse_Trigger_Rule; this._Hit_Threshold = p_obj.Hit_Threshold; this._Volume_Threshold = p_obj.Volume_Threshold; this._Time_Frame = p_obj.Time_Frame; this._Auto_Reset_On_Trigger = p_obj.Auto_Reset_On_Trigger; if (Copy_State) { this._Hits = p_obj.Hits; this._Volume = p_obj.Volume; this.Triggers = p_obj.Triggers; } }
/// <summary> /// Instantiate an new Fuse object from an array of properties. /// Can copy the hits and volume values from activity. /// </summary> /// <param name="p_obj">The array containing the properties.</param> /// <param name="Copy_State">when true, the existing hits and volume of the fuse's state are copied.</param> public Fuse(object[] p_obj, bool Copy_State) { this._Fuse_Trigger_Rule = (FuseBehavior)p_obj[0]; this._Hit_Threshold = (int)p_obj[1]; this._Volume_Threshold = (float)p_obj[2]; this._Time_Frame = (TimeSpan)p_obj[3]; this._Auto_Reset_On_Trigger = (bool)p_obj[4]; if (Copy_State) { this._Hits = (int)p_obj[5]; this._Volume = (float)p_obj[6]; this._Triggers = (Queue <FuseEvent>)p_obj[7]; } }