Esempio n. 1
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.Append("\nInput values:");
            if (Inputs.Any())
            {
                foreach (var el in Inputs)
                {
                    sb.Append(el + " ");
                }
            }

            if (!ExpectedValues.Any())
            {
                return(sb.ToString());
            }
            sb.Append("\nExpected values:");
            foreach (var expectedValue in ExpectedValues)
            {
                sb.Append(expectedValue + " ");
            }

            return(sb.ToString());
        }
Esempio n. 2
0
        private void CheckForInputs(ApiInputType inputType, string s)
        {
            var inputString    = InputGrammar.Parse(s);
            var inputVariables = inputString.Tokens.OfType <VariableInputToken>().ToArray();
            var existingInputs = Inputs.Where(x => x.InputType == inputType).ToArray();
            var obsoleteInputs = existingInputs.Where(x => !inputVariables.Any(y => x.Name == y.Variable)).ToArray();

            foreach (var input in obsoleteInputs)
            {
                Inputs.Remove(input);
            }

            foreach (var variable in inputVariables)
            {
                if (!Inputs.Any(x => x.Name == variable.Variable))
                {
                    var insertionPoint = Inputs.BinarySearch(x => x.Name, variable.Variable);
                    if (insertionPoint < 0)
                    {
                        insertionPoint = ~insertionPoint;
                        Inputs.Insert(insertionPoint, new ApiInputModel {
                            Name = variable.Variable, InputType = inputType
                        });
                    }
                }
            }
        }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (InsertPreTag != null)
     {
         writer.WritePropertyName("insertPreTag");
         writer.WriteStringValue(InsertPreTag);
     }
     if (InsertPostTag != null)
     {
         writer.WritePropertyName("insertPostTag");
         writer.WriteStringValue(InsertPostTag);
     }
     writer.WritePropertyName("@odata.type");
     writer.WriteStringValue(ODataType);
     if (Name != null)
     {
         writer.WritePropertyName("name");
         writer.WriteStringValue(Name);
     }
     if (Description != null)
     {
         writer.WritePropertyName("description");
         writer.WriteStringValue(Description);
     }
     if (Context != null)
     {
         writer.WritePropertyName("context");
         writer.WriteStringValue(Context);
     }
     if (Inputs.Any())
     {
         writer.WritePropertyName("inputs");
         writer.WriteStartArray();
         foreach (var item in Inputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     else
     {
         writer.WriteNull("inputs");
     }
     if (Outputs.Any())
     {
         writer.WritePropertyName("outputs");
         writer.WriteStartArray();
         foreach (var item in Outputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     else
     {
         writer.WriteNull("outputs");
     }
     writer.WriteEndObject();
 }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("name");
     writer.WriteStringValue(Name);
     if (Source != null)
     {
         writer.WritePropertyName("source");
         writer.WriteStringValue(Source);
     }
     if (SourceContext != null)
     {
         writer.WritePropertyName("sourceContext");
         writer.WriteStringValue(SourceContext);
     }
     if (Inputs != null && Inputs.Any())
     {
         writer.WritePropertyName("inputs");
         writer.WriteStartArray();
         foreach (var item in Inputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     writer.WriteEndObject();
 }
Esempio n. 5
0
        void ExecuteService(IWarewolfListIterator itrCollection,
                            IEnumerable <IWarewolfIterator> itrs, out ErrorResultTO errors, int update, IOutputFormatter formater = null)
        {
            errors = new ErrorResultTO();
            if (Inputs.Any())
            {
                // Loop iterators
                var pos = 0;
                foreach (var itr in itrs)
                {
                    var injectVal = itrCollection.FetchNextValue(itr);
                    var param     = Inputs.ToList()[pos];
                    param.Value = param.EmptyIsNull &&
                                  (injectVal == null ||
                                   string.Compare(injectVal, string.Empty,
                                                  StringComparison.InvariantCultureIgnoreCase) == 0)
                        ? null
                        : injectVal;

                    pos++;
                }
            }

            try
            {
                ExecuteService(out var invokeErrors, update, formater);
                errors.MergeErrors(invokeErrors);
            }
            catch (Exception ex)
            {
                errors.AddError(string.Format(ErrorResource.ServiceExecutionError, ex.StackTrace));
            }
        }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (DefaultLanguageCode != null)
     {
         writer.WritePropertyName("defaultLanguageCode");
         writer.WriteStringValue(DefaultLanguageCode.Value.ToString());
     }
     if (ShouldDetectOrientation != null)
     {
         writer.WritePropertyName("detectOrientation");
         writer.WriteBooleanValue(ShouldDetectOrientation.Value);
     }
     writer.WritePropertyName("@odata.type");
     writer.WriteStringValue(ODataType);
     if (Name != null)
     {
         writer.WritePropertyName("name");
         writer.WriteStringValue(Name);
     }
     if (Description != null)
     {
         writer.WritePropertyName("description");
         writer.WriteStringValue(Description);
     }
     if (Context != null)
     {
         writer.WritePropertyName("context");
         writer.WriteStringValue(Context);
     }
     if (Inputs.Any())
     {
         writer.WritePropertyName("inputs");
         writer.WriteStartArray();
         foreach (var item in Inputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     else
     {
         writer.WriteNull("inputs");
     }
     if (Outputs.Any())
     {
         writer.WritePropertyName("outputs");
         writer.WriteStartArray();
         foreach (var item in Outputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     else
     {
         writer.WriteNull("outputs");
     }
     writer.WriteEndObject();
 }
Esempio n. 7
0
        public void Audit()
        {
            Console.WriteLine(this.ToString());

            Console.WriteLine($"   {Inputs.Count.ToString()}/11 inputs loaded");
            Console.WriteLine($"   {(Inputs.Any(x => x.NickName == "INPUT_POINTS") ? "Anchor point input located" : "Anchor point input NOT located")}");
            Console.WriteLine($"   Output {(Output == null ? "unidentified" : "identified")}");
        }
Esempio n. 8
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (DefaultLanguageCode != null)
     {
         writer.WritePropertyName("defaultLanguageCode");
         writer.WriteStringValue(DefaultLanguageCode.Value.ToString());
     }
     if (TextSplitMode != null)
     {
         writer.WritePropertyName("textSplitMode");
         writer.WriteStringValue(TextSplitMode.Value.ToString());
     }
     if (MaximumPageLength != null)
     {
         writer.WritePropertyName("maximumPageLength");
         writer.WriteNumberValue(MaximumPageLength.Value);
     }
     writer.WritePropertyName("@odata.type");
     writer.WriteStringValue(ODataType);
     if (Name != null)
     {
         writer.WritePropertyName("name");
         writer.WriteStringValue(Name);
     }
     if (Description != null)
     {
         writer.WritePropertyName("description");
         writer.WriteStringValue(Description);
     }
     if (Context != null)
     {
         writer.WritePropertyName("context");
         writer.WriteStringValue(Context);
     }
     if (Inputs != null && Inputs.Any())
     {
         writer.WritePropertyName("inputs");
         writer.WriteStartArray();
         foreach (var item in Inputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (Outputs != null && Outputs.Any())
     {
         writer.WritePropertyName("outputs");
         writer.WriteStartArray();
         foreach (var item in Outputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     writer.WriteEndObject();
 }
Esempio n. 9
0
 private void UnsetInterruptQueue()
 {
     if (Inputs.Any(input => input is InterruptingInput))
     {
         Inputs.Where(input => input is InterruptingInput)
         .ToList()
         .ForEach(input => ((InterruptingInput)input).UnsetInterruptQueue());
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Assigns the interrupt queue to be posted to when an interrupting input is set.
 /// </summary>
 /// <param name="interruptQueue"></param>
 public void SetInterruptQueue(ActionBlock <InterruptInfo> interruptQueue)
 {
     if (Inputs.Any(input => input is InterruptingInput))
     {
         Inputs.Where(input => input is InterruptingInput)
         .ToList()
         .ForEach(input => ((InterruptingInput)input).SetInterruptQueue(interruptQueue));
     }
 }
Esempio n. 11
0
 /// <summary>
 /// Validates only 'this' class but not children. Explicity specify interface so that this method
 /// can only be called an instance typed to the interface and not an implementation type.
 /// </summary>
 void ITelemetryManifestMatch.ValidateItself()
 {
     if (!Inputs.Any())
     {
         throw new TelemetryManifestValidationException("'inputs' must have at least one input");
     }
     if (Rate < 0.0 || Rate > 1.0)
     {
         throw new TelemetryManifestValidationException("'rate' must be a number between 0 and 1");
     }
 }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("defaultToLanguageCode");
     writer.WriteStringValue(DefaultToLanguageCode.ToString());
     if (DefaultFromLanguageCode != null)
     {
         writer.WritePropertyName("defaultFromLanguageCode");
         writer.WriteStringValue(DefaultFromLanguageCode.Value.ToString());
     }
     if (SuggestedFrom != null)
     {
         writer.WritePropertyName("suggestedFrom");
         writer.WriteStringValue(SuggestedFrom.Value.ToString());
     }
     writer.WritePropertyName("@odata.type");
     writer.WriteStringValue(ODataType);
     if (Name != null)
     {
         writer.WritePropertyName("name");
         writer.WriteStringValue(Name);
     }
     if (Description != null)
     {
         writer.WritePropertyName("description");
         writer.WriteStringValue(Description);
     }
     if (Context != null)
     {
         writer.WritePropertyName("context");
         writer.WriteStringValue(Context);
     }
     if (Inputs != null && Inputs.Any())
     {
         writer.WritePropertyName("inputs");
         writer.WriteStartArray();
         foreach (var item in Inputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (Outputs != null && Outputs.Any())
     {
         writer.WritePropertyName("outputs");
         writer.WriteStartArray();
         foreach (var item in Outputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     writer.WriteEndObject();
 }
Esempio n. 13
0
 public void AdjustWeights(double learnRate, double momentum)
 {
     if (Inputs.Any())
     {
         foreach (var synp in Inputs)
         {
             var adjustDelta = Delta * synp.Source.Output;
             synp.Weight  -= learnRate * adjustDelta + synp.PreDelta * momentum;
             synp.PreDelta = adjustDelta;
         }
     }
 }
Esempio n. 14
0
 protected override Expression compileBody(
     Dictionary <INode, string> symbols,
     Dictionary <INode, List <INode> > letEntries,
     HashSet <string> initializedIds,
     HashSet <string> conditionalIds)
 {
     if (!Inputs.Any())
     {
         return(GetBody(symbols, letEntries, initializedIds, conditionalIds));
     }
     return(base.compileBody(symbols, letEntries, initializedIds, conditionalIds));
 }
Esempio n. 15
0
 public void AddInput(string name, DataType type = DataType.Text, bool isOptional = false)
 {
     if (name == null)
     {
         name = !Inputs.Any() ? DefaultInputName : $"{DefaultInputName} {(Inputs.Count + 1)}";
         if (Inputs.Count == 1 && Inputs[0].Name == DefaultInputName)
         {
             Inputs[0].Name = $"{DefaultInputName} 1";
         }
     }
     AddInput(new Input(name, type, isOptional));
 }
Esempio n. 16
0
        public InputPlug CreateInputPlug(string plugname)
        {
            if (Inputs.Any(p => p.Name == plugname))
            {
                throw new ArgumentException("Input plug already exists!");
            }

            Endpoint.Log(String.Format("Creating input {0} for {1}", plugname, _name));
            InputPlug input = new InputPlug(plugname, this);

            _inputs.Add(input);
            Endpoint.UpdateGraph(this, GraphUpdate.UpdateType.UPDATED);
            return(input);
        }
Esempio n. 17
0
        public void AddInput(string name, DataType type = DataType.Text, bool isOptional = false)
        {
            if (name == null)
            {
                name = !Inputs.Any() ? "In" : "In " + (Inputs.Count + 1);
                if (Inputs.Count == 1 && Inputs[0].Name == "In")
                {
                    Inputs[0].Name = "In 1";
                }
            }



            AddInput(new Input(name, type, isOptional));
        }
Esempio n. 18
0
        public string CreateNewTag(string baseName)
        {
            int    i      = 0;
            string newTag = "ERROR";

            do
            {
                i++;
                newTag = baseName + "_" + i;
                if (i > 1024)
                {
                    return("ERROR");
                }
            } while (Inputs.Any(e => e.Tag == newTag));
            return(newTag);
        }
        public ActionGraphEditorNode(ActionGraph graph, ActionGraphNodeBase node, ActionGraphPresenter presenter)
        {
            Graph      = graph;
            ActionNode = node;
            Presenter  = presenter;

            Size     = new Vector2(164, 64);
            Position = ActionNode.EditorPosition;

            if (!Inputs.Any())
            {
                Inputs.Add(new Slot(this, SlotType.Input));
            }

            ActionNode.ValidationSubscribe(OnTargetChanged);
        }
 public bool defineInputValue(int input, int value)
 {
     if (input > ProcessesAmount)
     {
         return(false);
     }
     else
     {
         if (Inputs.Any(i => i.Number == input))
         {
             Inputs.First(i => i.Number == input).Value = value;
         }
         else
         {
             Inputs.Add(new Input(input, value));
         }
         return(true);
     }
 }
Esempio n. 21
0
        public InputPlug CreateInputPlug(InputPlug plug)
        {
            if (!Inputs.Any(p => p.Name == plug.Name))
            {
                plug.Owner = this;
                Inputs.Add(plug);
            }
            else
            {
                InputPlug existing = Inputs.Find(p => p.Name == plug.Name);
                if (existing.Owner == null)
                {
                    existing.Owner = this;
                }
                return(existing);
            }

            return(plug);
        }
Esempio n. 22
0
        public AddonDeviceElement CreateNewInput(string baseName)
        {
            int    i      = 0;
            string newTag = "ERROR";

            do
            {
                i++;
                newTag = baseName + "_" + i;
                if (i > 1024)
                {
                    return(null);
                }
            } while (Inputs.Any(e => e.Tag == newTag));
            return(new AddonDeviceElement()
            {
                Tag = newTag
            });
        }
        private void RecalculateConditionText()
        {
            if (!_isRecalculationConditionText & Criteria.RootCondition != null && Inputs.Any())
            {
                _isRecalculationConditionText = true;

                if (Criteria.RootCondition.AreChildrenValid)
                {
                    var model = GetModel();
                    ConditionText = _markdownConditionGenerator.Generate(model, Inputs.Select(i => i.GetModel()).ToArray()).ToString();
                }
                else
                {
                    ConditionText = string.Empty;
                }
            }

            _isRecalculationConditionText = false;
        }
Esempio n. 24
0
        public void AddInputNode(PanelInputNode node)
        {
            if (Inputs.Any(x => x.Id == node.Id))
            {
                return;
            }

            var input = new Input
            {
                Id   = node.Id,
                Name = GenerateNewInputName()
            };

            node.Settings["Name"].Value = input.Name;
            AddInput(input);

            UpdateMeInEditor();
            UpdateMeInDb();
        }
Esempio n. 25
0
        /// <summary>
        /// Builds the Xml.
        /// </summary>
        private void _performBuild()
        {
            Xml = new XDocument(new XDeclaration("1.0", "UTF-8", "yes"));
            ICollection <XNode> children = new List <XNode>();

            if (Algorithms.Any())
            {
                XNode algorithms = _buildAlgorithms();
                children.Add(algorithms);
            }

            if (Inputs.Any())
            {
                XNode inputs = _buildInputs();
                children.Add(inputs);
            }

            XElement root = new XElement(_process.RootNodeName, children);

            Xml.Add(root);
        }
Esempio n. 26
0
        public override bool Update(Keys key, Func <char?> getKey, bool click, int mouseX, int mouseY)
        {
            if (!Visible)
            {
                return(false);
            }
            char?c;

            if (key == Keys.Tab)
            {
                if (CurrentlySelected == null && Inputs.Any())
                {
                    SelectFirstItem();
                }
                else
                {
                    CurrentlySelected?.Tab();
                }
            }
            else if (key == Keys.Escape)
            {
                Clear();
            }
            else if (key == Keys.Enter)
            {
                CurrentlySelected?.Enter();
            }
            else if (key == Keys.Multiply)
            {
                Operator('*');
                CurrentlySelected = EqualsBtn;
                SetSelected();
            }
            else if (key == Keys.Divide)
            {
                Operator('/');
                CurrentlySelected = EqualsBtn;
                SetSelected();
            }
            else if (key == Keys.Add)
            {
                Operator('+');
                CurrentlySelected = EqualsBtn;
                SetSelected();
            }
            else if (key == Keys.Subtract)
            {
                Operator('-');
                CurrentlySelected = EqualsBtn;
                SetSelected();
            }
            else if (key == Keys.Left)
            {
                CurrentlySelected?.CursorMoveLeft();
            }
            else if (key == Keys.Right)
            {
                CurrentlySelected?.CursorMoveRight();
            }
            else if (key == Keys.Up)
            {
                CurrentlySelected?.CursorMoveUp();
            }
            else if (key == Keys.Down)
            {
                CurrentlySelected?.CursorMoveDown();
            }
            else if (key == Keys.Back)
            {
                CurrentlySelected?.BackSpace();
            }
            else if (key == Keys.Home)
            {
                CurrentlySelected?.CursorToStart();
            }
            else if (key == Keys.End)
            {
                CurrentlySelected?.CursorToEnd();
            }
            else if ((c = getKey?.Invoke()) != null)
            {
                AddLetter((char)c);  // Letter(input.KeyChar);
            }
            else if (click)
            {
                var handled = false;
                foreach (var i in Inputs)
                {
                    var rect = new Rectangle(i.PositionX, i.PositionY, i.Width, i.Height);
                    if (rect.Contains(new Point(mouseX, mouseY)))
                    {
                        var mx = mouseX - i.PositionX;
                        var my = mouseY - i.PositionY;
                        if (i.Selectable)
                        {
                            CurrentlySelected = i;
                            SetSelected();
                        }
                        i.Click(mx, my);
                        handled = true;
                    }
                }
                Click(mouseX, mouseY, handled);
            }
            return(true);
        }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("uri");
     writer.WriteStringValue(Uri);
     if (HttpHeaders != null && HttpHeaders.Any())
     {
         writer.WritePropertyName("httpHeaders");
         writer.WriteStartObject();
         foreach (var item in HttpHeaders)
         {
             writer.WritePropertyName(item.Key);
             writer.WriteStringValue(item.Value);
         }
         writer.WriteEndObject();
     }
     if (HttpMethod != null)
     {
         writer.WritePropertyName("httpMethod");
         writer.WriteStringValue(HttpMethod);
     }
     if (Timeout != null)
     {
         writer.WritePropertyName("timeout");
         writer.WriteStringValue(Timeout.Value, "P");
     }
     if (BatchSize != null)
     {
         writer.WritePropertyName("batchSize");
         writer.WriteNumberValue(BatchSize.Value);
     }
     if (DegreeOfParallelism != null)
     {
         writer.WritePropertyName("degreeOfParallelism");
         writer.WriteNumberValue(DegreeOfParallelism.Value);
     }
     writer.WritePropertyName("@odata.type");
     writer.WriteStringValue(ODataType);
     if (Name != null)
     {
         writer.WritePropertyName("name");
         writer.WriteStringValue(Name);
     }
     if (Description != null)
     {
         writer.WritePropertyName("description");
         writer.WriteStringValue(Description);
     }
     if (Context != null)
     {
         writer.WritePropertyName("context");
         writer.WriteStringValue(Context);
     }
     if (Inputs.Any())
     {
         writer.WritePropertyName("inputs");
         writer.WriteStartArray();
         foreach (var item in Inputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     else
     {
         writer.WriteNull("inputs");
     }
     if (Outputs.Any())
     {
         writer.WritePropertyName("outputs");
         writer.WriteStartArray();
         foreach (var item in Outputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     else
     {
         writer.WriteNull("outputs");
     }
     writer.WriteEndObject();
 }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (DefaultLanguageCode != null)
     {
         writer.WritePropertyName("defaultLanguageCode");
         writer.WriteStringValue(DefaultLanguageCode.Value.ToString());
     }
     if (VisualFeatures != null && VisualFeatures.Any())
     {
         writer.WritePropertyName("visualFeatures");
         writer.WriteStartArray();
         foreach (var item in VisualFeatures)
         {
             writer.WriteStringValue(item.ToString());
         }
         writer.WriteEndArray();
     }
     if (Details != null && Details.Any())
     {
         writer.WritePropertyName("details");
         writer.WriteStartArray();
         foreach (var item in Details)
         {
             writer.WriteStringValue(item.ToString());
         }
         writer.WriteEndArray();
     }
     writer.WritePropertyName("@odata.type");
     writer.WriteStringValue(ODataType);
     if (Name != null)
     {
         writer.WritePropertyName("name");
         writer.WriteStringValue(Name);
     }
     if (Description != null)
     {
         writer.WritePropertyName("description");
         writer.WriteStringValue(Description);
     }
     if (Context != null)
     {
         writer.WritePropertyName("context");
         writer.WriteStringValue(Context);
     }
     if (Inputs != null && Inputs.Any())
     {
         writer.WritePropertyName("inputs");
         writer.WriteStartArray();
         foreach (var item in Inputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (Outputs != null && Outputs.Any())
     {
         writer.WritePropertyName("outputs");
         writer.WriteStartArray();
         foreach (var item in Outputs)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     writer.WriteEndObject();
 }
 protected internal override Slot GetDefaultInputSlot()
 {
     return(Inputs.Any() ? Inputs[0] : null);
 }
Esempio n. 30
0
 public override bool Eval(Dictionary <char, bool> values)
 {
     return(Inputs.Any(g => g.Eval(values)));
 }