Ejemplo n.º 1
0
        /// <summary>
        /// Create structure based on the subsystem structure
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is RuleConditionTreeNode)
            {
                RuleConditionTreeNode node = SourceNode as RuleConditionTreeNode;
                DataDictionary.Rules.RuleCondition ruleCondition = node.Item;
                node.Delete();
                AddRuleCondition(ruleCondition);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Rules.RuleCondition ruleCondition = (DataDictionary.Rules.RuleCondition)DataDictionary.Generated.acceptor.getFactory().createRuleCondition();
                ruleCondition.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                ruleCondition.appendRequirements(reqRef);
                AddRuleCondition(ruleCondition);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is StructureElementTreeNode)
            {
                StructureElementTreeNode structureElementTreeNode = SourceNode as StructureElementTreeNode;
                DataDictionary.Types.StructureElement element     = structureElementTreeNode.Item;

                structureElementTreeNode.Delete();
                AddElement(element);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Types.StructureElement element = (DataDictionary.Types.StructureElement)DataDictionary.Generated.acceptor.getFactory().createStructureElement();
                element.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                element.appendRequirements(reqRef);
                AddElement(element);
            }
        }
        /// <summary>
        /// Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is EnumerationTreeNode)
            {
                EnumerationTreeNode       enumerationTreeNode = SourceNode as EnumerationTreeNode;
                DataDictionary.Types.Enum enumeration         = enumerationTreeNode.Item;

                enumerationTreeNode.Delete();
                AddEnum(enumeration);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Types.Enum enumeration = (DataDictionary.Types.Enum)DataDictionary.Generated.acceptor.getFactory().createEnum();
                enumeration.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                enumeration.appendRequirements(reqRef);
                AddEnum(enumeration);
            }
        }
        /// <summary>
        /// Accepts a new procedure
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is ProcedureTreeNode)
            {
                ProcedureTreeNode procedureTreeNode          = SourceNode as ProcedureTreeNode;
                DataDictionary.Functions.Procedure procedure = procedureTreeNode.Item;

                procedureTreeNode.Delete();
                AddProcedure(procedure);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Functions.Procedure procedure = (DataDictionary.Functions.Procedure)DataDictionary.Generated.acceptor.getFactory().createProcedure();
                procedure.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                procedure.appendRequirements(reqRef);
                AddProcedure(procedure);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is VariableTreeNode)
            {
                VariableTreeNode variableTreeNode          = SourceNode as VariableTreeNode;
                DataDictionary.Variables.Variable variable = variableTreeNode.Item;

                variableTreeNode.Delete();
                AddVariable(variable);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Variables.Variable variable = (DataDictionary.Variables.Variable)DataDictionary.Generated.acceptor.getFactory().createVariable();
                variable.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                variable.appendRequirements(reqRef);
                AddVariable(variable);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is RangeTreeNode)
            {
                RangeTreeNode rangeTreeNode      = SourceNode as RangeTreeNode;
                DataDictionary.Types.Range range = rangeTreeNode.Item;

                rangeTreeNode.Delete();
                AddRange(range);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Types.Range range = (DataDictionary.Types.Range)DataDictionary.Generated.acceptor.getFactory().createRange();
                range.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                range.appendRequirements(reqRef);
                AddRange(range);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates are reference to a requirement
 /// </summary>
 /// <param name="refId"></param>
 public void CreateReqRef(string refId)
 {
     DataDictionary.ReqRef req = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
     req.Name = refId;
     Item.appendRequirements(req);
     Nodes.Add(new ReqRefTreeNode(req));
     SortSubNodes();
     RefreshNode();
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is FunctionTreeNode)
            {
                FunctionTreeNode node = SourceNode as FunctionTreeNode;
                DataDictionary.Functions.Function function     = node.Item;
                DataDictionary.Functions.Function duplFunction = DataDictionary.OverallFunctionFinder.INSTANCE.findByName(function.Dictionary, function.Name);
                if (duplFunction != null) // If there is a function with the same name, we must delete it
                {
                    if (MessageBox.Show("Are you sure you want to move the corresponding function?", "Move action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        for (int i = 0; i < Nodes.Count; i++)
                        {
                            FunctionTreeNode temp = Nodes[i] as FunctionTreeNode;
                            if (temp.Item.Name == function.Name)
                            {
                                temp.Delete();
                            }
                        }
                        node.Delete();
                        AddFunction(function);
                    }
                }
                else
                {
                    node.Delete();
                    AddFunction(function);
                }
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Functions.Function function = (DataDictionary.Functions.Function)DataDictionary.Generated.acceptor.getFactory().createFunction();
                function.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                function.appendRequirements(reqRef);
                AddFunction(function);
            }
        }
Ejemplo n.º 9
0
        public StandardValuesCollection GetValues(DataDictionary.ReqRef req)
        {
            Utils.FinderRepository.INSTANCE.ClearCache();

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

            if (req.Model is DataDictionary.Rules.Rule)
            {
                DataDictionary.Rules.Rule rule = req.Model as DataDictionary.Rules.Rule;
                foreach (DataDictionary.Specification.Paragraph paragraph in rule.ApplicableParagraphs)
                {
                    retVal.Add(paragraph.getId());
                }
            }
            else
            {
                foreach (string paragraph in req.Specifications.ParagraphList())
                {
                    retVal.Add(paragraph);
                }
            }

            return(new StandardValuesCollection(retVal));
        }
Ejemplo n.º 10
0
        /// <summary>
        ///     Imports the paragraphs from the provided worksheet to the provided chapter
        /// </summary>
        /// <param name="aChapter"></param>
        /// <param name="aWorksheet"></param>
        private void importParagraphs(Chapter aChapter, string chapterId, Worksheet aWorksheet)
        {
            Range  aRange      = aWorksheet.UsedRange;
            int    paragraphId = 1;
            string text        = "";
            bool   skipRow     = false;

            for (int i = 2; i <= aRange.Rows.Count; i++)
            {
                string specId = (string)(aRange.Cells[i, 1] as Range).Value2;
                if (specId != null)
                {
                    // Create the new paragraph
                    Paragraph aParagraph = (Paragraph)acceptor.getFactory().createParagraph();
                    aParagraph.setId(chapterId + "." + paragraphId.ToString());
                    paragraphId++;
                    aParagraph.setType(acceptor.Paragraph_type.aNOTE);
                    aParagraph.setImplementationStatus(acceptor.SPEC_IMPLEMENTED_ENUM.Impl_NotImplementable);


                    // Add the requirement set "Onboard"
                    aParagraph.setObsoleteScopeOnBoard(false);
                    aParagraph.setObsoleteScopeTrackside(false);
                    RequirementSetReference requirementSetReference =
                        (RequirementSetReference)acceptor.getFactory().createRequirementSetReference();
                    RequirementSet requirementSet = TheDictionary.findRequirementSet("Scope", false);
                    if (requirementSet != null)
                    {
                        requirementSet = requirementSet.findRequirementSet("Onboard", false);
                        if (requirementSet != null)
                        {
                            requirementSetReference.setTarget(requirementSet.Guid);
                            aParagraph.appendRequirementSets(requirementSetReference);
                        }
                        else
                        {
                            throw new Exception("Requirement set Onboard not found");
                        }
                    }
                    else
                    {
                        throw new Exception("Requirement set Scope not found");
                    }

                    // Add the paragraph to the chapter
                    aChapter.appendParagraphs(aParagraph);


                    // Create of the text of paragraph
                    aParagraph.Text = (string)(aRange.Cells[i, 2] as Range).Value2 + "\n"; // description
                    text            = (string)(aRange.Cells[i, 6] as Range).Value2;        // start condition
                    if (text != null)
                    {
                        aParagraph.Text += "START: " + text + "\n";
                        if (specId.Equals((string)(aRange.Cells[i + 1, 1] as Range).Value2))
                        // the following element can give the stop condition for the current element
                        {
                            text = (string)(aRange.Cells[i + 1, 7] as Range).Value2;  // stop condition
                            if (text != null)
                            {
                                aParagraph.Text += "STOP: " + text + "\n";
                                skipRow          = true;
                                // the remaining information of the following document is identical => let's skip it
                            }
                        }
                    }
                    text = (string)(aRange.Cells[i, 7] as Range).Value2;  // stop condition
                    if (text != null)
                    {
                        aParagraph.Text += "STOP: " + text + "\n";
                    }
                    text = (string)(aRange.Cells[i, 8] as Range).Value2;  // comment
                    if (text != null)
                    {
                        aParagraph.Text += "Comment: " + text + "\n";
                    }


                    // Create the reference to a paragraph from Subset-026
                    Specification subset026 = findSubset026Specification();

                    specId = specId.Replace(" ", ".");
                    Paragraph refParagraph = subset026.FindParagraphByNumber(specId);

                    if (refParagraph != null)
                    {
                        ReqRef aReqRef = (ReqRef)acceptor.getFactory().createReqRef();
                        aReqRef.Paragraph = aParagraph;
                        refParagraph.appendRequirements(aReqRef);
                    }
                    else
                    {
                        aParagraph.Text += "SUBSET-026 REFERENCE: " + specId + "\n";
                    }


                    // DMI references
                    text = (string)(aRange.Cells[i, 3] as Range).Value2;  // DMI object
                    if (text != null)
                    {
                        aParagraph.Text += "DMI OBJECT: " + text + "\n";
                        text             = (string)(aRange.Cells[i, 4] as Range).Value2; // DMI area
                        if (text != null)
                        {
                            aParagraph.Text += "DMI AREA: " + text + "\n";
                            object reference = (aRange.Cells[i, 5] as Range).Value2; // DMI reference
                            if (reference != null)
                            {
                                aParagraph.Text += "DMI REFERENCE: " + reference.ToString();
                            }
                        }
                    }

                    if (skipRow)
                    {
                        i++;
                        skipRow = false;
                    }
                }
            }
        }