/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dictionary"></param>
 public SpecIssuesReportHandler(DataDictionary.Dictionary dictionary)
     : base(dictionary)
 {
     createFileName("SpecificationIssuesReport");
     AddSpecIssues    = false;
     AddDesignChoices = false;
 }
Exemple #2
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="fileName"></param>
 /// <param name="dictionary"></param>
 /// <param name="mode"></param>
 /// <param name="keepManualTranslations">Indicates that manual translation for be kept during import</param>
 public ImportTestDataBaseOperation(string fileName, Dictionary dictionary, Mode mode, bool keepManualTranslations)
 {
     FileName               = fileName;
     _dictionary            = dictionary;
     ImportMode             = mode;
     KeepManualTranslations = keepManualTranslations;
 }
Exemple #3
0
        public StandardValuesCollection GetValues(Utils.IModelElement element)
        {
            Utils.FinderRepository.INSTANCE.ClearCache();

            DataDictionary.Dictionary dictionary = Utils.EnclosingFinder <DataDictionary.Dictionary> .find(element);

            DataDictionary.Types.NameSpace nameSpace = DataDictionary.EnclosingNameSpaceFinder.find(element);

            List <string> retVal = new List <string>();

            if (nameSpace != null)
            {
                DataDictionary.OverallTypeFinder.INSTANCE.findAllValueNames("", nameSpace, true, retVal);
            }
            else
            {
                DataDictionary.OverallTypeFinder.INSTANCE.findAllValueNames("", dictionary, false, retVal);
            }
            retVal.Sort();

            foreach (string name in dictionary.EFSSystem.PredefinedTypes.Keys)
            {
                retVal.Add(name);
            }

            return(new StandardValuesCollection(retVal));
        }
Exemple #4
0
        /// <summary>
        ///     Generates a table with specification coverage statistics
        /// </summary>
        /// <param name="aDictionary">The model</param>
        /// <param name="coveredParagraphs">Number and percentage of covered paragraphs</param>
        /// <param name="nonCoveredParagraphs">Number and percentage of non covered paragraphs</param>
        /// <param name="applicableParagraphs">Number of applicable paragraphs</param>
        /// <param name="allParagraphs">Total number of paragraphs</param>
        /// <returns></returns>
        private void GenerateStatistics(Dictionary aDictionary, bool coveredParagraphs, bool nonCoveredParagraphs,
                                        bool applicableParagraphs, bool allParagraphs)
        {
            AddTable(new string[] { "Statistics" }, new int[] { 70, 70 });
            if (allParagraphs)
            {
                AddRow("Total number of paragraphs", aDictionary.AllParagraphs.Count.ToString());
            }
            if (applicableParagraphs)
            {
                AddRow("Number of applicable paragraphs", aDictionary.ApplicableParagraphs.Count.ToString());
            }

            double applicableParagraphsCount = aDictionary.ApplicableParagraphs.Count;
            double coveredParagraphsCount    = CoveredRequirements(aDictionary, true).Count;
            double coveredPercentage         = (coveredParagraphsCount / applicableParagraphsCount) * 100;
            double nonCoveredParagraphsCount = applicableParagraphsCount - coveredParagraphsCount;
            double nonCoveredPercentage      = 100 - coveredPercentage;

            if (coveredParagraphs)
            {
                AddRow("Number of covered requirements",
                       String.Format("{0} ({1:0.##}%)", coveredParagraphsCount, coveredPercentage));
            }
            if (nonCoveredParagraphs)
            {
                AddRow("Number of non covered requirements",
                       String.Format("{0} ({1:0.##}%)", nonCoveredParagraphsCount, nonCoveredPercentage));
            }
        }
 /// <summary>
 ///     Avoid memory leak : caches hold references to dictionaries
 /// </summary>
 /// <param name="dictionary"></param>
 private static void CleanUpDictionary(Dictionary dictionary)
 {
     if (dictionary != null)
     {
         CleanUpCaches cleaner = new CleanUpCaches();
         cleaner.visit(dictionary);
     }
 }
Exemple #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="specification"></param>
 public Window(DataDictionary.Dictionary dictionary)
 {
     InitializeComponent();
     FormClosed += new FormClosedEventHandler(Window_FormClosed);
     Visible     = false;
     Dictionary  = dictionary;
     Refresh();
 }
Exemple #7
0
        /// <summary>
        /// Disable the rule, in a specific data dictionary
        /// </summary>
        public void DisableHandler(object sender, EventArgs args)
        {
            DataDictionary.Dictionary dictionary = MainWindow.GetActiveDictionary();

            if (dictionary != null)
            {
                dictionary.AppendRuleDisabling(Item);
                MainWindow.RefreshModel();
            }
        }
Exemple #8
0
        public StandardValuesCollection GetValues(DataDictionary.Dictionary dictionary)
        {
            Utils.FinderRepository.INSTANCE.ClearCache();

            List <string> retVal = new List <string>();

            DataDictionary.OverallNameSpaceFinder.INSTANCE.findAllValueNames("", dictionary, false, retVal);
            retVal.Sort();

            return(new StandardValuesCollection(retVal));
        }
Exemple #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dictionary"></param>
 public SpecCoverageReportHandler(DataDictionary.Dictionary dictionary)
     : base(dictionary)
 {
     createFileName("SpecificationCoverageReport");
     AddSpecification         = false;
     ShowFullSpecification    = false;
     AddCoveredParagraphs     = false;
     ShowAssociatedReqRelated = false;
     AddNonCoveredParagraphs  = false;
     AddReqRelated            = false;
     ShowAssociatedParagraphs = false;
 }
        /// <summary>
        /// Handles the click event on the select button :
        ///   - stores the selected dictionary
        ///   - close the window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void selectButton_Click(object sender, EventArgs e)
        {
            Selected = null;

            ListBoxEntry selected = dataDictionaryListBox.SelectedItem as ListBoxEntry;

            if (selected != null)
            {
                Selected = selected.Dictionary;
            }

            Close();
        }
        /// <summary>
        /// Provides a comparator for sort method
        /// </summary>
        /// <param name="x">First dictionary</param>
        /// <param name="y">Second discionary</param>
        /// <returns></returns>
        private static int compare(DataDictionary.Dictionary x, DataDictionary.Dictionary y)
        {
            int retVal = 0;                         // x = y

            if (String.Compare(x.Name, y.Name) < 0) // x < y
            {
                retVal = -1;
            }
            else if (String.Compare(x.Name, y.Name) > 0)  // x > y
            {
                retVal = 1;
            }
            return(retVal);
        }
Exemple #12
0
 /// <summary>
 ///     Creates a table resuming all requirements of the specification
 /// </summary>
 /// <param name="aDictionary">The model</param>
 /// <returns></returns>
 private void CreateSpecificationTable(Dictionary aDictionary)
 {
     AddTable(new string[] { "Model information" }, new int[] { 40, 40, 30, 30 });
     AddTableHeader("Requirement", "Target", "Type", "Implementation status");
     foreach (Paragraph paragraph in aDictionary.AllParagraphs)
     {
         string requirementSets = "";
         foreach (RequirementSet requirementSet in paragraph.ApplicableRequirementSets)
         {
             requirementSets += requirementSet.Name + " ";
         }
         AddRow(paragraph.FullId, requirementSets, paragraph.getType_AsString(),
                paragraph.getImplementationStatus_AsString());
     }
 }
Exemple #13
0
 public ModelReportHandler(DataDictionary.Dictionary aDictionary)
     : base(aDictionary)
 {
     createFileName("ModelReport");
     AddRanges              = false;
     AddRangesDetails       = false;
     AddEnumerations        = false;
     AddEnumerationsDetails = false;
     AddStructures          = false;
     AddStructuresDetails   = false;
     AddCollections         = false;
     AddCollectionsDetails  = false;
     AddFunctions           = false;
     AddFunctionsDetails    = false;
     AddProcedures          = false;
     AddProceduresDetails   = false;
     AddVariables           = false;
     AddVariablesDetails    = false;
     AddRules        = false;
     AddRulesDetails = false;
 }
Exemple #14
0
        /// <summary>
        /// The main program
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        static int Main(string[] args)
        {
            int retVal = 0;

            // We do not want auto compilation of the system
            DataDictionary.EFSSystem system = DataDictionary.EFSSystem.INSTANCE;
            system.Stop();

            // Check parameters
            if (args.Count() != PARAM_COUNT)
            {
                System.Console.Error.WriteLine("Incorrect number of parameters, found " + args.Count() + ", expected " + PARAM_COUNT);

                displayHelp();
                retVal = -1;
            }

            // Load dictionary
            DataDictionary.Dictionary dictionary = null;
            if (retVal == 0)
            {
                bool lockFiles  = false;
                bool updateGuid = false;
                dictionary = DataDictionary.Util.load(args[DICTIONARY_FILE], system, lockFiles, null, updateGuid);
                if (dictionary == null)
                {
                    System.Console.Error.WriteLine("Cannot read dictionary file " + args[DICTIONARY_FILE]);
                    retVal = -1;
                }
            }

            // Generates the HTML pages
            if (retVal == 0)
            {
                HTMLGenerator generator = new HTMLGenerator(args[OUTPUT_PATH]);
                generator.GenerateHTML(dictionary);
            }

            return(retVal);
        }
Exemple #15
0
        /// <summary>
        ///     Provides the set of covered requirements by the model
        /// </summary>
        /// <param name="aDictionary">The model</param>
        /// <param name="covered">Indicates if we need compute covered or non covered requirements</param>
        /// <returns></returns>
        public static HashSet <Paragraph> CoveredRequirements(Dictionary aDictionary, bool covered)
        {
            HashSet <Paragraph> retVal = new HashSet <Paragraph>();

            ICollection <Paragraph> applicableParagraphs = aDictionary.ApplicableParagraphs;
            Dictionary <Paragraph, List <ReqRef> > paragraphsReqRefDictionary = aDictionary.ParagraphsReqRefs;

            foreach (Paragraph paragraph in applicableParagraphs)
            {
                bool implemented = paragraph.getImplementationStatus() ==
                                   acceptor.SPEC_IMPLEMENTED_ENUM.Impl_Implemented;
                if (implemented)
                {
                    if (paragraphsReqRefDictionary.ContainsKey(paragraph))
                    {
                        List <ReqRef> implementations = paragraphsReqRefDictionary[paragraph];
                        for (int i = 0; i < implementations.Count; i++)
                        {
                            // the implementation may be also a ReqRef
                            if (implementations[i].Enclosing is ReqRelated)
                            {
                                ReqRelated reqRelated = implementations[i].Enclosing as ReqRelated;
                                // Do not consider tests
                                if (EnclosingFinder <Frame> .find(reqRelated) == null)
                                {
                                    implemented = implemented && reqRelated.ImplementationCompleted;
                                }
                            }
                        }
                    }
                }
                if (implemented == covered)
                {
                    retVal.Add(paragraph);
                }
            }
            return(retVal);
        }
        /// <summary>
        ///     Provides the set of covered requirements by the model
        /// </summary>
        /// <param name="aDictionary">The model</param>
        /// <param name="covered">Indicates if we need compute covered or non covered requirements</param>
        /// <returns></returns>
        public static HashSet<Paragraph> CoveredRequirements(Dictionary aDictionary, bool covered)
        {
            HashSet<Paragraph> retVal = new HashSet<Paragraph>();

            ICollection<Paragraph> applicableParagraphs = aDictionary.ApplicableParagraphs;
            Dictionary<Paragraph, List<ReqRef>> paragraphsReqRefDictionary = aDictionary.ParagraphsReqRefs;
            foreach (Paragraph paragraph in applicableParagraphs)
            {
                bool implemented = paragraph.getImplementationStatus() ==
                                   acceptor.SPEC_IMPLEMENTED_ENUM.Impl_Implemented;
                if (implemented)
                {
                    if (paragraphsReqRefDictionary.ContainsKey(paragraph))
                    {
                        List<ReqRef> implementations = paragraphsReqRefDictionary[paragraph];
                        for (int i = 0; i < implementations.Count; i++)
                        {
                            // the implementation may be also a ReqRef
                            if (implementations[i].Enclosing is ReqRelated)
                            {
                                ReqRelated reqRelated = implementations[i].Enclosing as ReqRelated;
                                // Do not consider tests
                                if (EnclosingFinder<Frame>.find(reqRelated) == null)
                                {
                                    implemented = implemented && reqRelated.ImplementationCompleted;
                                }
                            }
                        }
                    }
                }
                if (implemented == covered)
                {
                    retVal.Add(paragraph);
                }
            }
            return retVal;
        }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="dictionary">The dictionary to compare with</param>
 /// <param name="lastCommit">The last commit used to update the history information</param>
 public UpdateBlameInformationOperation(Dictionary dictionary, Commit lastCommit)
     : base(dictionary)
 {
     LastCommit = lastCommit;
 }
Exemple #18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="aDictionary"></param>
 /// <param name="importResult"></param>
 public DeltaImportReportHandler(DataDictionary.Dictionary aDictionary, Importers.RtfDeltaImporter.Document importResult, string baseFileName)
     : base(aDictionary)
 {
     createFileName(baseFileName);
     ImportResult = importResult;
 }
 /// <summary>
 /// Generates the C code for the corresponding dictionary
 /// </summary>
 /// <param name="dictionary"></param>
 public void GenerateHTML(DataDictionary.Dictionary dictionary)
 {
     visit(dictionary, true);
 }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="fileName"></param>
 /// <param name="dictionary"></param>
 /// <param name="mode"></param>
 public ImportTestDataBaseOperation(string fileName, Dictionary dictionary, Mode mode)
 {
     FileName = fileName;
     _dictionary = dictionary;
     ImportMode = mode;
 }
        /// <summary>
        /// Loads a translation dictionary and lock the file
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="dictionary"></param>
        /// <returns></returns>
        public static TranslationDictionary loadTranslationDictionary(string filePath, DataDictionary.Dictionary dictionary)
        {
            TranslationDictionary retVal = DocumentLoader <TranslationDictionary> .loadFile(filePath, dictionary);

            return(retVal);
        }
        /// <summary>
        /// Provides the set of covered requirements by the tests
        /// </summary>
        /// <param name="aDictionary">The model</param>
        /// <returns></returns>
        public static HashSet <DataDictionary.Specification.Paragraph> CoveredRequirements(DataDictionary.Dictionary aDictionary)
        {
            HashSet <DataDictionary.Specification.Paragraph>     retVal = new HashSet <DataDictionary.Specification.Paragraph>();
            ICollection <DataDictionary.Specification.Paragraph> applicableParagraphs = aDictionary.Specifications.ApplicableParagraphs;
            Dictionary <DataDictionary.Specification.Paragraph, List <DataDictionary.ReqRef> > paragraphsReqRefDictionary = aDictionary.ParagraphsReqRefs;

            foreach (DataDictionary.Specification.Paragraph paragraph in applicableParagraphs)
            {
                bool implemented = paragraph.getImplementationStatus() == DataDictionary.Generated.acceptor.SPEC_IMPLEMENTED_ENUM.Impl_Implemented;
                bool tested      = false;
                if (implemented)
                {
                    if (paragraphsReqRefDictionary.ContainsKey(paragraph))
                    {
                        List <DataDictionary.ReqRef> implementations = paragraphsReqRefDictionary[paragraph];
                        for (int i = 0; i < implementations.Count; i++)
                        {
                            DataDictionary.ReqRelated reqRelated = implementations[i].Enclosing as DataDictionary.ReqRelated;
                            if (reqRelated is TestCase && reqRelated.ImplementationCompleted == true)
                            {
                                tested = true;
                            }
                        }
                    }
                }

                if (implemented && tested)
                {
                    retVal.Add(paragraph);
                }
            }

            return(retVal);
        }
        /// <summary>
        ///     Performs the job as a background task
        /// </summary>
        public override void ExecuteWork()
        {
            // Retrieve the hash tag
            if (LastCommit != null)
            {
                Repository repository = GetRepository();

                string dictionaryDirectory = Path.GetDirectoryName(Dictionary.FilePath);
                if (dictionaryDirectory != null)
                {
                    dictionaryDirectory = dictionaryDirectory.Substring(RepositoryPath.Length + 1,
                                                                        dictionaryDirectory.Length - RepositoryPath.Length - 1);

                    History history = Dictionary.EFSSystem.History;
                    if (history.Commit(LastCommit.Sha) == null)
                    {
                        // Processes all commits until the one that has been selected
                        Dictionary currentVersion  = Dictionary;
                        Dictionary previousVersion = null;
                        Commit     previousCommit  = null;
                        Commit     commitToRefer   = null;
                        foreach (Commit commit in repository.Commits)
                        {
                            // Always compare the current version with the first commit in the repository
                            // since changes may have been applied to the current version
                            if (previousVersion == null || !history.CommitExists(commit.Sha))
                            {
                                if (previousCommit == null)
                                {
                                    if (previousVersion != Dictionary && currentVersion != previousVersion)
                                    {
                                        CleanUpDictionary(previousVersion);
                                    }
                                    previousVersion = currentVersion;
                                }
                                else
                                {
                                    previousVersion = DictionaryByVersion(previousCommit);
                                    Comparer.ensureGuidDictionary(previousVersion, currentVersion);
                                }

                                bool changesAvailable = true;
                                if (commitToRefer != null)
                                {
                                    changesAvailable = false;
                                    TreeChanges changes = repository.Diff.Compare(commit.Tree, commitToRefer.Tree);
                                    foreach (TreeEntryChanges entry in changes.Modified)
                                    {
                                        if (entry.Path.StartsWith(dictionaryDirectory))
                                        {
                                            changesAvailable = true;
                                            break;
                                        }
                                    }
                                }

                                if (changesAvailable)
                                {
                                    if (commitToRefer != null)
                                    {
                                        string message = commitToRefer.Message.Trim();
                                        if (message.Length > 132)
                                        {
                                            message = message.Substring(0, 132) + "...";
                                        }
                                        Dialog.UpdateMessage("Processing " + message + " (" + commitToRefer.Sha + ")");
                                    }
                                    else
                                    {
                                        Dialog.UpdateMessage("Processing current version...");
                                    }

                                    currentVersion = DictionaryByVersion(commit);

                                    if (currentVersion != null)
                                    {
                                        VersionDiff versionDiff = new VersionDiff();
                                        if (commitToRefer != null)
                                        {
                                            versionDiff.setCommitter(commitToRefer.Author.Name);
                                            versionDiff.setDate(commitToRefer.Author.When.ToString());
                                            versionDiff.setHash(commitToRefer.Sha);
                                            versionDiff.setMessage(commitToRefer.Message);
                                        }

                                        Comparer.ensureGuidDictionary(previousVersion, currentVersion);
                                        Comparer.compareDictionary(previousVersion, currentVersion, versionDiff);
                                        history.AppendOrReplaceCommit(versionDiff);
                                        history.save();
                                    }
                                    else
                                    {
                                        DialogResult result =
                                            MessageBox.Show(
                                                "Cannot open file for commit\n" + commit.MessageShort + " (" + commit.Sha +
                                                ")\nplease see log file (GUI.Log) for more information.\nPress OK to continue.",
                                                "Cannot open file", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                                        if (result == DialogResult.OK)
                                        {
                                            // Stick back to the previous version to continue the process
                                            currentVersion = previousVersion;
                                        }
                                        else
                                        {
                                            // Stop the process
                                            break;
                                        }
                                    }
                                }
                                else
                                {
                                    currentVersion = previousVersion;
                                }

                                previousCommit = null;
                            }
                            else
                            {
                                previousCommit = commit;
                            }

                            if (commit == LastCommit)
                            {
                                break;
                            }

                            commitToRefer = commit;
                        }
                    }
                    history.UpdateBlame();
                }
            }
        }
        /// <summary>
        ///     Generates a table with specification coverage statistics
        /// </summary>
        /// <param name="aDictionary">The model</param>
        /// <param name="coveredParagraphs">Number and percentage of covered paragraphs</param>
        /// <param name="nonCoveredParagraphs">Number and percentage of non covered paragraphs</param>
        /// <param name="applicableParagraphs">Number of applicable paragraphs</param>
        /// <param name="allParagraphs">Total number of paragraphs</param>
        /// <returns></returns>
        private void GenerateStatistics(Dictionary aDictionary, bool coveredParagraphs, bool nonCoveredParagraphs,
            bool applicableParagraphs, bool allParagraphs)
        {
            AddTable(new string[] {"Statistics"}, new int[] {70, 70});
            if (allParagraphs)
            {
                AddRow("Total number of paragraphs", aDictionary.AllParagraphs.Count.ToString());
            }
            if (applicableParagraphs)
            {
                AddRow("Number of applicable paragraphs", aDictionary.ApplicableParagraphs.Count.ToString());
            }

            double applicableParagraphsCount = aDictionary.ApplicableParagraphs.Count;
            double coveredParagraphsCount = CoveredRequirements(aDictionary, true).Count;
            double coveredPercentage = (coveredParagraphsCount/applicableParagraphsCount)*100;
            double nonCoveredParagraphsCount = applicableParagraphsCount - coveredParagraphsCount;
            double nonCoveredPercentage = 100 - coveredPercentage;

            if (coveredParagraphs)
            {
                AddRow("Number of covered requirements",
                    String.Format("{0} ({1:0.##}%)", coveredParagraphsCount, coveredPercentage));
            }
            if (nonCoveredParagraphs)
            {
                AddRow("Number of non covered requirements",
                    String.Format("{0} ({1:0.##}%)", nonCoveredParagraphsCount, nonCoveredPercentage));
            }
        }
        /// <summary>
        /// Handles the click event on the select button : 
        ///   - stores the selected dictionary
        ///   - close the window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void selectButton_Click(object sender, EventArgs e)
        {
            Selected = null;

            ListBoxEntry selected = dataDictionaryListBox.SelectedItem as ListBoxEntry;
            if (selected != null)
            {
                Selected = selected.Dictionary;
            }

            Close();
        }
 /// <summary>
 ///     Avoid memory leak : caches hold references to dictionaries
 /// </summary>
 /// <param name="dictionary"></param>
 private static void CleanUpDictionary(Dictionary dictionary)
 {
     if (dictionary != null)
     {
         CleanUpCaches cleaner = new CleanUpCaches();
         cleaner.visit(dictionary);
     }
 }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="dictionary">The dictionary to compare with</param>
 /// <param name="lastCommit">The last commit used to update the history information</param>
 public UpdateBlameInformationOperation(Dictionary dictionary, Commit lastCommit)
     : base(dictionary)
 {
     LastCommit = lastCommit;
 }
Exemple #28
0
        /// <summary>
        ///     Creates a table for a given set of paragraphs
        /// </summary>
        /// <param name="paragraphs">The paragraphs to display</param>
        /// <param name="dictionary">The dictionary</param>
        /// <returns></returns>
        private void CreateImplementedParagraphsTable(HashSet <Paragraph> paragraphs, Dictionary dictionary)
        {
            Dictionary <Paragraph, List <ReqRef> > paragraphsReqRefDictionary = dictionary.ParagraphsReqRefs;

            foreach (Paragraph paragraph in paragraphs)
            {
                Cell previousCell = null;

                if (paragraphsReqRefDictionary.ContainsKey(paragraph))
                {
                    AddSubParagraph("Requirement " + paragraph.FullId);
                    AddTable(new string[] { "Requirement " + paragraph.FullId }, new int[] { 40, 60, 40 });
                    AddRow(paragraph.Text);

                    foreach (ReqRef reqRef in paragraph.Implementations)
                    {
                        string fullName = null;
                        string comment  = null;

                        ReqRelated reqRelated = reqRef.Enclosing as ReqRelated;
                        if (reqRelated != null)
                        {
                            if (reqRelated is TestCase) /* TODO: review it */
                            {
                                fullName = "TEST CASE " + reqRelated.Name;
                            }
                            else if (reqRelated is StateMachine) /* TODO: review it */
                            {
                                fullName = reqRelated.Name;
                            }
                            else
                            {
                                fullName = reqRelated.FullName;
                            }
                            comment = reqRelated.Comment;
                        }
                        else
                        {
                            Paragraph par = reqRef.Enclosing as Paragraph;
                            if (par != null) /* TODO: review it */
                            {
                                fullName = "PARAGRAPH " + paragraph.FullId;
                                comment  = paragraph.Comment;
                            }
                        }

                        if (fullName != null && comment != null)
                        {
                            if (previousCell == null)
                            {
                                AddRow("Associated implementation", fullName, comment);
                                previousCell = lastRow.Cells[0];
                            }
                            else
                            {
                                if (AddRow("", fullName, comment) != null)
                                {
                                    previousCell.MergeDown += 1;
                                }
                                else
                                {
                                    throw new Exception("Error: tried to add an empty row in the spec coverage report");
                                }
                            }
                        }
                    }
                    CloseSubParagraph();
                }
            }
        }
        /// <summary>
        ///     Creates a table for a given set of paragraphs
        /// </summary>
        /// <param name="paragraphs">The paragraphs to display</param>
        /// <param name="dictionary">The dictionary</param>
        /// <returns></returns>
        private void CreateImplementedParagraphsTable(HashSet<Paragraph> paragraphs, Dictionary dictionary)
        {
            Dictionary<Paragraph, List<ReqRef>> paragraphsReqRefDictionary = dictionary.ParagraphsReqRefs;
            foreach (Paragraph paragraph in paragraphs)
            {
                Cell previousCell = null;

                if (paragraphsReqRefDictionary.ContainsKey(paragraph))
                {
                    AddSubParagraph("Requirement " + paragraph.FullId);
                    AddTable(new string[] {"Requirement " + paragraph.FullId}, new int[] {40, 60, 40});
                    AddRow(paragraph.Text);

                    foreach (ReqRef reqRef in paragraph.Implementations)
                    {
                        string fullName = null;
                        string comment = null;

                        ReqRelated reqRelated = reqRef.Enclosing as ReqRelated;
                        if (reqRelated != null)
                        {
                            if (reqRelated is TestCase) /* TODO: review it */
                            {
                                fullName = "TEST CASE " + reqRelated.Name;
                            }
                            else if (reqRelated is StateMachine) /* TODO: review it */
                            {
                                fullName = reqRelated.Name;
                            }
                            else
                            {
                                fullName = reqRelated.FullName;
                            }
                            comment = reqRelated.Comment;
                        }
                        else
                        {
                            Paragraph par = reqRef.Enclosing as Paragraph;
                            if (par != null) /* TODO: review it */
                            {
                                fullName = "PARAGRAPH " + paragraph.FullId;
                                comment = paragraph.Comment;
                            }
                        }

                        if (fullName != null && comment != null)
                        {
                            if (previousCell == null)
                            {
                                AddRow("Associated implementation", fullName, comment);
                                previousCell = lastRow.Cells[0];
                            }
                            else
                            {
                                if (AddRow("", fullName, comment) != null)
                                {
                                    previousCell.MergeDown += 1;
                                }
                                else
                                {
                                    throw new Exception("Error: tried to add an empty row in the spec coverage report");
                                }
                            }
                        }
                    }
                    CloseSubParagraph();
                }
            }
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dictionary"></param>
 public ListBoxEntry(DataDictionary.Dictionary dictionary)
 {
     Dictionary = dictionary;
 }
 /// <summary>
 ///     Creates a table resuming all requirements of the specification
 /// </summary>
 /// <param name="aDictionary">The model</param>
 /// <returns></returns>
 private void CreateSpecificationTable(Dictionary aDictionary)
 {
     AddTable(new string[] {"Model information"}, new int[] {40, 40, 30, 30});
     AddTableHeader("Requirement", "Target", "Type", "Implementation status");
     foreach (Paragraph paragraph in aDictionary.AllParagraphs)
     {
         string requirementSets = "";
         foreach (RequirementSet requirementSet in paragraph.ApplicableRequirementSets)
         {
             requirementSets += requirementSet.Name + " ";
         }
         AddRow(paragraph.FullId, requirementSets, paragraph.getType_AsString(),
             paragraph.getImplementationStatus_AsString());
     }
 }