コード例 #1
0
        public virtual string GetResultStrByBase(string @base, int baseBy, long category, bool showQuery, string query,
                                                 bool noOutputFlag, string noOutputMsg, bool showTotalRecNum, int lexRecordFormat, string fieldSep)
        {
            LexAccessApiResult lexAccessApiResult = null;

            if ((!ReferenceEquals(@base, null)) && (@base.Length > 0))

            {
                lexAccessApiResult = GetLexRecordsByBase(@base, baseBy);
            }

            List <LexRecord> newLexRecordObjs = new List <LexRecord>();

            if (category < 2047L)

            {
                List <LexRecord> lexRecordObjs = lexAccessApiResult.GetJavaObjs();
                for (int i = 0; i < lexRecordObjs.Count; i++)

                {
                    LexRecord temp     = (LexRecord)lexRecordObjs[i];
                    long      catValue = Category.ToValue(temp.GetCategory());
                    if (BitMaskBase.Contains(category, catValue) == true)

                    {
                        newLexRecordObjs.Add(temp);
                    }
                }

                lexAccessApiResult.SetJavaObjs(newLexRecordObjs);
            }

            return(FormatResultToStr(lexAccessApiResult, @base, showQuery, query, noOutputFlag, noOutputMsg,
                                     showTotalRecNum, lexRecordFormat, fieldSep));
        }
コード例 #2
0
        public virtual string GetResultStrByCategory(long category, bool showQuery, string query, bool noOutputFlag,
                                                     string noOutputMsg, bool showTotalRecNum, int lexRecordFormat, string fieldSep)
        {
            LexAccessApiResult lexAccessApiResult = null;

            lexAccessApiResult = GetLexRecordsByCat(category);
            return(FormatResultToStr(lexAccessApiResult, "", showQuery, query, noOutputFlag, noOutputMsg,
                                     showTotalRecNum, lexRecordFormat, fieldSep));
        }
コード例 #3
0
        public virtual LexAccessApiResult GetLexRecordsByCat(long category)
        {
            LexAccessApiResult lexAccessApiResult = new LexAccessApiResult();
            StringBuilder      text = new StringBuilder();

            List <string> lexRecords = DbLexRecord.GetRecordsByCat(conn_, lexiconType, category);

            for (int i = 0; i < lexRecords.Count; i++)

            {
                string lexRecord = (string)lexRecords[i];
                text.Append(lexRecord);
            }

            lexAccessApiResult.SetText(text.ToString());
            return(lexAccessApiResult);
        }
コード例 #4
0
        public virtual LexAccessApiResult GetLexRecords(string input)
        {
            LexAccessApiResult lexAccessApiResult = new LexAccessApiResult();

            if ((ReferenceEquals(input, null)) || (input.Length == 0))

            {
                return(lexAccessApiResult);
            }

            bool   isEui = CheckFormatEui.IsValidEui(input);
            string text  = "";

            if (isEui == true)

            {
                string lexRecord = DbLexRecord.GetRecordByEui(conn_, lexiconType, input);
                text = lexRecord;
            }
            else

            {
                List <string> euis = DbInflVars.GetUniqueEuisByInflVar(conn_, lexiconType, input);

                List <string> lexRecords = new List <string>();
                foreach (string eui in euis)
                {
                    lexRecords.Add(DbLexRecord.GetRecordByEui(conn_, lexiconType, eui));
                }

                for (int i = 0; i < lexRecords.Count; i++)

                {
                    text = text + lexRecords[i];
                }
            }

            lexAccessApiResult.SetText(text);
            return(lexAccessApiResult);
        }
コード例 #5
0
        public virtual LexAccessApiResult GetLexRecordsByBase(string input, int baseBy)
        {
            LexAccessApiResult lexAccessApiResult = new LexAccessApiResult();

            if ((ReferenceEquals(input, null)) || (input.Length == 0))

            {
                return(lexAccessApiResult);
            }

            string text = "";


            List <string> lexRecords = DbLexRecord.GetRecordsByBase(conn_, lexiconType, input, baseBy);

            for (int i = 0; i < lexRecords.Count; i++)

            {
                text = text + (string)lexRecords[i];
            }

            lexAccessApiResult.SetText(text);
            return(lexAccessApiResult);
        }
コード例 #6
0
        public virtual string FormatResultToStr(LexAccessApiResult lexAccessApiResult, string inputTerm, bool showQuery,
                                                string query, bool noOutputFlag, string noOutputMsg, bool showTotalRecNum, int lexRecordFormat,
                                                string fieldSep)


        {
            StringBuilder buffer = new StringBuilder();

            if (showQuery == true)

            {
                buffer.Append("Query: '" + query.Trim() + "'");
                buffer.Append(LS_STR);
            }

            if ((noOutputFlag == true) && (lexAccessApiResult.GetTotalRecordNumber() == 0))


            {
                buffer.Append(inputTerm + fieldSep + noOutputMsg);
                buffer.Append(LS_STR);
            }

            if (showTotalRecNum == true)

            {
                buffer.Append("--- Total Records Number: " + lexAccessApiResult.GetTotalRecordNumber());

                buffer.Append(LS_STR);
            }

            switch (lexRecordFormat)

            {
            case 0:
                buffer.Append(lexAccessApiResult.GetText());
                break;

            case 1:
                buffer.Append(lexAccessApiResult.GetXml());
                break;

            case 2:
                buffer.Append(lexAccessApiResult.GetText());
                buffer.Append(lexAccessApiResult.GetXml());
                break;

            case 3:
                List <string> bases = lexAccessApiResult.GetBases();
                for (int i = 0; i < bases.Count; i++)

                {
                    buffer.Append((string)bases[i]);
                    buffer.Append(LS_STR);
                }

                break;

            case 4:
                List <string> basesD = lexAccessApiResult.GetBases(fieldSep);
                for (int i = 0; i < basesD.Count; i++)

                {
                    buffer.Append((string)basesD[i]);
                    buffer.Append(LS_STR);
                }

                break;

            case 5:
                List <string> spellingVars = lexAccessApiResult.GetSpellingVars();
                for (int i = 0; i < spellingVars.Count; i++)

                {
                    buffer.Append((string)spellingVars[i]);
                    buffer.Append(LS_STR);
                }

                break;

            case 6:
                List <string> spellingVarsD = lexAccessApiResult.GetSpellingVars(fieldSep);
                for (int i = 0; i < spellingVarsD.Count; i++)

                {
                    buffer.Append((string)spellingVarsD[i]);
                    buffer.Append(LS_STR);
                }

                break;

            case 7:
                List <string> inflVars = lexAccessApiResult.GetInflVars();
                for (int i = 0; i < inflVars.Count; i++)

                {
                    buffer.Append((string)inflVars[i]);
                    buffer.Append(LS_STR);
                }

                break;

            case 8:
                List <string> inflVarsD = lexAccessApiResult.GetInflVars(fieldSep);
                for (int i = 0; i < inflVarsD.Count; i++)

                {
                    buffer.Append((string)inflVarsD[i]);
                    buffer.Append(LS_STR);
                }

                break;
            }

            return(buffer.ToString());
        }