Class ObjectMatrixFactory
- java.lang.Object
-
- com.singularsys.extensions.matrix.genericmat.GenericMatrixFactory<java.lang.Object>
-
- com.singularsys.extensions.matrix.objectmat.ObjectMatrixFactory
-
- All Implemented Interfaces:
MatrixFactoryI,JepComponent,java.io.Serializable
public class ObjectMatrixFactory extends GenericMatrixFactory<java.lang.Object>
An implementation of vectors and matrices where elements are Objects. To set up useMatrixFactoryI mfac = new ObjectMatrixFactory(); MatrixFieldI mf = new SimpleMatrixField(mfac); MatrixOperatorTable opTab = new MatrixOperatorTable(mfac, mf); MatrixFunctionTable mftab = new MatrixFunctionTable(mfac, mf); jep = new Jep(opTab,mftab);- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.singularsys.extensions.matrix.genericmat.GenericMatrixFactory
ONE, ZERO
-
-
Constructor Summary
Constructors Constructor Description ObjectMatrixFactory()ObjectMatrixFactory(FieldI f)ObjectMatrixFactory(java.lang.Object zero, java.lang.Object one)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object[]buildDataArray(int len)Build a data array.java.lang.Object[][]buildDataArray(int rows, int cols)Build a data array.ObjectMatrixcast(MatrixI m)A typical implementation will just usereturn (GenericMatrix<E>) m;ObjectVectorcast(VectorI v)A typical implementation will just usereturn (V) v;java.lang.ObjectelementValue(java.lang.Object o)Convert the element o to type E.JepComponentgetLightWeightInstance()Returns thisObjectMatrixnewMatrixUnchecked(java.lang.Object[][] data)ObjectVectornewVectorUnchecked(java.lang.Object[] data)-
Methods inherited from class com.singularsys.extensions.matrix.genericmat.GenericMatrixFactory
getONE, identity, identity, init, newMatrix, newVector, zeroEement, zeroMat, zeroMat, zeroMat, zeroVec
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.singularsys.extensions.matrix.MatrixFactoryI
zeroVec
-
-
-
-
Constructor Detail
-
ObjectMatrixFactory
public ObjectMatrixFactory()
-
ObjectMatrixFactory
public ObjectMatrixFactory(java.lang.Object zero, java.lang.Object one)
-
ObjectMatrixFactory
public ObjectMatrixFactory(FieldI f)
-
-
Method Detail
-
buildDataArray
public java.lang.Object[][] buildDataArray(int rows, int cols)Description copied from class:GenericMatrixFactoryBuild a data array. A typical concrete implementation will just usereturn new E[rows][cols].- Overrides:
buildDataArrayin classGenericMatrixFactory<java.lang.Object>- Parameters:
rows- number of rowscols- number of cols- Returns:
- the array.
-
buildDataArray
public java.lang.Object[] buildDataArray(int len)
Description copied from class:GenericMatrixFactoryBuild a data array. A typical concrete implementation will just usereturn new E[rows][len].- Overrides:
buildDataArrayin classGenericMatrixFactory<java.lang.Object>- Parameters:
len- number of elements- Returns:
- the array.
-
elementValue
public java.lang.Object elementValue(java.lang.Object o)
Description copied from class:GenericMatrixFactoryConvert the element o to type E. A typical implementation will just usepublic abstract E elementValue(Object o) { if(o instance of E) return (E) o; return null; }- Specified by:
elementValuein interfaceMatrixFactoryI- Overrides:
elementValuein classGenericMatrixFactory<java.lang.Object>- Parameters:
o- value to convert- Returns:
- the value cast to type E or null if the type cannot be converted.
-
cast
public ObjectMatrix cast(MatrixI m)
Description copied from class:GenericMatrixFactoryA typical implementation will just usereturn (GenericMatrix<E>) m;- Overrides:
castin classGenericMatrixFactory<java.lang.Object>- Parameters:
m- the matrix to cast- Returns:
- a matrix of type GenericMatrix<E> = GenericMatrix<E>
-
cast
public ObjectVector cast(VectorI v)
Description copied from class:GenericMatrixFactoryA typical implementation will just usereturn (V) v;- Overrides:
castin classGenericMatrixFactory<java.lang.Object>- Parameters:
v- the vector to cast- Returns:
- a vector of type V = GenericVector<E>
-
newMatrixUnchecked
public ObjectMatrix newMatrixUnchecked(java.lang.Object[][] data)
- Overrides:
newMatrixUncheckedin classGenericMatrixFactory<java.lang.Object>
-
newVectorUnchecked
public ObjectVector newVectorUnchecked(java.lang.Object[] data)
- Overrides:
newVectorUncheckedin classGenericMatrixFactory<java.lang.Object>
-
getLightWeightInstance
public JepComponent getLightWeightInstance()
Returns this- Specified by:
getLightWeightInstancein interfaceJepComponent- Overrides:
getLightWeightInstancein classGenericMatrixFactory<java.lang.Object>- Returns:
- either an new instance, null or 'this'.
-
-