|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@UML(identifier="GM_PointGrid", specification=ISO_19107) public interface PointGrid
A grid of points. The grid may be see as a sequences of equal length point arrays. While a point grid conceptually contains positions, it provides convenience methods for fetching directly the direct positions instead.
Position
,
PointArray
Method Summary | |
---|---|
DirectPosition |
get(int row,
int column)
Returns the point at the given row and column index. |
DirectPosition |
get(int row,
int column,
DirectPosition dest)
Gets a copy of the DirectPosition at the particular location in this
PointGrid . |
PointArray |
getRow(int row)
Returns the row at the given index. |
int |
height()
Returns the length of this array. |
List<PointArray> |
rows()
Returns a view of all rows in this array. |
void |
set(int row,
int column,
DirectPosition position)
Set the point at the given index. |
int |
width()
Returns the width of this grid. |
Method Detail |
---|
@Extension int width()
PointArray.length()
@Extension int height()
rows().length()
.
@Extension DirectPosition get(int row, int column) throws IndexOutOfBoundsException
getRow(row).get(column)
.
row
- The row index from 0 inclusive to height()
exclusive.column
- The column index from 0 inclusive to width()
exclusive.
IndexOutOfBoundsException
- if an index is out of bounds.@Extension DirectPosition get(int row, int column, DirectPosition dest) throws IndexOutOfBoundsException
DirectPosition
at the particular location in this
PointGrid
. If the dest
argument is non-null, that object
will be populated with the value from the array. In all cases, the position in insulated
from changes in the PointArray
, and vice-versa. Consequently, the same
DirectPosition
object can be reused for fetching many points from this grid.
Example:
DirectPosition position = null; for (int j=0; j<grid.height(); j++) { for (int i=0; i<grid.width(); i++) { position = array.get(j, i, position); // Do some processing... } }
row
- The row index from 0 inclusive to height()
exclusive.column
- The column index from 0 inclusive to width()
exclusive.dest
- An optionnaly pre-allocated direct position.
dest
argument, or a new object if dest
was null.
IndexOutOfBoundsException
- if an index is out of bounds.@Extension void set(int row, int column, DirectPosition position) throws IndexOutOfBoundsException, UnsupportedOperationException
position
after this method call will not be reflected into
this point array. Consequently, the same DirectPosition
object can be
reused for setting many points in this array.
row
- The row index from 0 inclusive to height()
exclusive.column
- The column index from 0 inclusive to width()
exclusive.position
- The point to set at the given location in this array.
IndexOutOfBoundsException
- if an index is out of bounds.
UnsupportedOperationException
- if this grid is immutable.@Extension PointArray getRow(int row) throws IndexOutOfBoundsException
PointGrid
, so changes to the row
are reflected in the grid, and vice-versa.
row
- The index from 0 inclusive to height()
exclusive.
IndexOutOfBoundsException
- if the index is out of bounds.@UML(identifier="row", obligation=MANDATORY, specification=ISO_19107) List<PointArray> rows()
PointGrid
, so changes to any
point array are reflected in the grid, and vice-versa.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |