18 namespace ErrorManagement {
27 private string fileName;
53 get {
return fileName; }
65 get {
return column; }
73 get {
return this.valid; }
86 public Location(
string fileName,
int lineNumber,
int columnNumber) {
87 this.line = lineNumber;
88 this.column = columnNumber;
89 this.fileName = fileName;
106 return "[Cannot stablish location of the element]";
110 #region Equals & HasCode
112 return this.line.GetHashCode() * this.column.GetHashCode() * this.fileName.GetHashCode();
116 public override bool Equals(
object obj) {
117 if (obj ==
this)
return true;
121 if (obj == null)
return false;
123 return this.line == node.line && this.column == node.column && this.fileName.Equals(node.fileName);
126 return new Location(this.fileName, this.line, this.column);
override bool Equals(object obj)
This class encapsulates a location in a specific file. Implements an Inmutable pattern. So it can be used in any context, that is his internal fields never change.
int Column
Gets column where the item is located
int Line
Gets line where the item is located
Location(string fileName, int lineNumber, int columnNumber)
Constructor of Location.
bool Valid
Indicates whether the object state has been created with a coherent state. In case it is false...
override int GetHashCode()
override string ToString()
string FileName
Gets de name of the file