Exemplo n.º 1
0
        public ReqProRequirementPrx[] GetRequirementTracesFrom(int nMaxTraceCount, ref eTraceAbortReason eAbort,
                                                               out int nTraceCount, ReqProRequirementPrx reqReqPrxTracesFrom)
        {
            if (rpxReq != null)
            {
                ReqProRequirementPrx[] aReqPrx = GetRequirementTraces(rpxReq.TracesFrom, nMaxTraceCount,
                                                                      out nTraceCount, reqReqPrxTracesFrom);
                if (nTraceCount != aReqPrx.GetLength(0))
                {
                    eAbort = eAbort | eTraceAbortReason.eTooManyTracesFrom;
                }
                if (!rpxReq.IsRoot)
                {
                    ReqProRequirementPrx[] aOut;
                    int i;

                    ReqProRequirementPrx reqParent = GetRequirementTrace(
                        rpxReq.get_Parent(enumRequirementsWeights.eReqWeight_Medium),
                        enumRelationshipDirections.eRelDirection_Parent);
                    aOut = new ReqProRequirementPrx[aReqPrx.GetLength(0) + 1];
                    for (i = 0; i < aReqPrx.GetLength(0); i++)
                    {
                        aOut[i] = aReqPrx[i];
                    }
                    aOut[i] = reqParent;
                    nTraceCount++;
                }

                return(aReqPrx);
            }
            nTraceCount = 0;
            return(new ReqProRequirementPrx[0]);
        }
Exemplo n.º 2
0
        public ReqProRequirementPrx[] GetRequirementTracesTo(int nMaxTraceCount, ref eTraceAbortReason eAbort,
                                                             out int nTraceCount, ReqProRequirementPrx reqReqPrxTracesTo)
        {
            if (rpxReq != null)
            {
                int i = 0;
                int nTraceCountTo;
                int nTraceCountChildren;

                ReqProRequirementPrx[] aReqPrxTo = GetRequirementTraces(rpxReq.TracesTo, nMaxTraceCount,
                                                                        out nTraceCountTo, reqReqPrxTracesTo);
                if (nTraceCountTo != aReqPrxTo.GetLength(0))
                {
                    eAbort = eAbort | eTraceAbortReason.eTooManyTracesTo;
                }
                ReqProRequirementPrx[] aReqPrxChildren = GetRequirementTraces(rpxReq.Children, -1,
                                                                              out nTraceCountChildren, reqReqPrxTracesTo);

                ReqProRequirementPrx[] aReqPrx;
                aReqPrx = new ReqProRequirementPrx[aReqPrxTo.GetLength(0) + aReqPrxChildren.GetLength(0)];
                foreach (ReqProRequirementPrx reqPrx in aReqPrxTo)
                {
                    aReqPrx[i++] = reqPrx;
                }
                foreach (ReqProRequirementPrx reqPrx in aReqPrxChildren)
                {
                    aReqPrx[i++] = reqPrx;
                }
                nTraceCount = nTraceCountTo + nTraceCountChildren;

                return(aReqPrx);
            }
            nTraceCount = 0;
            return(new ReqProRequirementPrx[0]);
        }
Exemplo n.º 3
0
        public ReqProRequirementPrx[] GetRequirementTraces
            (ReqPro40.Relationships rpxRelations, int nMaxTraceCount, out int nTraceCount, ReqProRequirementPrx reqReqPrxTracesPrecedor)
        {
            ReqProRequirementPrx[] aReqPrx;

            int nCount = rpxRelations.Count;

            nTraceCount = nCount;
            if ((nMaxTraceCount != -1) && (nCount > nMaxTraceCount))
            {
                if (reqReqPrxTracesPrecedor == null)
                {
                    aReqPrx = new ReqProRequirementPrx[0];
                }
                else
                {
                    aReqPrx    = new ReqProRequirementPrx[1];
                    aReqPrx[0] = reqReqPrxTracesPrecedor;
                }
            }
            else
            {
                aReqPrx = new ReqProRequirementPrx[nCount];
                rpxRelations.MoveFirst();
                for (int i = 0; i < nCount; i++)
                {
                    aReqPrx[i] = GetRequirementTrace(rpxRelations.ItemCurrent, rpxRelations.Direction);
                    rpxRelations.MoveNext();
                }
            }
            return(aReqPrx);
        }
Exemplo n.º 4
0
 public void RefreshProject()
 {
     if ((state == eState.stConn) || (state == eState.stParsed))
     {
         ReqProRequirementPrx.InitCache();
         rpxProject.Refresh(true);
         rpxProject.RefreshAllRelatedProjectContexts();
     }
 }
Exemplo n.º 5
0
 public ReqProRequirementPrx(ReqProRequirementPrx reqProReqPrx)
 {
     this.nKey       = reqProReqPrx.nKey;
     this.rpxProject = reqProReqPrx.rpxProject;
     this.rpxReq     = reqProReqPrx.rpxReq;
     this.strName    = reqProReqPrx.strName;
     this.strPrefix  = reqProReqPrx.strPrefix;
     this.strTag     = reqProReqPrx.strTag;
     this.strText    = reqProReqPrx.strText;
 }
Exemplo n.º 6
0
        public ReqTraceNode(ReqProRequirementPrx reqProReqPrx, ulong ulDegreeRel, bool bIsRootNode,
                            ReqProRequirementPrx[] aReqProReqPrxTracesFrom, ReqProRequirementPrx[] aReqProReqPrxTracesTo,
                            int nTraceFromCount, int nTraceToCount, eTraceAbortReason eAbort, int nTraceFromHopCount, int nTraceToHopCount)
            : base(reqProReqPrx)
        {
            x = int.MinValue;
            y = int.MinValue;
            this.nTraceFromHopCount = int.MaxValue;
            this.nTraceToHopCount   = int.MaxValue;

            OnceAgain(ulDegreeRel, bIsRootNode, aReqProReqPrxTracesFrom, aReqProReqPrxTracesTo,
                      nTraceFromCount, nTraceToCount, eAbort, nTraceFromHopCount, nTraceToHopCount);
        }
Exemplo n.º 7
0
        public ReqProRequirementPrx GetRequirementTrace(ReqPro40.Relationship rpxRelation, enumRelationshipDirections dir)
        {
            ReqProRequirementPrx reqPrx;
            bool bDoNotRead;

            try
            {
                if ((rpxRelation.Permissions == enumPermissions.ePerm_None) ||
                    (rpxRelation.Permissions == enumPermissions.ePermission_None))
                {
                    bDoNotRead = true;
                }
                else
                {
                    bDoNotRead = false;
                }

                if ((dir == enumRelationshipDirections.eRelDirection_To) ||
                    (dir == enumRelationshipDirections.eRelDirection_Child))
                {
                    if (bDoNotRead)
                    {
                        reqPrx = new ReqProRequirementPrx("Key " + rpxRelation.DestinationKey, "no permission", "no permission");
                    }
                    else
                    {
                        reqPrx = new ReqProRequirementPrx
                                     ((ReqPro40.Project___v7)rpxRelation.DestinationProject, rpxRelation.DestinationKey);
                    }
                }
                else
                {
                    if (bDoNotRead)
                    {
                        reqPrx = new ReqProRequirementPrx("Key " + rpxRelation.SourceKey, "no permission", "no permission");
                    }
                    else
                    {
                        reqPrx = new ReqProRequirementPrx
                                     ((ReqPro40.Project___v7)rpxRelation.SourceProject, rpxRelation.SourceKey);
                    }
                }
            }
            catch (Exception)
            {
                reqPrx = new ReqProRequirementPrx(null, -1);
            }

            return(reqPrx);
        }
Exemplo n.º 8
0
        public void AddTraceFrom(ReqProRequirementPrx reqReqPrxTraceFrom)
        {
            int nTraceFromCountEnumerated = aReqProReqPrxTracesFrom.GetLength(0);

            if (nTraceFromCount != nTraceFromCountEnumerated)
            {
                /* just if we have already satured the Traces to - the number already contains all traces */
                ReqProRequirementPrx[] aReqProReqPrxTracesFromOld;
                aReqProReqPrxTracesFromOld = aReqProReqPrxTracesFrom;

                aReqProReqPrxTracesFrom = new ReqProRequirementPrx[nTraceFromCountEnumerated + 1];
                for (int i = 0; i < nTraceFromCountEnumerated; i++)
                {
                    aReqProReqPrxTracesFrom[i] = aReqProReqPrxTracesFromOld[i];
                }
                aReqProReqPrxTracesFrom[nTraceFromCountEnumerated] = reqReqPrxTraceFrom;
            }
        }
Exemplo n.º 9
0
        private void AddReq(ReqProRequirementPrx reqReqPrx,
                            int nTraceLevel, int nTraceFromHopCount, int nTraceToHopCount, ulong ulDegreeOffset,
                            ReqProRequirementPrx reqReqPrxTracesPreceder)
        {
            ReqTraceNode reqTraceNode = null;

            ReqProRequirementPrx.eTraceAbortReason eAbort = ReqProRequirementPrx.eTraceAbortReason.eNoAbort;

            if (dictReqKey.ContainsKey(reqReqPrx.Key))
            /* this requirement was already handled */
            {
                reqTraceNode = dictReqKey[reqReqPrx.Key];
                if (reqReqPrxTracesPreceder == null)
                {
                    reqTraceNode.MakeRootNode();
                }
                if (!(reqTraceNode.TunedUp(nTraceFromHopCount, nTraceToHopCount)))
                {
                    return;
                }
            }

            if (reqReqPrxTracesPreceder != null)
            {
                if (listnReqTypeTracedKeyExcl.Contains(reqReqPrx.ReqTypeKey))
                {
                    eAbort |= ReqProRequirementPrx.eTraceAbortReason.eReqTypeFilter;
                    showProgressReqTraceGrid(0, 0, "Filtered: " + reqReqPrx.Tag);
                    return;
                }
            }

            int nTracesTo;
            int nTracesFrom;

            ReqProRequirementPrx[] aTracesTo;
            ReqProRequirementPrx[] aTracesFrom;
            ulong ulDegreeInc = 1UL;

            for (int i = 0; i < (nTraceLevel + nMaxLevelTo); i++)
            {
                ulDegreeInc *= ulLevelMultiplier * ((ulong)nTraceLevel + (ulong)nMaxLevelTo);
            }

            Tracer tracer = new Tracer("Traces from/to Req " + reqReqPrx.Tag);

            aTracesTo   = reqReqPrx.GetRequirementTracesTo(nMaxTraceCount, ref eAbort, out nTracesTo, reqReqPrxTracesPreceder);
            aTracesFrom = reqReqPrx.GetRequirementTracesFrom(nMaxTraceCount, ref eAbort, out nTracesFrom, reqReqPrxTracesPreceder);
            tracer.Stop("Traces from/to Req " + reqReqPrx.Tag);

            if (reqTraceNode == null)
            {
                reqTraceNode = new ReqTraceNode(reqReqPrx, ulDegreeOffset, reqReqPrxTracesPreceder == null,
                                                aTracesFrom, aTracesTo, nTracesFrom, nTracesTo, eAbort, nTraceFromHopCount, nTraceToHopCount);
                dictReqKey.Add(reqReqPrx.Key, reqTraceNode);
                grid[TraceLevel2Index(nTraceLevel)].Add(reqTraceNode);
            }
            else
            {
                reqTraceNode.OnceAgain(ulDegreeOffset, reqReqPrxTracesPreceder == null,
                                       aTracesFrom, aTracesTo, nTracesFrom, nTracesTo, eAbort, nTraceFromHopCount, nTraceToHopCount);
            }

            showProgressReqTraceGrid(0, 1, "Adding: " + reqTraceNode.Tag);

            if (aTracesFrom.GetLength(0) > 0)
            {
                if (nTraceLevel < this.nMaxLevelFrom)
                {
                    if (reqTraceNode.TraceFromHopCount < this.nMaxFromTraceHops)
                    {
                        int   nNextTraceFromHopCount = nTraceFromHopCount;
                        ulong ulLocOffset            = ulDegreeOffset * ulLevelMultiplier;
                        showProgressReqTraceGrid(aTracesFrom.GetLength(0), 0, null);
                        foreach (ReqProRequirementPrx reqReqPrxFrom in aTracesFrom)
                        {
                            if (dictReqKey.ContainsKey(reqReqPrxFrom.Key))
                            {
                                ReqTraceNode reqTN = dictReqKey[reqReqPrxFrom.Key];
                                reqTN.SetRelDegree(ulLocOffset);
                                reqTN.AddTraceTo(reqReqPrx);
                            }
                            else
                            {
                                ulLocOffset += ulDegreeInc;
                                AddReq(reqReqPrxFrom, nTraceLevel + 1, ++nNextTraceFromHopCount, nTraceToHopCount,
                                       ulLocOffset, reqReqPrx);
                            }
                        }
                    }
                    else
                    {
                        System.Diagnostics.Trace.WriteLine("From Hops exceeded at: " + reqReqPrx.TagName);
                        showProgressReqTraceGrid(0, 0, "tracing from hops exceeded at: " + reqTraceNode.Tag);
                        eAbort |= ReqProRequirementPrx.eTraceAbortReason.eMaxFromHopsExceeded;
                    }
                }
                else
                {
                    eAbort |= ReqProRequirementPrx.eTraceAbortReason.eMaxFromLevelReached;
                }
            }


            if (aTracesTo.GetLength(0) > 0)
            {
                if (nTraceLevel > -this.nMaxLevelTo)
                {
                    if (reqTraceNode.TraceToHopCount + 1 <= this.nMaxToTraceHops)
                    {
                        int   nNextTraceToHopCount = reqTraceNode.TraceToHopCount + 1;
                        ulong ulLocOffset          = ulDegreeOffset;
                        showProgressReqTraceGrid(aTracesTo.GetLength(0), 0, null);
                        foreach (ReqProRequirementPrx reqReqPrxTo in aTracesTo)
                        {
                            if (dictReqKey.ContainsKey(reqReqPrxTo.Key))
                            {
                                ReqTraceNode reqTN = dictReqKey[reqReqPrxTo.Key];
                                reqTN.SetRelDegree(ulLocOffset);
                                reqTN.AddTraceFrom(reqReqPrx);
                            }
                            else
                            {
                                ulLocOffset += ulDegreeInc;
                                AddReq(reqReqPrxTo, nTraceLevel - 1, nTraceFromHopCount, nTraceToHopCount,
                                       ulLocOffset, reqReqPrx);
                            }
                        }
                    }
                    else
                    {
                        System.Diagnostics.Trace.WriteLine("To Hops exceeded at: " + reqReqPrx.TagName);
                        showProgressReqTraceGrid(0, 0, "tracing to exceeded at: " + reqTraceNode.Tag);
                        eAbort |= ReqProRequirementPrx.eTraceAbortReason.eMaxToHopsExceeded;
                    }
                }
                else
                {
                    eAbort |= ReqProRequirementPrx.eTraceAbortReason.eMaxToLevelReached;
                }
            }
            reqTraceNode.AbortReason = eAbort;
        }