Package org.djunits.vecmat.table
Class AbsQuantityTable<A extends AbsQuantity<A,Q,?>,Q extends Quantity<Q>>
java.lang.Object
org.djunits.vecmat.def.AbsVectorMatrix<A,Q,MA,MQ,MAT>
org.djunits.vecmat.def.AbsTable<A,Q,AbsQuantityTable<A,Q>,QuantityTable<Q>,AbsQuantityTable<A,Q>>
org.djunits.vecmat.table.AbsQuantityTable<A,Q>
- Type Parameters:
A- the absolute quantity typeQ- the corresponding relative quantity type
- All Implemented Interfaces:
Serializable,Value<AbsQuantityTable<A,Q>, Q>
public class AbsQuantityTable<A extends AbsQuantity<A,Q,?>,Q extends Quantity<Q>>
extends AbsTable<A,Q,AbsQuantityTable<A,Q>,QuantityTable<Q>,AbsQuantityTable<A,Q>>
AbsQuantityTable implements a table containing absolute quantities with a reference point. The table is immutable, except for
the display unit, which can be changed.
Copyright (c) 2026-2026 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djunits.org. The DJUNITS project is distributed under a three-clause BSD-style license.
- Author:
- Alexander Verbraeck
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAbsQuantityTable(QuantityTable<Q> relativeTable, Reference<?, A, Q> reference) Create a new AbsQuantityTable with a display unit and a reference point. -
Method Summary
Modifier and TypeMethodDescriptionformat()Concise description of this quantity table.format(TableFormat format) String representation of this quantity table after applying the format.String representation of this quantity table, expressed in the specified unit.getColumnVector(int col) Return a quantity column (0-based) from the vector or matrix.getRowVector(int row) Return a quantity row (0-based) from the vector or matrix.instantiate(QuantityTable<Q> relativeTable, Reference<?, A, Q> reference) Return a new vector or matrix with the given SI or BASE values for the relative vector or matrix.mgetColumnVector(int mCol) Return a quantity column (1-based) from the vector or matrix.mgetRowVector(int mRow) Return a quantity row (1-based) from the vector or matrix.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsQuantityTable<A,Q> Create a new AbsQuantityTable with a unit, based on a 2-dimensional grid with values in the given unit.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsQuantityTable<A,Q> Create a new AbsQuantityTable with a unit, based on a row-major array with values in the given unit.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsQuantityTable<A,Q> of(A[][] absGrid) Create a AbsQuantityTable without needing generics, based on a 2-dimensional grid of absolute quantities.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsQuantityTable<A,Q> of(A[] absData, int rows, int cols) Create a AbsQuantityTable without needing generics, based on a row-major array of absolute quantities.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsQuantityTable<A,Q> of(QuantityTable<Q> relativeTable, R reference) Create a AbsQuantityTable without needing generics, based on a relative table.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsQuantityTable<A,Q> of(Q[][] grid, R reference) Create a AbsQuantityTable without needing generics, based on a 2-dimensional grid of quantities.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsQuantityTable<A,Q> of(Q[] data, int rows, int cols, R reference) Create a AbsQuantityTable without needing generics, based on a row-major array of quantities.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsQuantityTable<A,Q> Create a new AbsQuantityTable with a unit, based on a 2-dimensional grid with SI-values.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsQuantityTable<A,Q> Create a AbsQuantityTable without needing generics, based on a row-major array with SI-values.Return a transposed absolute vector or matrix, where rows and columns have been swapped.Methods inherited from class org.djunits.vecmat.def.AbsTable
get, getColumnScalars, getColumnSi, getRowScalars, getRowSi, getScalarArray, getScalarGrid, getSiArray, getSiGrid, mget, mgetColumnScalars, mgetColumnSi, mgetRowScalars, mgetRowSi, msi, siMethods inherited from class org.djunits.vecmat.def.AbsVectorMatrix
add, add, asAbsMatrix1x1, asAbsMatrix2x2, asAbsMatrix3x3, asAbsMatrixNxM, asAbsMatrixNxN, asAbsQuantityTable, asAbsVector1, asAbsVector2Col, asAbsVector2Row, asAbsVector3Col, asAbsVector3Row, asAbsVectorNCol, asAbsVectorNRow, checkCol, checkRow, cols, equals, getDisplayUnit, getReference, getRelativeVecMat, hashCode, instantiateSi, isRelative, max, mcheckCol, mcheckRow, median, min, rows, setDisplayUnit, subtract, subtract, subtract, subtract, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djunits.value.Value
isAbsolute, setDisplayUnit
-
Constructor Details
-
AbsQuantityTable
Create a new AbsQuantityTable with a display unit and a reference point.- Parameters:
relativeTable- the table values {a_ij} expressed in the displayUnitreference- the reference point for the absolute values
-
-
Method Details
-
instantiate
public AbsQuantityTable<A,Q> instantiate(QuantityTable<Q> relativeTable, Reference<?, A, Q> reference) Description copied from class:AbsVectorMatrixReturn a new vector or matrix with the given SI or BASE values for the relative vector or matrix.- Specified by:
instantiatein classAbsVectorMatrix<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, QuantityTable<Q extends Quantity<Q>>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>> - Parameters:
relativeTable- the underlying relative vector or matrix with SI values relative to the reference pointreference- the reference point for the relative SI values- Returns:
- a new matrix with the provided SI or BASE values
-
getRowVector
Description copied from class:AbsTableReturn a quantity row (0-based) from the vector or matrix. Note that the specific vector to return can be tightened by the implementing class.- Specified by:
getRowVectorin classAbsTable<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, QuantityTable<Q extends Quantity<Q>>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>> - Parameters:
row- the row number to retrieve (0-based)- Returns:
- a row vector with the data at the given row
-
mgetRowVector
Description copied from class:AbsTableReturn a quantity row (1-based) from the vector or matrix. Note that the specific vector to return can be tightened by the implementing class.- Specified by:
mgetRowVectorin classAbsTable<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, QuantityTable<Q extends Quantity<Q>>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>> - Parameters:
mRow- the row number to retrieve (1-based)- Returns:
- a row vector with the data at the given row
-
getColumnVector
Description copied from class:AbsTableReturn a quantity column (0-based) from the vector or matrix. Note that the specific vector to return can be tightened by the implementing class.- Specified by:
getColumnVectorin classAbsTable<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, QuantityTable<Q extends Quantity<Q>>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>> - Parameters:
col- the column number to retrieve (0-based)- Returns:
- a column vector with the data at the given column
-
mgetColumnVector
Description copied from class:AbsTableReturn a quantity column (1-based) from the vector or matrix. Note that the specific vector to return can be tightened by the implementing class.- Specified by:
mgetColumnVectorin classAbsTable<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, QuantityTable<Q extends Quantity<Q>>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>> - Parameters:
mCol- the column number to retrieve (1-based)- Returns:
- a column vector with the data at the given column
-
transpose
Description copied from class:AbsVectorMatrixReturn a transposed absolute vector or matrix, where rows and columns have been swapped.- Specified by:
transposein classAbsVectorMatrix<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, QuantityTable<Q extends Quantity<Q>>, AbsQuantityTable<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>> - Returns:
- a transposed absolute vector or matrix, where rows and columns have been swapped
-
of
public static <A extends AbsQuantity<A,Q, AbsQuantityTable<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(double[] dataInUnit, int rows, int cols, Unit<?, Q> unit, R reference) Create a new AbsQuantityTable with a unit, based on a row-major array with values in the given unit.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
dataInUnit- the table values {a11, a12, ..., A1M, ..., aN1, aN2, ..., aNM} expressed in the unitrows- the number of rowscols- the number of columnsunit- the unit of the data, also used as the display unitreference- the reference point for the absolute quantities- Returns:
- a new AbsQuantityTable with a unit
- Throws:
IllegalArgumentException- when the size of the data object is not equal to rows*cols, or when the number of rows or columns is not positive
-
ofSi
public static <A extends AbsQuantity<A,Q, AbsQuantityTable<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> ofSi(double[] dataSi, int rows, int cols, Unit<?, Q> displayUnit, R reference) Create a AbsQuantityTable without needing generics, based on a row-major array with SI-values.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
dataSi- the table values {a11, a12, ..., A1M, ..., aN1, aN2, ..., aNM} as an array using SI unitsrows- the number of rowscols- the number of columnsdisplayUnit- the display unit to usereference- the reference point for the absolute quantities- Returns:
- a new AbsQuantityTable with a unit
- Throws:
IllegalArgumentException- when the size of the data object is not equal to rows*cols, or when the number of rows or columns is not positive
-
of
public static <A extends AbsQuantity<A,Q, AbsQuantityTable<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(Q[] data, int rows, int cols, R reference) Create a AbsQuantityTable without needing generics, based on a row-major array of quantities. The unit is taken from the first quantity in the array.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
data- the table values {a11, a12, ..., A1M, ..., aN1, aN2, ..., aNM} expressed as an array of quantitiesrows- the number of rowscols- the number of columnsreference- the reference point for the absolute quantities- Returns:
- a new AbsQuantityTable with a unit
- Throws:
IllegalArgumentException- when the size of the data object is not equal to rows*cols, or when the number of rows or columns is not positive
-
of
public static <A extends AbsQuantity<A,Q, AbsQuantityTable<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(A[] absData, int rows, int cols) Create a AbsQuantityTable without needing generics, based on a row-major array of absolute quantities. The unit is taken from the first quantity in the grid. The reference points have to be all the same.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
absData- the table values {a11, a12, ..., A1M, ..., aN1, aN2, ..., aNM} expressed as an array of absolute quantitiesrows- the number of rowscols- the number of columns- Returns:
- a new AbsQuantityTable with a display unit and reference point
- Throws:
IllegalArgumentException- when the size of the data object is not equal to rows*cols
-
ofSi
public static <A extends AbsQuantity<A,Q, AbsQuantityTable<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> ofSi(double[][] gridSi, Unit<?, Q> displayUnit, R reference) Create a new AbsQuantityTable with a unit, based on a 2-dimensional grid with SI-values.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
gridSi- the table values {{a11, a12, ..., A1M}, ..., {aN1, aN2, ..., aNM}} expressed in the SI or base unitdisplayUnit- the unit of the data, which will also be used as the display unitreference- the reference point for the absolute quantities- Returns:
- a new AbsQuantityTable with a unit
- Throws:
IllegalArgumentException- when the size of the data object is not equal to rows*cols
-
of
public static <A extends AbsQuantity<A,Q, AbsQuantityTable<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(double[][] gridInUnit, Unit<?, Q> unit, R reference) Create a new AbsQuantityTable with a unit, based on a 2-dimensional grid with values in the given unit.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
gridInUnit- the table values {{a11, a12, ..., A1M}, ..., {aN1, aN2, ..., aNM}} expressed in the unitunit- the unit of the values, also used as the display unitreference- the reference point for the absolute quantities- Returns:
- a new AbsQuantityTable with a unit
- Throws:
IllegalArgumentException- when the size of the data object is not equal to rows*cols
-
of
public static <A extends AbsQuantity<A,Q, AbsQuantityTable<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(Q[][] grid, R reference) Create a AbsQuantityTable without needing generics, based on a 2-dimensional grid of quantities. The unit is taken from the first quantity in the grid.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
grid- the table values {{a11, a12, ..., A1M}, ..., {aN1, aN2, ..., aNM}} expressed as a 2-dimensional array of quantitiesreference- the reference point for the absolute quantities- Returns:
- a new AbsQuantityTable with a unit
- Throws:
IllegalArgumentException- when the size of the data object is not equal to rows*cols
-
of
public static <A extends AbsQuantity<A,Q, AbsQuantityTable<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(A[][] absGrid) Create a AbsQuantityTable without needing generics, based on a 2-dimensional grid of absolute quantities. The unit is taken from the first quantity in the grid. The reference points have to be all the same.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
absGrid- the table values {{a11, a12, ..., A1M}, ..., {aN1, aN2, ..., aNM}} expressed as a 2-dimensional array of absolute quantities- Returns:
- a new AbsQuantityTable with a display unit and reference point
- Throws:
IllegalArgumentException- when the size of the data object is not equal to rows*cols
-
of
public static <A extends AbsQuantity<A,Q, AbsQuantityTable<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(QuantityTable<Q> relativeTable, R reference) Create a AbsQuantityTable without needing generics, based on a relative table. The unit is taken from the first quantity in the grid.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
relativeTable- the relative table with values relative to the reference pointreference- the reference point for the absolute quantities- Returns:
- a new AbsQuantityTable with a unit
- Throws:
IllegalArgumentException- when the size of the data object is not equal to rows*cols
-
format
Concise description of this quantity table.- Returns:
- a String with the quantity table, with the unit and possibly the reference attached.
-
format
String representation of this quantity table after applying the format.- Parameters:
format- the format to apply for the quantity table- Returns:
- a String representation of this quantity table, formatted according to the given format
-
format
String representation of this quantity table, expressed in the specified unit.- Parameters:
targetUnit- the unit into which the values of the quantity table are converted for display- Returns:
- printable string with the quantity table's values expressed in the specified unit
-