Package one.empty3.library
Class StructureMatrix<T>
java.lang.Object
one.empty3.library.StructureMatrix<T>
- All Implemented Interfaces:
Serializable
,Serialisable
- Direct Known Subclasses:
FileDependent
The StructureMatrix class represents a matrix with flexible dimensions and element types.
Created by manue on 07-09-19.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionThe StructureMatrix class represents a matrix with a specific data type.StructureMatrix
(int dim, Class classType) The StructureMatrix class represents a matrix with a specific data type. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
addListener
(StructureMatrixListener listener) void
addRow()
copy()
void
delete
(int pos) void
delete
(int pos, int rowCol) void
deleteListener
(StructureMatrixListener listener) int
encode
(DataOutputStream out) boolean
int
getDim()
getElem()
Returns the element stored in the StructureMatrix.getElem
(int i) Returns the element stored in the StructureMatrix at the given index.getElem
(int[] indices) getElem
(int i, int j) Returns the element stored in the StructureMatrix at the given indices.int
hashCode()
boolean
inBounds
(int i) boolean
inBounds
(int i, int j) void
void
void
void
reset()
void
void
void
void
void
setDim
(int dim) Sets the value of an element in the StructureMatrix.void
Sets the value of an element in the StructureMatrix.void
Sets the value of an element in the StructureMatrix.toString()
int
type()
-
Field Details
-
INSERT_ROW
public static final int INSERT_ROW- See Also:
-
INSERT_COL
public static final int INSERT_COL- See Also:
-
data0d
-
data1d
-
data2d
-
-
Constructor Details
-
StructureMatrix
public StructureMatrix()The StructureMatrix class represents a matrix with a specific data type. It is used to store and manipulate data in a matrix-like form. The matrix can have a variable dimension and a specific class type for its elements. -
StructureMatrix
The StructureMatrix class represents a matrix with a specific data type. It is used to store and manipulate data in a matrix-like form. The matrix can have a variable dimension and a specific class type for its elements.- Parameters:
dim
- the dimension of the matrixclassType
- the class type for the elements of the matrix
-
-
Method Details
-
setClassType
-
init
-
setElem
Sets the value of an element in the StructureMatrix.- Parameters:
value
- the value to set for the element- Returns:
- the modified StructureMatrix instance
-
setElem
Sets the value of an element in the StructureMatrix.- Parameters:
elem
- the value to set for the elementi
- the index of the element to set
-
setElem
Sets the value of an element in the StructureMatrix.- Parameters:
elem
- the value to set for the elementi
- the row index of the elementj
- the column index of the element
-
getElem
-
getElem
Returns the element stored in the StructureMatrix.- Returns:
- the element stored in the StructureMatrix, or null if the dimension of the matrix is 0 or if the element is not set
- Throws:
UnsupportedOperationException
- if the dimension of the matrix is not 0
-
getElem
Returns the element stored in the StructureMatrix at the given index.- Parameters:
i
- the index of the element to retrieve- Returns:
- the element stored in the StructureMatrix at the given index, or null if the dimension of the matrix is not 1
-
getElem
Returns the element stored in the StructureMatrix at the given indices.- Parameters:
i
- the row index of the elementj
- the column index of the element- Returns:
- the element stored in the StructureMatrix at the given indices, or null if the dimension of the matrix is not 2 or if the indices are out of bounds
-
getData0d
-
getData1d
-
getData2d
-
inBounds
public boolean inBounds(int i, int j) -
inBounds
public boolean inBounds(int i) -
insert
-
delete
public void delete(int pos, int rowCol) -
delete
public void delete(int pos) -
insert
-
add
-
add
-
addRow
public void addRow() -
equals
-
hashCode
public int hashCode() -
getDim
public int getDim() -
setDim
public void setDim(int dim) -
toString
-
toStringLine
-
getClassType
-
setAll
-
setAll
-
setAll
-
reset
public void reset() -
addListener
-
deleteListener
-
copy
public StructureMatrix<T> copy() throws IllegalAccessException, CopyRepresentableError, InstantiationException -
decode
- Specified by:
decode
in interfaceSerialisable
-
encode
- Specified by:
encode
in interfaceSerialisable
-
type
public int type()- Specified by:
type
in interfaceSerialisable
-