private TabItem CreateNewFunctionTabPage(UserOption userOption, FunctionTypes functionType, bool allowEdit) { var newPage = new TabItem(); var panel = new TabControlPanel { TabItem = newPage, Dock = DockStyle.Fill }; newPage.AttachedControl = panel; switch (functionType) { case FunctionTypes.DefaultValue: newPage.Text = userOption.VariableName + " [Default Value]"; break; case FunctionTypes.DisplayToUser: newPage.Text = userOption.VariableName + " [Display To User]"; break; case FunctionTypes.Validation: newPage.Text = userOption.VariableName + " [Valitation]"; break; } newPage.ImageIndex = 0; newPage.Tag = userOption; newPage.CloseButtonVisible = true; var funcPanel = new ucFunction { Dock = DockStyle.Fill, AllowEdit = allowEdit }; newPage.AttachedControl.Controls.Add(funcPanel); funcPanel.FunctionName = userOption.VariableName; funcPanel.CurrentUserOption = userOption; funcPanel.CurrentUserOptionFunctionType = functionType; funcPanel.Populate(); newPage.ImageIndex = 0; return newPage; }
/// <summary> /// Evaluates a function with the given x /// </summary> public static Number Evaluate(this FunctionTypes type, Number x, Function func) { // Store the parameters in this new array (so we can insert x as well) Number[] parameters = new Number[func.parameters.Length]; for (int i = 0; i < parameters.Length; i++) { if (func.parameters[i] is Number) { parameters[i] = (Number)func.parameters[i]; } else if (func.parameters[i] is X) { parameters[i] = x; } } switch (type) { case FunctionTypes.SIN: return(new Number(Math.Sin(parameters[0].number) * Math.Cosh(parameters[0].i), Math.Cos(parameters[0].number) * Math.Sinh(parameters[0].i))); case FunctionTypes.COS: return(new Number(Math.Cos(parameters[0].number) * Math.Cosh(parameters[0].i), -1 * Math.Sin(parameters[0].number) * Math.Sinh(parameters[0].i))); } throw new InputException("This should never ever be reached when evaluation comes!", -1); }
public DefaultValueFunction(Type objectType, string propertyName, bool useCustomCode, FunctionTypes functionType) { ObjectType = objectType; PropertyName = propertyName; UseCustomCode = useCustomCode; FunctionType = functionType; }
private void SetPanelToProperty(UserOption option, FunctionTypes type) { SaveCurrentFunctionInfo(); Utility.SuspendPainting(panelContent); ClearPanel(); if (type == FunctionTypes.Validation) { functionScreen.CurrentFunction = option.GetValidatorFunction(); } else if (type == FunctionTypes.DefaultValue) { functionScreen.CurrentFunction = option.GetDefaultValueFunction(); } else if (type == FunctionTypes.DisplayToUser) { functionScreen.CurrentFunction = option.GetDisplayToUserFunction(); } currentVirtualProperty = option; currentVirtualPropertyFunction = type; functionScreen.Populate(); panelContent.Visible = true; Utility.ResumePainting(panelContent); formUserOptionDetails.Visible = true; formUserOptionDetails.UserOption = option; }
private static RequestBase GetRequest(FunctionTypes Option, string[] args = null) { args = args ?? new string[0]; switch (Option) { case FunctionTypes.Project: default: return(new ProjectVersionRequest(args)); case FunctionTypes.Web: return(new ProjectVersionRequest(args, true)); case FunctionTypes.Nuget: return(new NugetPublishRequest(args)); case FunctionTypes.Zip: return(new ZipRequest(args)); case FunctionTypes.Copy: return(new CopyRequest(args)); case FunctionTypes.SqlRestore: return(new SqlRestoreRequest(args)); case FunctionTypes.SqlQuery: return(new SqlQueryRequest(args)); case FunctionTypes.AbpJson: return(new AbpSyncLanguagesRequest(args)); } }
public static LogicalElement Build(int numElement, FunctionTypes functionType, BrokenTypes brokenType = BrokenTypes.Non) { LogicalElement element = CreateLogicalElement(numElement); element = SetFunction(element, functionType); element = SetBrokenType(element, brokenType); return element; }
public void AddFunction(FunctionTypes type, Action func) { if (!_functions.ContainsKey(type)) { _functions.Add(type, new List <Action>()); } _functions[type].Add(func); }
private void Initialize(FunctionTypes type) { Function = type; LearningRates = new LearningRate[ActivationFunctionCount]; for (uint i = 0; i < LearningRates.Length; i++) { LearningRates[i].learningRate = DefaultLearningRate((FunctionTypes)i); } }
public void AddFunction(FunctionTypes type, Action <string> func, string parameters = "") { if (!_functions.ContainsKey(type)) { _functions.Add(type, new List <Tuple <Action <string>, string> >()); } _functions[type].Add(Tuple.Create(func, parameters)); }
private FunctionDeclaration ReadFuncType(string line, int curLine) { var parser = new LineParser(line, curLine); // Skip the typedef parser.SkipNextToken(); // Read the return type var returnType = parser.ReadUntil('('); if (!parser.IsSymbol('(')) { Console.Error.WriteLine($"Failed to parse function type declaration at line {curLine}:{parser.CurIdx} - Expected (, got {parser.ReadChar()}"); return(null); } var apiEntry = parser.ReadToken(); if (apiEntry != "APIENTRYP") { return(null); } var typedefName = parser.ReadToken(); if (!parser.IsSymbol(')')) { Console.Error.WriteLine($"Failed to parse function type declaration for declaration {typedefName} at line {curLine}:{parser.CurIdx} - Expected ), got {parser.ReadChar()}"); return(null); } if (!parser.IsSymbol('(')) { Console.Error.WriteLine($"Failed to parse function type declaration for declaration {typedefName} at line {curLine}:{parser.CurIdx} - Expected (, got {parser.ReadChar()}"); return(null); } var funcType = new FunctionDeclaration(); funcType.TypedefName = typedefName; funcType.ReturnType = returnType; while (!parser.IsSymbol(')')) { var argString = parser.ReadUntil(',', ')'); var arg = new FunctionArgument(argString); if (arg.Name != null && arg.Type != null && arg.Name.Length > 0 && arg.Type.Length > 0) { funcType.Arguments.Add(arg); } parser.IsSymbol(','); } FunctionTypes.Add(funcType.TypedefName, funcType); return(funcType); }
public bool addFunctionTypes(FunctionItem functionItem) { if (functionItem != null) { FunctionTypes.Add(functionItem); return(true); } return(false); }
private void DisplayValidationFunctionFor(UserOption option) { currentFunctionScreen.CurrentFunction = option.GetValidatorFunction(); currentFunctionScreen.AllowOverride = true; currentFunctionScreen.OverrideFunctionChecked = option.IsValidationFunctionOverridden(); currentFunctionScreen.Visible = true; currentFunctionScreen.Populate(); currentUserOption = option; currentFunctionType = FunctionTypes.Validation; }
private void DisplayDefaultValueFunctionFor(UserOption option) { currentFunctionScreen.CurrentFunction = option.GetDefaultValueFunction(); currentFunctionScreen.AllowOverride = true; currentFunctionScreen.OverrideFunctionChecked = option.IsDefaultValueFunctionOverridden(); currentFunctionScreen.Visible = true; currentFunctionScreen.Populate(); currentUserOption = option; currentFunctionType = FunctionTypes.DefaultValue; }
public bool addFunctionTypes(List <FunctionItem> functionItems) { if (functionItems != null) { FunctionTypes.AddRange(functionItems); return(true); } return(false); }
/// <summary> /// Main constructor for layer /// </summary> /// <param name="prevCount">Count of nodes in preceeding layer</param> /// <param name="count">Count of nodes in current layer</param> /// <param name="type">Activation function type</param> /// <param name="learningRate">Learning rate</param> /// <param name="biasMultip">Range of starting biases - random number between -biasMultip and biasMultip</param> /// <param name="weightsMultip">Range of starting biases - random number between -weihtsMultip and weightsMultip</param> public Layer(int prevCount, int count, FunctionTypes type = FunctionTypes.Sigmoid, double learningRate = 0.00005, double biasMultip = 10, double weightsMultip = 2) { Biases = new double[count]; DBiases = new double[count]; Outputs = new double[count]; Gammas = new double[count]; Weights = new double[count, prevCount]; DWeights = new double[count, prevCount]; LearningRate = learningRate; BiasMultiplier = biasMultip; WeightsMultiplier = weightsMultip; (Function, Derivative) = Functions.GetFunctions(type); InitializeLayer(); }
protected virtual void ExecuteFunctions(FunctionTypes type) { if (!_functions.ContainsKey(type)) { return; } var list = _functions[type]; foreach (var item in list) { item.Item1.Invoke(item.Item2); } }
/// <summary> /// Main constructor for network /// </summary> /// <param name="layers">Number of nodes in consecutive layers. Must be >= 2</param> /// <param name="baseType">Type of activation function in hidden layers</param> /// <param name="outputType">Type of activation function in output layer</param> /// <param name="learningRate">Learning rate</param> /// <param name="biasMultip">Range of starting biases - random number between -biasMultip and biasMultip</param> /// <param name="weightsMultip">Range of starting biases - random number between -weihtsMultip and weightsMultip</param> public Network(int[] layers, FunctionTypes baseType, FunctionTypes outputType, double learningRate, double biasMultip, double weightsMultip) : this(layers) { Layers = new Layer[layers.Length - 1]; if (layers.Length >= 2) { Input = new Input(layers[0]); for (int i = 1; i < layers.Length - 1; i++) { Layers[i - 1] = new Layer(layers[i - 1], layers[i], baseType, learningRate, biasMultip, weightsMultip); } Layers[Layers.Length - 1] = new Layer(layers[layers.Length - 2], layers[layers.Length - 1], outputType, learningRate, biasMultip, weightsMultip); } else { throw new ArgumentException("Not enough layers!"); } }
public static float evaluateDerivative(FunctionTypes funcType, float x, bool xIsOutput = false) { switch (funcType) { case FunctionTypes.Tanh: return(tanh(x, true, xIsOutput)); case FunctionTypes.Sigmoid: return(sigmoid(x, true, xIsOutput)); case FunctionTypes.RELU: return(RELU(x, true, xIsOutput)); case FunctionTypes.Double_Sigmoid: return(DoubleSigmoid(x, true)); default: return(0.0f); } }
public static string ToString(FunctionTypes type) { switch (type) { case FunctionTypes.Tanh: return("Tanh"); case FunctionTypes.Sigmoid: return("Sigmoid"); case FunctionTypes.RELU: return("RELU"); case FunctionTypes.Double_Sigmoid: return("Double Sigmoid"); default: return("INVALID ACTIVATION FUNCTION TYPE"); } }
public static float DefaultLearningRate(FunctionTypes funcType) { switch (funcType) { case FunctionTypes.Tanh: return(0.32f); case FunctionTypes.Sigmoid: return(.75f); case FunctionTypes.Double_Sigmoid: return(0.75f); case FunctionTypes.RELU: return(0.15f); default: return(0.1f); } }
private PreparedFunction( string methodName, string rawMethodName, TypeReference returnType, Parameter[] parameters, PreparedILBody[] preparedILBodies, SymbolInformation[] localVariables, SymbolInformation[] stacks, IReadOnlyDictionary <int, string> labelNames, FunctionTypes functionType, int slotIndex) { this.MethodName = methodName; this.RawMethodName = rawMethodName; this.ReturnType = returnType; this.Parameters = parameters; this.PreparedILBodies = preparedILBodies; this.LocalVariables = localVariables; this.Stacks = stacks; this.labelNames = labelNames; this.FunctionType = functionType; this.SlotIndex = slotIndex; }
/// <summary> /// Gets a comma-separated list of parameters and their data-types for the function signature. /// </summary> /// <param name="userOption"></param> /// <param name="userOptionFunctionType"></param> /// <returns></returns> private string GetParameterListAsString(UserOption userOption, FunctionTypes userOptionFunctionType) { string paramList = ""; if (userOptionFunctionType == FunctionTypes.DefaultValue || userOptionFunctionType == FunctionTypes.DisplayToUser) { if (userOption.IteratorType != null) { paramList += string.Format("{0} {1}", Utility.GetDemangledGenericTypeName(userOption.IteratorType, Project.Instance.Namespaces).Replace("+", "."), userOption.IteratorType.Name.ToLower()); } } else // Validation function { if (userOption.IteratorType != null) { paramList += string.Format("{0} {1}", Utility.GetDemangledGenericTypeName(userOption.IteratorType, Project.Instance.Namespaces).Replace("+", "."), userOption.IteratorType.Name.ToLower()); } paramList += string.Format(", {0} value, out string failReason", Utility.GetDemangledGenericTypeName(userOption.VarType, Project.Instance.Namespaces).Replace("+", ".")); } return paramList; }
public static void FuncListShare(DcBot connection, Share share, string usrId, FunctionTypes funcType) { int lines = 0; bool anyInfo = false; DateTime todaysDate = DateTime.Now.Date; List<string> servicesUsed = new List<string>(); SortedList<SerieInfo, EpisodeInfo> list; Dictionary<string, KeyValuePair<string, int>> listIgnore; ClientInfo clientInfo = null; var user = connection.GetUser(usrId); if (user != null && user.Tag != null) { clientInfo = ClientParser.Parse(user.Tag.Version); } StringBuilder sb = new StringBuilder("Your current serie information:\r\n"); lines++; GetSeriesFromShare(share, out list, out listIgnore); int ignoreCount = listIgnore.Count(); sb.AppendFormat("I have found {0} different series in your share.\r\n", list.Count); lines++; sb.AppendFormat("You want me to ignore {0} of them.", ignoreCount); if (ignoreCount == 0) { sb.Append(" To learn more. Please write +ignore."); } sb.AppendLine(); lines++; #region Get info about series LogMsg("Display Series"); foreach (var seriePair in list) { SerieInfo info = seriePair.Key; if (info != null && !listIgnore.ContainsKey(Ignore.CreateName(info.Name))) { EpisodeInfo epLast = info.LatestEpisode; EpisodeInfo epNext = info.NextEpisode; if (epLast != null) { int currentSeason = epLast.Version / 100; int currentEpisode = epLast.Version % 100; int usrSeasonVersion = seriePair.Value.Version / 100; int usrEpisodeVersion = seriePair.Value.Version % 100; EpisodeInfo usrEpisode = seriePair.Value; bool addedInfo = false; MagnetLink magnetLink = null; switch (funcType) { case FunctionTypes.ListAllEpisodes: case FunctionTypes.ListNewEpisodes: if (currentSeason > usrSeasonVersion) { if (currentSeason == (usrSeasonVersion + 1)) { sb.AppendFormat("\t{0}: A new season have started.", info.Name); addedInfo = true; } else { sb.AppendFormat("\t{0}: You are behind more then one season.", info.Name); addedInfo = true; } } else if (currentSeason == usrSeasonVersion) { if (currentEpisode > usrEpisodeVersion) { int difEpisode = currentEpisode - usrEpisodeVersion; if (difEpisode == 1) { sb.AppendFormat("\t{0}: You are behind {1} episode.", info.Name, difEpisode); addedInfo = true; magnetLink = MagnetLink.CreateMagnetLink(clientInfo, info.Name, currentSeason, usrEpisodeVersion + 1); } else { sb.AppendFormat("\t{0}: You are behind {1} episodes.", info.Name, difEpisode); magnetLink = MagnetLink.CreateMagnetLink(clientInfo, info.Name, currentSeason, usrEpisodeVersion + 1); addedInfo = true; } } else if (funcType == FunctionTypes.ListAllEpisodes) { sb.AppendFormat("\t{0}: You have the latest episode.", info.Name); addedInfo = true; } } if (addedInfo) { anyInfo = true; bool showUserLastEpisodeInfo = magnetLink == null || (clientInfo != null && clientInfo.Type != ClientType.Jucy); if (showUserLastEpisodeInfo) { // If we dont have a magnet. Tell user what version he/she/it has :) sb.AppendFormat("\t\t(Your last episode is: S{0:00}E{1:00})", usrSeasonVersion, usrEpisodeVersion); } // Do we have a magnet link to show? if (magnetLink != null) { sb.AppendFormat("\t\t{0}", magnetLink.Link); } sb.Append("\r\n"); servicesUsed.Add(info.ServiceAddress); lines++; } break; case FunctionTypes.ListDebugInfoOnEpisodes: anyInfo = true; sb.AppendFormat("\t{0}\t\t(Episode: S{1:00}E{2:00})\r\n\t\t{3}\r\n", info.Name, usrSeasonVersion, usrEpisodeVersion, usrEpisode.RawFileName); break; case FunctionTypes.ListCountDownEpisodes: if (epNext != null) { var difference = epNext.Date.Subtract(todaysDate); if (difference.TotalDays >= 0) { sb.AppendFormat("\t{0}\t\tDays left: {1} ({2:yyyy-MM-dd})\r\n", info.Name, difference.TotalDays, epNext.Date); anyInfo = true; } } break; } } } // Make sure we are not exceeding max number of lines in hub. if (Program.MAX_NUMBER_OF_LINES_IN_MESSAGE <= lines) { connection.SendMessage(Actions.PrivateMessage, usrId, sb.ToString()); sb = new StringBuilder(); lines = 0; } } LogMsg("/Display Series"); switch (funcType) { case FunctionTypes.ListNewEpisodes: if (!anyInfo) { sb.AppendLine("You seem to have latest episode of every serie you are sharing!"); } break; } sb.AppendLine(); sb.AppendLine(); sb.Append("This result was given to you by: http://code.google.com/p/seriebot/ "); string[] servicesUsedDistinct = servicesUsed.Distinct().ToArray(); int serviceCount = servicesUsedDistinct.Length; if (serviceCount > 0) { sb.Append("with the help by: "); sb.AppendLine(string.Join(", ", servicesUsedDistinct)); } else { sb.AppendLine(); } //sb.AppendLine("This service is powered by: www.tvrage.com"); // message will here be converted to right format and then be sent. connection.SendMessage(Actions.PrivateMessage, usrId, sb.ToString()); #endregion }
private static LogicalElement SetFunction(LogicalElement element, FunctionTypes functionType) { element.Function = FunctionFactory.GetFunction(functionType); return element; }
public FunctionCollector(FunctionTypes type) { m_functionsToCollect = type; }
public ActivationFunctions(FunctionTypes type) { Initialize(type); }
/// <summary> /// Factory method for generating delegates to be used by layers as activation functions. /// </summary> /// <param name="type">Type of function to be provided</param> /// <returns>Tuble consiting of delegates of activation functuon and its derivative</returns> public static (Func <double[], double[]> func, Func <double[], double[]> derivative) GetFunctions(FunctionTypes type) { switch (type) { case FunctionTypes.TanH: return(x => TanH(x), x => DTanH(x)); case FunctionTypes.Sigmoid: return(x => Sigmoid(x), x => DSigmoid(x)); case FunctionTypes.ReLU: return(x => ReLU(x), x => DReLU(x)); case FunctionTypes.LeakyReLU: return(x => LeakyReLU(x), x => DLeakyReLU(x)); case FunctionTypes.Linear: return(x => Linear(x), x => DLinear(x)); default: return(x => Sigmoid(x), x => DSigmoid(x)); } }
/// <summary> /// Constructor /// </summary> public Function(FunctionTypes type) { this.Type = type; this.Precedence = Precedences.Function; }
public bool CheckFunctionTypesExists(FunctionType type) { return(FunctionTypes.Exists(x => x.FunctionType == type)); }
public static void FuncListShare(DcBot connection, Share share, string usrId, FunctionTypes funcType) { int lines = 0; bool anyInfo = false; DateTime todaysDate = DateTime.Now.Date; List <string> servicesUsed = new List <string>(); SortedList <SerieInfo, EpisodeInfo> list; Dictionary <string, KeyValuePair <string, int> > listIgnore; ClientInfo clientInfo = null; var user = connection.GetUser(usrId); if (user != null && user.Tag != null) { clientInfo = ClientParser.Parse(user.Tag.Version); } StringBuilder sb = new StringBuilder("Your current serie information:\r\n"); lines++; GetSeriesFromShare(share, out list, out listIgnore); int ignoreCount = listIgnore.Count(); sb.AppendFormat("I have found {0} different series in your share.\r\n", list.Count); lines++; sb.AppendFormat("You want me to ignore {0} of them.", ignoreCount); if (ignoreCount == 0) { sb.Append(" To learn more. Please write +ignore."); } sb.AppendLine(); lines++; #region Get info about series LogMsg("Display Series"); foreach (var seriePair in list) { SerieInfo info = seriePair.Key; if (info != null && !listIgnore.ContainsKey(Ignore.CreateName(info.Name))) { EpisodeInfo epLast = info.LatestEpisode; EpisodeInfo epNext = info.NextEpisode; if (epLast != null) { int currentSeason = epLast.Version / 100; int currentEpisode = epLast.Version % 100; int usrSeasonVersion = seriePair.Value.Version / 100; int usrEpisodeVersion = seriePair.Value.Version % 100; EpisodeInfo usrEpisode = seriePair.Value; bool addedInfo = false; MagnetLink magnetLink = null; switch (funcType) { case FunctionTypes.ListAllEpisodes: case FunctionTypes.ListNewEpisodes: if (currentSeason > usrSeasonVersion) { if (currentSeason == (usrSeasonVersion + 1)) { sb.AppendFormat("\t{0}: A new season have started.", info.Name); addedInfo = true; } else { sb.AppendFormat("\t{0}: You are behind more then one season.", info.Name); addedInfo = true; } } else if (currentSeason == usrSeasonVersion) { if (currentEpisode > usrEpisodeVersion) { int difEpisode = currentEpisode - usrEpisodeVersion; if (difEpisode == 1) { sb.AppendFormat("\t{0}: You are behind {1} episode.", info.Name, difEpisode); addedInfo = true; magnetLink = MagnetLink.CreateMagnetLink(clientInfo, info.Name, currentSeason, usrEpisodeVersion + 1); } else { sb.AppendFormat("\t{0}: You are behind {1} episodes.", info.Name, difEpisode); magnetLink = MagnetLink.CreateMagnetLink(clientInfo, info.Name, currentSeason, usrEpisodeVersion + 1); addedInfo = true; } } else if (funcType == FunctionTypes.ListAllEpisodes) { sb.AppendFormat("\t{0}: You have the latest episode.", info.Name); addedInfo = true; } } if (addedInfo) { anyInfo = true; bool showUserLastEpisodeInfo = magnetLink == null || (clientInfo != null && clientInfo.Type != ClientType.Jucy); if (showUserLastEpisodeInfo) { // If we dont have a magnet. Tell user what version he/she/it has :) sb.AppendFormat("\t\t(Your last episode is: S{0:00}E{1:00})", usrSeasonVersion, usrEpisodeVersion); } // Do we have a magnet link to show? if (magnetLink != null) { sb.AppendFormat("\t\t{0}", magnetLink.Link); } sb.Append("\r\n"); servicesUsed.Add(info.ServiceAddress); lines++; } break; case FunctionTypes.ListDebugInfoOnEpisodes: anyInfo = true; sb.AppendFormat("\t{0}\t\t(Episode: S{1:00}E{2:00})\r\n\t\t{3}\r\n", info.Name, usrSeasonVersion, usrEpisodeVersion, usrEpisode.RawFileName); break; case FunctionTypes.ListCountDownEpisodes: if (epNext != null) { var difference = epNext.Date.Subtract(todaysDate); if (difference.TotalDays >= 0) { sb.AppendFormat("\t{0}\t\tDays left: {1} ({2:yyyy-MM-dd})\r\n", info.Name, difference.TotalDays, epNext.Date); anyInfo = true; } } break; } } } // Make sure we are not exceeding max number of lines in hub. if (Program.MAX_NUMBER_OF_LINES_IN_MESSAGE <= lines) { connection.SendMessage(Actions.PrivateMessage, usrId, sb.ToString()); sb = new StringBuilder(); lines = 0; } } LogMsg("/Display Series"); switch (funcType) { case FunctionTypes.ListNewEpisodes: if (!anyInfo) { sb.AppendLine("You seem to have latest episode of every serie you are sharing!"); } break; } sb.AppendLine(); sb.AppendLine(); sb.Append("This result was given to you by: http://code.google.com/p/seriebot/ "); string[] servicesUsedDistinct = servicesUsed.Distinct().ToArray(); int serviceCount = servicesUsedDistinct.Length; if (serviceCount > 0) { sb.Append("with the help by: "); sb.AppendLine(string.Join(", ", servicesUsedDistinct)); } else { sb.AppendLine(); } //sb.AppendLine("This service is powered by: www.tvrage.com"); // message will here be converted to right format and then be sent. connection.SendMessage(Actions.PrivateMessage, usrId, sb.ToString()); #endregion }
public static Func<bool[], bool> GetFunction(FunctionTypes functionType) { switch (functionType) { case FunctionTypes.NOT: Func<bool[], bool> functionNot = delegate(bool[] inputValues) { return !inputValues[0]; }; return functionNot; case FunctionTypes.AND: Func<bool[], bool> functionAnd = delegate(bool[] inputValues) { bool resultValue = inputValues[0]; for (int i = 1; i < inputValues.Length; i++) { resultValue = resultValue & inputValues[i]; } return resultValue; }; return functionAnd; case FunctionTypes.OR: Func<bool[], bool> functionOr = delegate(bool[] inputValues) { bool resultValue = inputValues[0]; for (int i = 1; i < inputValues.Length; i++) { resultValue = resultValue | inputValues[i]; } return resultValue; }; return functionOr; case FunctionTypes.NOR: Func<bool[], bool> functionNOr = delegate(bool[] inputValues) { bool resultValue = inputValues[0]; for (int i = 1; i < inputValues.Length; i++) { resultValue = resultValue | inputValues[i]; } return !resultValue; }; return functionNOr; case FunctionTypes.NXOR: Func<bool[], bool> functionNXOr = delegate(bool[] inputValues) { bool resultValue = inputValues[0]; for (int i = 1; i < inputValues.Length; i++) { resultValue = resultValue ^ inputValues[i]; } return !resultValue; }; return functionNXOr; default: break; } return null; }
public void changeFunctionType(int type) { this.functionType = (FunctionTypes)type; UpdateTaskPaneVisibility(); OnPropertyChanged("FunctionType"); }
public bool ChangeFunction(FunctionTypes funcType) { Function = funcType; return(true); }
private FunctionItem getFuntionItem(FunctionType type) { return(FunctionTypes.Find(x => x.FunctionType == type)); }