Package overit.geocall.util
Class DynamicMatrix
java.lang.Object
overit.geocall.util.DynamicMatrix
- All Implemented Interfaces:
Matrix
Auxiliary class that implements the interface
Matrix and must be used
to create and manage a dynamic matrix. To set the width and height of the matrix
must be set the element in a cell; so the matrix will be enlarged if the necessary.
It is possible set a single element or more elements passing a Matrix
or a SimpleMatrix. It is also possible to obtain a SimpleMatrix
using the method toSimpleMatrix() .-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget(int x, int y) Gets the element presents in the matrix in row'x'and in column'y'.intGets the height of the matrix.intgetWidth()Gets the width of the matrix.voidSets the element in the matrix to row'x'and in column'y'.voidSets the elements in the matrix starting from the element to row'x'and column'y'.voidset(int x, int y, SimpleMatrix dm) Sets the elements in the matrix starting from the element to row'x'and column'y'.Creates aSimpleMatrixof equal height and width of theDynamicMatrixand fill it with the element present in this matrix.
-
Field Details
-
_hm
-
_w
protected int _w -
_h
protected int _h
-
-
Constructor Details
-
DynamicMatrix
public DynamicMatrix()Empty constructor
-
-
Method Details
-
set
Sets the element in the matrix to row'x'and in column'y'. If the indeces are better of the width and/or height, the matrix is enlarged to admit these indices. -
set
Sets the elements in the matrix starting from the element to row'x'and column'y'. Each element in the inputMatrixis copied to theDynamicMatrixby re-mapping it: it is translated by'x'rows and'y'columns.- Parameters:
x- The rowy- The columndm- TheMatrixto copy
-
set
Sets the elements in the matrix starting from the element to row'x'and column'y'. Each element in the inputSimpleMatrixis copied to theDynamicMatrixby re-mapping it: it is translated by'x'rows and'y'columns.- Parameters:
x- The rowy- The columndm- TheSimpleMatrixto copy
-
get
Gets the element presents in the matrix in row'x'and in column'y'. The indeces start from'0' -
getWidth
public int getWidth()Gets the width of the matrix. -
getHeight
public int getHeight()Gets the height of the matrix. -
toSimpleMatrix
Creates aSimpleMatrixof equal height and width of theDynamicMatrixand fill it with the element present in this matrix.- Returns:
- The
SimpleMatrixgenerated and filled.
-