Exemple #1
0
        /// <summary>
        /// 要素リストを受け、要素のノートと操作のふるまいをテキスト出力する。
        /// テキスト解析に使用する。
        /// </summary>
        /// <param name="atf">対象成果物VO</param>
        /// <param name="elements">要素の</param>
        /// <param name="sw"></param>
        private void setParsedCodeInArtifact(ArtifactVO atf)
        {
            foreach (ElementVO elem in atf.getOwnElements())
            {
                if (elem.methods != null)
                {
                    foreach (MethodVO mth in elem.methods)
                    {
                        List <BehaviorChunk> chunks = behaviorParser.parseBehavior(mth);
                        StringWriter         outsw  = new StringWriter();

                        foreach (BehaviorChunk cnk in chunks)
                        {
                            if (cnk.behaviorToken == null || cnk.behaviorToken.token == "[comment]")
                            {
                                outsw.WriteLine(generateIndentStr(cnk.indLv) + "// " + cnk.dottedNum + " " + cnk.behavior);
                            }
                            else
                            {
                                outsw.WriteLine(generateIndentStr(cnk.indLv) + cnk.getTokenRepresented());
                            }
                        }

                        mth.code = outsw.ToString();
                        outsw.Close();
                    }
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="atf"></param>
        private void insertAttrMthInArtifact(ArtifactVO atf)
        {
            foreach (ElementVO elem in atf.getOwnElements())
            {
                foreach (AttributeVO attr in elem.attributes)
                {
                    insertAttrTable(atf, elem, attr);
                    elementRecCount++;

                    if (elementRecCount > 0 && (elementRecCount + 1) % 1000 == 0)
                    {
                        Console.Write(".");
                        transaction.Commit();
                        transaction = conn.BeginTransaction();
                    }
                }


                foreach (MethodVO mth in elem.methods)
                {
                    insertMthTable(atf, elem, mth);
                    elementRecCount++;

                    if (elementRecCount > 0 && (elementRecCount + 1) % 1000 == 0)
                    {
                        Console.Write(".");
                        transaction.Commit();
                        transaction = conn.BeginTransaction();
                    }
                }
            }
        }
 /// <summary>
 /// 引数の成果物フォルダ内の要素のふるまいをインサートする
 /// </summary>
 /// <param name="atf"></param>
 private void insertBehaviorsInArtifact(ArtifactVO atf)
 {
     foreach (ElementVO elem in atf.getOwnElements())
     {
         if (elem.eaType == "Class")
         {
             foreach (MethodVO mth in elem.methods)
             {
                 // メソッド単位でのふるまいのインサート
                 insertBehaviorsInMethod(elem, mth);
             }
         }
     }
 }
        /// <summary>
        /// 引数の成果物フォルダ内の要素を全て要素テーブルに書き込み
        /// </summary>
        /// <param name="atf">成果物フォルダ</param>
        private void insertElementsInArtifact(ArtifactVO atf)
        {
            foreach (ElementVO elem in atf.getOwnElements())
            {
                insertElementTable(atf, elem);
                // Console.WriteLine("insert element : " + elementRecCount + " records." );

                if ((elementRecCount + 1) % 1000 == 0 && elementRecCount > 0)
                {
                    Console.Write(".");
                    transaction.Commit();
                    transaction = conn.BeginTransaction();
                }

                elementRecCount++;
            }
        }
Exemple #5
0
        /// <summary>
        /// 要素リストを受け、要素のノートと操作のふるまいをテキスト出力する。
        /// テキスト解析に使用する。
        /// </summary>
        /// <param name="atf">対象成果物VO</param>
        /// <param name="elements">要素の</param>
        /// <param name="sw"></param>
        private void retrieveElementsInArtifact(ArtifactVO atf, StreamWriter sw)
        {
            foreach (ElementVO elem in atf.getOwnElements())
            {
                if (elem.methods != null)
                {
                    foreach (MethodVO mth in elem.methods)
                    {
                        List <BehaviorChunk> chunks = behaviorParser.parseBehavior(mth);

                        foreach (BehaviorChunk cnk in chunks)
                        {
                            writeChunkLine(cnk, sw);
                        }
                    }
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="atfReader"></param>
        /// <param name="artifactFile"></param>
        /// <param name="outputDir"></param>
        private void outputIndexedBehaviorText(ArtifactXmlReader atfReader, string artifactFile, string outputDir)
        {
            // 成果物XMLファイルの読み込み
            ArtifactVO artifact     = atfReader.readArtifactFile(artifactFile);
            string     textFileName = "BehaviorText";

            List <ElementVO> elements = artifact.getOwnElements();

            foreach (ElementVO elem in elements)
            {
                if (elementPathNameIsValid(elem.elementPath))
                {
                    if (elem.eaType == "Class" || elem.eaType == "Interface" || elem.eaType == "Enumeration" || elem.eaType == "Notes")
                    {
                        outputBehaviorTextFile(elem, outputDir + "\\" + textFileName);
                    }
                }
            }

            return;
        }