@Equality public class MatrixShape extends Object implements Iterable<MatrixShape.Cell>
Modifier and Type | Class and Description |
---|---|
static class |
MatrixShape.Cell
Represents one cell in a 2x2 matrix.
|
Constructor and Description |
---|
MatrixShape(int nx)
Constructs a MatrixShape containing all cells in the matrix.
|
MatrixShape(int nx,
boolean hasDiagonal,
boolean hasLower,
boolean hasUpper)
Constructs a MatrixShape containing selected cells.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
MatrixShape.Cell |
getCell(int icell)
Returns the cell at a given position in this shapes list of cells.
|
int |
getCellCount()
Returns the number of cells in this shape.
|
int |
getIndex(int ix,
int iy)
Returns the index of the cell at a given X,Y position.
|
int |
getIndex(MatrixShape.Cell cell)
Returns the index of a given cell.
|
int |
getWidth()
Returns the linear size of this matrix.
|
boolean |
hasDiagonal()
Indicates whether this shape contains cells on the diagonal.
|
int |
hashCode() |
boolean |
hasLower()
Indicates whether this shape contains cells below the diagonal.
|
boolean |
hasUpper()
Indicates whether this shape contains cells above the diagonal.
|
Iterator<MatrixShape.Cell> |
iterator()
Returns an iterator over this shape's cells.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public MatrixShape(int nx, boolean hasDiagonal, boolean hasLower, boolean hasUpper)
nx
- linear size of matrixhasDiagonal
- true iff list includes cells on the diagonal
(x==y)hasLower
- true iff list includes cells below the diagonal
(x>y)hasUpper
- true iff list includes cells above the diagonal
(x<y)public MatrixShape(int nx)
nx
- linear size of matrixpublic int getWidth()
public boolean hasDiagonal()
public boolean hasLower()
public boolean hasUpper()
public int getCellCount()
public int getIndex(int ix, int iy)
ix
- X indexiy
- Y indexpublic int getIndex(MatrixShape.Cell cell)
cell
- cellpublic MatrixShape.Cell getCell(int icell)
icell
- cell indexpublic Iterator<MatrixShape.Cell> iterator()
iterator
in interface Iterable<MatrixShape.Cell>
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.