예제 #1
0
 private void Init(string strTag, string strName, string strText)
 {
     this.strPrefix = "";
     this.strTag    = strTag;
     this.strName   = strName;
     this.strText   = strText;
     rpxReq         = null;
     rpxProject     = null;
     nKey           = -1;
 }
예제 #2
0
 private ReqProRequirementPrx()
 {
     strTag     = "";
     strName    = "";
     strText    = "";
     strPrefix  = "";
     rpxReq     = null;
     rpxProject = null;
     nKey       = -1;
 }
예제 #3
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;
 }
예제 #4
0
        public ReqProRequirementPrx(ReqPro40.Project___v7 rpxProject, int nKey)
        {
            if (rpxProject == null)
            {
                Init("Key " + nKey, "unknown Project", "unknown Project");
            }
            else if (!rpxProject.IsProjectOpen)
            {
                Init("Key " + nKey, "not accessible", "not accessible");
            }
            else
            {
                ReqPro40.Requirement___v6 rpxReq = null;
                Tracer tracer = new Tracer("Req (Key: " + nKey + ")");
                if (rpxReqColl != null)
                {
                    if (rpxProject.Prefix == strHomePrjPrefix)
                    {
                        /* somehow strange - Requirement discovered - but not accessible if it does not belong to the home project */
                        rpxReq = (Requirement___v6)rpxReqColl[nKey, ReqPro40.enumRequirementLookups.eReqLookup_Key];
                    }
                }
                if (rpxReq != null)
                {
                    tracer.Stop("Req " + rpxReq.get_Tag(enumTagFormat.eTagFormat_Tag) + " got via rpxColl []");
                }
                else
                {
                    try
                    {
                        rpxReq = dictReqCache[nKey];
                        dictReqCache.Remove(nKey);
                        dictReqCache.Add(nKey, rpxReq);
                        tracer.Stop("Req " + ((rpxReq != null) ? (rpxReq.get_Tag(enumTagFormat.eTagFormat_Tag)) : ("key " + nKey)) +
                                    " got via ReqCache");
                    }
                    catch (System.Collections.Generic.KeyNotFoundException)
                    {
                        rpxReq = (Requirement___v6)rpxProject.GetRequirement(
                            nKey, ReqPro40.enumRequirementLookups.eReqLookup_Key,
                            ReqPro40.enumRequirementsWeights.eReqWeight_Medium,
                            ReqPro40.enumRequirementFlags.eReqFlag_Empty);
                        dictReqCache.Add(nKey, rpxReq);

                        if (dictReqCache.Count > nReqCacheSize)
                        {
                            foreach (KeyValuePair <int, ReqPro40.Requirement___v6> kvp in dictReqCache)
                            {
                                dictReqCache.Remove(kvp.Key);
                                break;
                            }
                        }
                        tracer.Stop("Req " + ((rpxReq != null) ? (rpxReq.get_Tag(enumTagFormat.eTagFormat_Tag)) : ("key " + nKey)) +
                                    " got via rpxProject.GetRequirement");
                    }
                }
                Init(rpxReq);
            }

            this.rpxProject = rpxProject;
            this.nKey       = nKey;
            strPrefix       = "";

            if (rpxProject != null)
            {
                if (rpxProject.Prefix != strHomePrjPrefix)
                {
                    strPrefix = rpxProject.Prefix;
                }
            }
        }