예제 #1
0
        public override bool Equals(Object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            PreOccurence other = (PreOccurence)obj;

            if (!Object.Equals(StartLine, other.StartLine))
            {
                return(false);
            }
            if (!Object.Equals(EndLine, other.EndLine))
            {
                return(false);
            }
            if (!string.IsNullOrEmpty(FieldName) && !Object.Equals(FieldName, other.FieldName))
            {
                return(false);
            }
            if (!string.IsNullOrEmpty(VariableName) && !Object.Equals(VariableName, other.VariableName))
            {
                return(false);
            }
            if (!string.IsNullOrEmpty(StringValue) && !Object.Equals(StringValue, other.StringValue))
            {
                return(false);
            }
            if (!string.IsNullOrEmpty(Message) && !Object.Equals(Message, other.Message))
            {
                return(false);
            }

            return(true);
        }
예제 #2
0
        public void AddDefectWithPreOccurence(PreOccurence preOcc)
        {
            if (preOcc.StartLine == -1)
            {
                return;
            }
            bool isNewDefect = true;

            foreach (var defect in DefectList)
            {
                defect.AnalysisType = AnalysisType;

                if (defect.Equals(preOcc))
                {
                    bool IsDifferentOcc = true;
                    foreach (var occ in defect.Occurences)
                    {
                        if (occ.Equals(preOcc))
                        {
                            IsDifferentOcc = false;
                            break;
                        }
                    }
                    if (IsDifferentOcc)
                    {
                        defect.AddOccurence(preOcc.ToOccurence());
                    }
                    isNewDefect = false;
                    break;
                }
            }

            if (isNewDefect)
            {
                Defect defect = preOcc.ToDefect();
                defect.AnalysisType = AnalysisType;
                defect.AddOccurence(preOcc.ToOccurence());
                defectList.Add(defect);
            }
        }