master
1namespace Notepad.Domain.FileSystem {
2 public class AbsoluteFilePath : IFilePath {
3 private readonly string rawFilePath;
4
5 public AbsoluteFilePath(string rawFilePath) {
6 this.rawFilePath = rawFilePath;
7 }
8
9 public string RawPathToFile() {
10 return rawFilePath;
11 }
12
13 public bool Equals(IFilePath other) {
14 if (ReferenceEquals(null, other)) {
15 return false;
16 }
17 return ReferenceEquals(this, other) || Equals(other.RawPathToFile(), rawFilePath);
18 }
19
20 public override bool Equals(object other) {
21 if (ReferenceEquals(null, other)) {
22 return false;
23 }
24 if (ReferenceEquals(this, other)) {
25 return true;
26 }
27 return other.GetType() == typeof (AbsoluteFilePath) && Equals((AbsoluteFilePath) other);
28 }
29
30 public override int GetHashCode() {
31 return (rawFilePath != null ? rawFilePath.GetHashCode() : 0);
32 }
33 }
34}