Add Coordinate getter documentation

This commit is contained in:
Marty Oehme 2018-08-30 09:55:25 +02:00
parent 5a72783d57
commit 5725757aa0

View file

@ -21,6 +21,12 @@ class Grid<E> extends DelegatingList<E> {
height = h, height = h,
super(l); super(l);
/// Return element at coordinate position
///
/// Returns the corresponding element after checking the parameters
/// for the correct constraints along the width and height of the grid.
/// Throws [RangeError] if outside of constraints. Preferred method
/// to access elements via coordinates.
E get(int x, int y) { E get(int x, int y) {
int i = toIndex(x, y); int i = toIndex(x, y);
if (i >= length || x > width - 1) throw RangeError.index(i, this); if (i >= length || x > width - 1) throw RangeError.index(i, this);