private void FillTables()
 {
     KeywordsList.AddRange(Tokens.Where(t => t.HasType(TokenType.Keyword)).Select(t => t.Value).Distinct());
     OperatorsList.AddRange(Tokens.Where(t => t.HasType(TokenType.Operator)).Select(t => t.Value).Distinct());
     FunctionsList.AddRange(Tokens.Where(t => t.HasType(TokenType.Function)).Select(t => t.Value).Distinct());
     IdentifiersList.AddRange(Tokens.Where(t => t.HasType(TokenType.Identifier)).Select(t => t.Value).Distinct());
     ConstantsList.AddRange(Tokens.Where(t => t.HasOneOfTypes(TokenType.CharConstant, TokenType.IntegerConstant, TokenType.FloatConstant, TokenType.StringConstant)).Select(t => t.Value.Escape()).Distinct());
 }
Ejemplo n.º 2
0
        public void SelectFeatureKeyword(string keyword)
        {
            var itemToCheck = KeywordsList.FirstOrDefault(item => item.Text.Contains(keyword));

            _driver.ScrollIntoCenterViaJS(itemToCheck);
            ((IJavaScriptExecutor)_driver)
            .ExecuteScript($"document.querySelector('[aria-label=\"{keyword}\"] span span').click()");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Helper: Builds table with rows delimited by symbol #
        /// </summary>
        /// <param name="lines"></param>
        /// <param name="index"></param>
        /// <param name="curObj"></param>
        /// <param name="keywordsList"></param>
        /// <returns></returns>
        private int BuildTable(string[] lines, int index, out string tableLine)
        {
            tableLine = "";
            // start build table from the next string after Table keyword
            for (int k = index + 1; k < lines.Length; k++)
            {
                if (string.IsNullOrEmpty(lines[k]))
                {
                    continue;
                }
                if (KeywordsList.Any(s => lines[k].StartsWith(s)))
                {
                    return(k - 1);
                }

                // if next line is not the end
                if (k + 1 < lines.Length)
                {
                    // if next line is new keyword, then end table and exit
                    if (KeywordsList.Any(s => lines[k + 1].Contains(s)))
                    {
                        // add current row to the table
                        tableLine += "#" + lines[k];
                        return(k);
                    }

                    // for the case if this lines contains line for last roll result
                    if (k + 2 < lines.Length && lines[k + 2].StartsWith(KeywordsList.First()))
                    {
                        if (char.IsDigit(lines[k][0]))
                        {
                            tableLine += "#" + lines[k];
                        }
                        else
                        {
                            tableLine += " " + lines[k];
                        }
                        return(k);
                    }
                }
                else
                {
                    // if it was the last line than end
                    tableLine += "#" + lines[k];
                    return(k);
                }
                if (char.IsDigit(lines[k][0]))
                {
                    tableLine += "#" + lines[k];
                }
                else
                {
                    tableLine += " " + lines[k];
                }
            }
            return(-1);
        }
Ejemplo n.º 4
0
        public void UpdateKeywordsAndOntology(CatalogSettings catalogSettings = null)
        {
            var keywordsData = new KeywordsList().GetKeywordsListData(catalogSettings ?? SearchSettings.Instance.CatalogSettings);

            Keywords     = keywordsData.Keywords;
            OntologyTree = keywordsData.OntoloyTree;
            Synonyms     = keywordsData.Synonyms;

            RaiseKeywordsChanged();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates single cypher or artefact
        /// </summary>
        /// <param name="lines"></param>
        /// <param name="currentIndex"></param>
        /// <param name="curObj"></param>
        /// <returns></returns>
        private int BuildCurrentDevice(string[] lines, int currentIndex, out Dictionary <string, string> curObj)
        {
            curObj = new Dictionary <string, string>();
            curObj.Add(NameKeyword, UppercaseFirstLetters(lines[currentIndex]));

            // read current object body starting from the next string
            var    currentKeyword = "";
            int    j;
            string tableKeyword = KeywordsList.FirstOrDefault(x => x.StartsWith("#"));
            bool   isThereTable = string.IsNullOrEmpty(tableKeyword) ? false : true;

            for (j = currentIndex + 1; j < lines.Length; j++)
            {
                if (string.IsNullOrEmpty(lines[j]))
                {
                    continue;
                }
                // either end of the array or start of the new object
                if (j + 1 != lines.Length && lines[j + 1].StartsWith(KeywordsList.First()))
                {
                    return(j - 1);
                }

                // check line for Keyword and add new line
                foreach (var keyword in KeywordsList)
                {
                    if (keyword == tableKeyword && lines[j].StartsWith(keyword.Substring(1)))
                    {
                        currentKeyword = keyword;
                        break;
                    }
                    if (lines[j].StartsWith(keyword))
                    {
                        currentKeyword = keyword;
                        break;
                    }
                }

                if (currentKeyword == "")
                {
                    curObj[NameKeyword] += " " + lines[j];
                    continue;
                }

                if (currentKeyword == tableKeyword)
                {
                    curObj.Add(currentKeyword, "");
                    j = BuildTable(lines, j, out var tableLine);
                    curObj[currentKeyword] = tableLine;
                    continue;
                }

                if (curObj.ContainsKey(currentKeyword))
                {
                    curObj[currentKeyword] += " " + lines[j];
                }
                else
                {
                    var startOfDescription = lines[j].Substring(currentKeyword.Length);
                    curObj.Add(currentKeyword, startOfDescription);
                }
            }
            return(j);
        }