/// <summary> /// Default ctor /// </summary> public DocumentPosition(int startLine, int startCol, int endLine, int endCol, int typeId, int methodId, int methodOffset) { Start = new DocumentPoint(startLine, startCol); End = new DocumentPoint(endLine, endCol); TypeId = typeId; MethodId = methodId; MethodOffset = methodOffset; }
/// <summary> /// XML ctor /// </summary> public DocumentPosition(XElement element) { var startLine = int.Parse(element.GetAttribute("sl")); var startColumn = int.Parse(element.GetAttribute("sc")); var endLine = int.Parse(element.GetAttribute("el") ?? startLine.ToString()); var endColumn = int.Parse(element.GetAttribute("ec") ?? startColumn.ToString()); Start = new DocumentPoint(startLine, startColumn); End = new DocumentPoint(endLine, endColumn); TypeId = int.Parse(element.GetAttribute("ti")); MethodId = int.Parse(element.GetAttribute("mi")); MethodOffset = int.Parse(element.GetAttribute("mo")); }
/// <summary> /// Is there an intersection between the given range and my range? /// </summary> public bool Intersects(int startLine, int startCol, int endLine, int endCol) { var start = new DocumentPoint(startLine, startCol); var end = new DocumentPoint(endLine, endCol); if (this.Start > end) { return(false); } if (this.End < start) { return(false); } return(true); }