//
// OpenCover - S Wilde
//
// This source code is released under the MIT License; see the accompanying license file.
//
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace OpenCover.Framework.Model
{
///
/// a sequence point
///
public class SequencePoint : InstrumentationPoint, IDocumentReference
{
///
/// The start line of the sequence point
///
[XmlAttribute("sl")]
public int StartLine { get; set; }
///
/// The start column of the sequence point
///
[XmlAttribute("sc")]
public int StartColumn { get; set; }
///
/// The end line of the sequence point
///
[XmlAttribute("el")]
public int EndLine { get; set; }
///
/// The end column of the sequence point
///
[XmlAttribute("ec")]
public int EndColumn { get; set; }
///
/// Count of merged branches
///
///
/// The number of branch exits
///
[XmlAttribute("bec")]
public int BranchExitsCount { get; set; }
///
/// Visit count of merged branches
///
[XmlAttribute("bev")]
public int BranchExitsVisit { get; set; }
///
/// The file associated with the supplied startline
///
[XmlAttribute("fileid")]
public uint FileId { get; set; }
///
/// The url to the document if an entry was not mapped to an id
///
[XmlAttribute("url")]
public string Document { get; set; }
internal List BranchPoints {
get{
return _branchPoints;
}
set{
_branchPoints = value ?? new List();
}
}
private List _branchPoints = new List();
///
/// Property
///
public bool IsSingleCharSequencePoint {
get {
return (StartLine == EndLine) && (EndColumn - StartColumn) == 1;
}
}
///
/// SonnarQube wants no more than 3 boolean conditions
///
///
///
private bool IsLineEqual (SequencePoint sp) {
return StartLine == sp.StartLine && EndLine == sp.EndLine;
}
///
/// SonnarQube wants no more than 3 boolean conditions
///
///
///
private bool IsColumnEqual (SequencePoint sp) {
return StartColumn == sp.StartColumn && EndColumn == sp.EndColumn;
}
///
/// Is Start/End Line/Column equal
///
///
///
public bool IsPositionEqual (SequencePoint sp) {
return sp != null && IsLineEqual (sp) && IsColumnEqual (sp);
}
///
/// Is FileId equal? (If FileId is 0 then file is unknown)
///
///
///
public bool IsFileIdEqual (SequencePoint sp) {
return sp != null && FileId != 0 && FileId == sp.FileId;
}
}
}