From 04d88d55be79b7673a63c23214f232527b7d7ce4 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Mon, 19 Sep 2011 22:17:33 +0200 Subject: [PATCH] Add IsDeleted and Equals() implementation to IDocumentLine. --- .../Editor/IDocumentLine.cs | 5 +++++ .../Editor/ReadOnlyDocument.cs | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/IDocumentLine.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/IDocumentLine.cs index 0471509fdd..5be25cd028 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/IDocumentLine.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/IDocumentLine.cs @@ -51,5 +51,10 @@ namespace ICSharpCode.NRefactory.Editor /// Gets the next line. Returns null if this is the last line in the document. /// IDocumentLine NextLine { get; } + + /// + /// Gets whether the line was deleted. + /// + bool IsDeleted { get; } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ReadOnlyDocument.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ReadOnlyDocument.cs index 0d5e810065..40c61085e7 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ReadOnlyDocument.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ReadOnlyDocument.cs @@ -84,6 +84,17 @@ namespace ICSharpCode.NRefactory.Editor this.endOffset = doc.GetEndOffset(lineNumber); } + public override int GetHashCode() + { + return doc.GetHashCode() ^ lineNumber; + } + + public override bool Equals(object obj) + { + ReadOnlyDocumentLine other = obj as ReadOnlyDocumentLine; + return other != null && doc == other.doc && lineNumber == other.lineNumber; + } + public int Offset { get { return offset; } } @@ -129,6 +140,10 @@ namespace ICSharpCode.NRefactory.Editor return new ReadOnlyDocumentLine(doc, lineNumber + 1); } } + + public bool IsDeleted { + get { return false; } + } } int GetStartOffset(int lineNumber)