8using System.Collections.Generic;
17 private readonly
Address startAddress;
18 private readonly
Address endAddress;
39 this.startAddress = start;
40 this.endAddress = end;
44 this.startAddress = end;
45 this.endAddress = start;
57 public Range(
int startColumn,
int startRow,
int endColumn,
int endRow) : this(new
Address(startColumn, startRow), new
Address(endColumn, endRow))
89 return this.StartAddress.Column <= other.StartAddress.Column &&
90 this.EndAddress.Column >= other.EndAddress.Column &&
91 this.StartAddress.Row <= other.StartAddress.Row &&
102 return address.Column >= this.startAddress.Column &&
103 address.Column <= this.endAddress.Column &&
104 address.Row >= this.startAddress.Row &&
105 address.Row <= this.endAddress.Row;
115 return !(this.EndAddress.Row < other.StartAddress.Row || this.StartAddress.Row > other.EndAddress.Row ||
116 this.EndAddress.Column < other.StartAddress.Column || this.StartAddress.Column > other.
EndAddress.
Column);
127 IEnumerable<Address> range =
Cell.
GetCellRange(this.StartAddress, this.EndAddress);
128 return new List<Address>(range);
162 return this.
ToString().GetHashCode();
176 return range1.
Equals(range2);
187 return !range1.
Equals(range2);
195 internal Range Copy()
197 return new Range(this.StartAddress.Copy(),
this.EndAddress.Copy());
Class representing a cell of a worksheet.
static Range ResolveCellRange(string range)
Resolves a cell range from the format like A1:B3 or AAD556:AAD1000.
static IEnumerable< Address > GetCellRange(string range)
Gets a list of cell addresses from a cell range (format A1:B3 or AAD556:AAD1000).
Struct representing the cell address as column and row (zero based).
int CompareTo(Address other)
Compares two addresses using the column and row numbers.
int Row
Row number (zero based).
bool Equals(Address other)
Compares two addresses whether they are equal.
int Column
Column number (zero based).
Struct representing a cell range with a start and end address.
Range(string range)
Constructor with a range string as argument. The addresses are automatically swapped if the start add...
Range(int startColumn, int startRow, int endColumn, int endRow)
Constructor with start and end rows and columns as arguments. The addresses are automatically swapped...
bool Contains(Range other)
Gets whether another range is completely enclosed by this range.
override string ToString()
Overwritten ToString method.
IReadOnlyList< Address > ResolveEnclosedAddresses()
Gets a list of all addresses between the start and end address.
Range(Address start, Address end)
Constructor with addresses as arguments. The addresses are automatically swapped if the start address...
static bool operator==(Range range1, Range range2)
Compares two objects whether they are ranges and equal. The cell types (possible $ prefix) are consid...
Address StartAddress
Start address of the range.
static bool operator!=(Range range1, Range range2)
Compares two objects whether they not equal. This method reflects the inverted method of Equals(objec...
bool Contains(Address address)
Determines whether an address is within this range.
override int GetHashCode()
Gets the hash code of the range object according to its string representation.
Address EndAddress
End address of the range.
override bool Equals(object obj)
Compares two objects whether they are ranges and equal. The cell types (possible $ prefix) are consid...
bool Overlaps(Range other)
Determines whether the passed range overlaps with this range.