Beispiel #1
0
        public bool Equals(SourceLocationInfo source)
        {
            if (Count == source.GetRecords().Count)
            {
                bool result = true;
                for (int i = 0; i < Count; i++)
                {
                    result = result && this[i].Equals(source.GetRecords()[i]);
                }
                return(result);
            }

            // handling the case where the verifier ignores header and we don't
            // refer OpenCL/atomics/refined_atomic_abstraction/access_in_loop as an example
            if (source.GetRecords().Count == 1)
            {
                SourceLocationInfo.Record record = source.GetRecords().First();
                if (this.Count(x => x.File == record.GetFile()) == 1)
                {
                    return(this.First(x => x.File == record.GetFile()).Equals(record));
                }
            }

            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// Determines whether the specified object is equal to the current object.
        /// </summary>
        /// <param name="obj">The object to compare with the current object.</param>
        /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
        public override bool Equals(object obj)
        {
            if (obj is Location)
            {
                Location location = obj as Location;
                return(Directory == location.Directory && File == location.File && Line == location.Line && Column == location.Column);
            }
            else if (obj is SourceLocationInfo.Record)
            {
                SourceLocationInfo.Record source = obj as SourceLocationInfo.Record;
                return(source.GetDirectory() == Directory && source.GetFile() == File &&
                       source.GetLine() == Line && source.GetColumn() == Column);
            }

            return(false);
        }