Class StructureMatrix<T>

java.lang.Object
one.empty3.library.StructureMatrix<T>
All Implemented Interfaces:
Serializable, Serialisable
Direct Known Subclasses:
FileDependent

public class StructureMatrix<T> extends Object implements Serializable, Serialisable
The StructureMatrix class represents a matrix with flexible dimensions and element types. Created by manue on 07-09-19.
See Also:
  • Field Details

  • 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

      public StructureMatrix(int dim, Class classType)
      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 matrix
      classType - the class type for the elements of the matrix
  • Method Details

    • setClassType

      public void setClassType(Class T)
    • init

      public void init(int dim, Class classType)
    • setElem

      public StructureMatrix<T> setElem(@NotNull T value)
      Sets the value of an element in the StructureMatrix.
      Parameters:
      value - the value to set for the element
      Returns:
      the modified StructureMatrix instance
    • setElem

      public void setElem(T elem, int i)
      Sets the value of an element in the StructureMatrix.
      Parameters:
      elem - the value to set for the element
      i - the index of the element to set
    • setElem

      public void setElem(T elem, int i, int j)
      Sets the value of an element in the StructureMatrix.
      Parameters:
      elem - the value to set for the element
      i - the row index of the element
      j - the column index of the element
    • getElem

      public T getElem(int[] indices)
    • getElem

      public T 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

      public T getElem(int i)
      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

      public T getElem(int i, int j)
      Returns the element stored in the StructureMatrix at the given indices.
      Parameters:
      i - the row index of the element
      j - 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

      public T getData0d()
    • getData1d

      public List<T> getData1d()
    • getData2d

      public List<List<T>> getData2d()
    • inBounds

      public boolean inBounds(int i, int j)
    • inBounds

      public boolean inBounds(int i)
    • insert

      public void insert(int pos, int rowCol, T value)
    • delete

      public void delete(int pos, int rowCol)
    • delete

      public void delete(int pos)
    • insert

      public void insert(int i, T value)
    • add

      public void add(int dim, T value)
    • add

      public void add(T value)
    • addRow

      public void addRow()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getDim

      public int getDim()
    • setDim

      public void setDim(int dim)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toStringLine

      public String toStringLine()
    • getClassType

      public Class getClassType()
    • setAll

      public void setAll(T[] all)
    • setAll

      public void setAll(T[][] all)
    • setAll

      public void setAll(ArrayList<T> all)
    • reset

      public void reset()
    • addListener

      public void addListener(StructureMatrixListener listener)
    • deleteListener

      public void deleteListener(StructureMatrixListener listener)
    • copy

      Throws:
      IllegalAccessException
      CopyRepresentableError
      InstantiationException
    • decode

      public Serialisable decode(DataInputStream in)
      Specified by:
      decode in interface Serialisable
    • encode

      public int encode(DataOutputStream out)
      Specified by:
      encode in interface Serialisable
    • type

      public int type()
      Specified by:
      type in interface Serialisable