/// <summary> /// Register a new trigger. /// </summary> /// <param name="Name">Unique identifier for the trigger.</param> /// <param name="Pattern">Regex pattern for the trigger.</param> /// <param name="Function">Function that will be called if this trigger fires.</param> /// <param name="Flags">Options for the trigger.</param> /// <param name="Priority">Lower priority triggers get matched first. Default: 1000</param> /// <param name="Arg">Custom argument to pass to trigger data.</param> /// <param name="Plugin">From which plugin was this registered.</param> internal static void RegisterTrigger(string Name, string Pattern, TriggerFunction Function, TriggerFlags Flags, int Priority, int Arg, string Plugin) { if (string.IsNullOrEmpty(Pattern) || string.IsNullOrEmpty(Name) || Function == null) { return; } Name = Name.ToLower().Trim(); if (Name.Length == 0) { return; } Regex p = null; if ((Flags & TriggerFlags.NotRegex) == TriggerFlags.None) { try { RegexOptions op = RegexOptions.None; if ((Flags & TriggerFlags.RightToLeft) != TriggerFlags.None) { op |= RegexOptions.RightToLeft; } if ((Flags & TriggerFlags.CaseInsensitive) != TriggerFlags.None) { op |= RegexOptions.IgnoreCase; } p = new Regex(Pattern, op); } catch { return; } } TriggerEntry e = new TriggerEntry(); e.Function = Function; e.Pattern = p; e.PatternStr = Pattern; e.Priority = Priority; e.Name = Name; e.Flags = Flags; e.Arg = Arg; e.Plugin = Plugin; if (TriggersName.ContainsKey(Name)) { Triggers[TriggersName[Name].Priority].Remove(TriggersName[Name]); } TriggersName[Name] = e; if (!Triggers.ContainsKey(e.Priority)) { Triggers[e.Priority] = new List <TriggerEntry>(); } Triggers[e.Priority].Add(e); }
public Neuron(int inputsNumber, double trainingRate, TriggerFunction triggerFunction) { Weights = new List <double>(inputsNumber); TrainingRate = trainingRate; TriggerFunction = triggerFunction; Init(); }
/// <summary> /// Register a new trigger. /// </summary> /// <param name="Name">Unique identifier for the trigger.</param> /// <param name="Pattern">Regex pattern for the trigger.</param> /// <param name="Function">Function that will be called if this trigger fires.</param> /// <param name="Flags">Options for the trigger.</param> /// <param name="Priority">Lower priority triggers get matched first.</param> /// <param name="Arg">Custom argument that will be passed to trigger data.</param> protected void RegisterTrigger(string Name, string Pattern, TriggerFunction Function, TriggerFlags Flags, int Priority, int Arg) { TriggerHandler.RegisterTrigger(Keyword.ToLower().Trim() + "." + Name, Pattern, Function, Flags, Priority, Arg, Keyword.ToLower().Trim()); }
/// <summary> /// Register a new trigger. /// </summary> /// <param name="Name">Unique identifier for the trigger.</param> /// <param name="Pattern">Regex pattern for the trigger.</param> /// <param name="Function">Function that will be called if this trigger fires.</param> /// <param name="Flags">Options for the trigger.</param> /// <param name="Priority">Lower priority triggers get matched first.</param> protected void RegisterTrigger(string Name, string Pattern, TriggerFunction Function, TriggerFlags Flags, int Priority) { RegisterTrigger(Name, Pattern, Function, Flags, Priority, 0); }
/// <summary> /// Register a new trigger. /// </summary> /// <param name="Name">Unique identifier for the trigger.</param> /// <param name="Pattern">Regex pattern for the trigger.</param> /// <param name="Function">Function that will be called if this trigger fires.</param> /// <param name="Flags">Options for the trigger.</param> protected void RegisterTrigger(string Name, string Pattern, TriggerFunction Function, TriggerFlags Flags) { RegisterTrigger(Name, Pattern, Function, Flags, 1000); }
/// <summary> /// Register a new trigger. /// </summary> /// <param name="Name">Unique identifier for the trigger.</param> /// <param name="Pattern">Regex pattern for the trigger.</param> /// <param name="Function">Function that will be called if this trigger fires.</param> protected void RegisterTrigger(string Name, string Pattern, TriggerFunction Function) { RegisterTrigger(Name, Pattern, Function, TriggerFlags.None); }
public LambdaVerb(TriggerFunction fn, bool abandonsCurrent, Predicate <EditableView> applicableFunction) { m_Function = fn; AbandonsCurrent = abandonsCurrent; m_ApplicableFunction = applicableFunction; }
public static void Write(this BinaryWriter writer, TriggerFunction triggerFunction, MapTriggersFormatVersion formatVersion, MapTriggersSubVersion?subVersion) => triggerFunction.WriteTo(writer, formatVersion, subVersion);
public void BindFunctionToTrigger(string _name, TriggerFunction _function) { Console.WriteLine("bound " + _name); BoundFunctions[_name] = _function; }
/// <summary> /// Register a new trigger. /// </summary> /// <param name="Name">Unique identifier for the trigger.</param> /// <param name="Pattern">Regex pattern for the trigger.</param> /// <param name="Function">Function that will be called if this trigger fires.</param> internal static void RegisterTrigger(string Name, string Pattern, TriggerFunction Function) { RegisterTrigger(Name, Pattern, Function, TriggerFlags.None); }
/// <summary> /// Register a new trigger. /// </summary> /// <param name="Name">Unique identifier for the trigger.</param> /// <param name="Pattern">Regex pattern for the trigger.</param> /// <param name="Function">Function that will be called if this trigger fires.</param> /// <param name="Flags">Options for the trigger.</param> /// <param name="Priority">Lower priority triggers get matched first. Default: 1000</param> internal static void RegisterTrigger(string Name, string Pattern, TriggerFunction Function, TriggerFlags Flags, int Priority) { RegisterTrigger(Name, Pattern, Function, Flags, Priority, 0, "core"); }
/// <summary> /// Register a new trigger. /// </summary> /// <param name="Name">Unique identifier for the trigger.</param> /// <param name="Pattern">Regex pattern for the trigger.</param> /// <param name="Function">Function that will be called if this trigger fires.</param> /// <param name="Flags">Options for the trigger.</param> internal static void RegisterTrigger(string Name, string Pattern, TriggerFunction Function, TriggerFlags Flags) { RegisterTrigger(Name, Pattern, Function, Flags, 1000); }