The following document contains the results of PMD's CPD 6.4.0.
File | Line |
---|---|
org\djunits\value\vdouble\vector\DoubleVector.java | 30 |
org\djunits\value\vdouble\vector\MutableDoubleVector.java | 32 |
public static class Abs<AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>> extends AbstractDoubleVectorAbs<AU, RU, DoubleVector.Abs<AU, RU>, DoubleVector.Rel<RU>, MutableDoubleVector.Abs<AU, RU>, DoubleScalar.Abs<AU, RU>> { /** */ private static final long serialVersionUID = 20150626L; /** * Construct a new Absolute Mutable DoubleVector. * @param values double[]; the values of the entries in the new Absolute Mutable DoubleVector * @param unit AU; the unit of the new Absolute Mutable DoubleVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Abs(final double[] values, final AU unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Absolute Mutable DoubleVector. * @param values List<Double>; the values of the entries in the new Absolute Mutable DoubleVector * @param unit AU; the unit of the new Absolute Mutable DoubleVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Abs(final List<Double> values, final AU unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Absolute Mutable DoubleVector. * @param values DoubleScalar.Abs<AU, RU>[]; the values of the entries in the new Absolute Mutable DoubleVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Abs(final DoubleScalar.Abs<AU, RU>[] values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Absolute Mutable DoubleVector. * @param values List<DoubleScalar.Abs<AU, RU>>; the values of the entries in the new Absolute Mutable * DoubleVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Abs(final List<DoubleScalar.Abs<AU, RU>> values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Absolute Mutable DoubleVector. * @param values SortedMap<Integer, DoubleScalar.Abs<AU, RU>>; the values of the entries in the new Absolute * Sparse Mutable DoubleVector * @param length int; the size of the vector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Abs(final SortedMap<Integer, DoubleScalar.Abs<AU, RU>> values, final int length, final StorageType storageType) throws ValueException { super(values, length, storageType); } /** * Construct a new Absolute Mutable DoubleVector. * @param values SortedMap<Integer, Double>; the map of indexes to values of the Absolute Sparse Mutable * DoubleVector * @param unit AU; the unit of the new Absolute Sparse Mutable DoubleVector * @param length int; the size of the vector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Abs(final SortedMap<Integer, Double> values, final AU unit, final int length, final StorageType storageType) throws ValueException { super(values, unit, length, storageType); } /** * Construct a new Absolute Mutable DoubleVector. * @param data DoubleVectorData; an internal data object * @param unit AU; the unit */ public Abs(final DoubleVectorData data, final AU unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final DoubleVector.Abs<AU, RU> instantiateTypeAbs(final DoubleVectorData dvd, final AU unit) { return new DoubleVector.Abs<AU, RU>(dvd, unit); } /** {@inheritDoc} */ @Override protected final DoubleVector.Rel<RU> instantiateTypeRel(final DoubleVectorData dvd, final RU unit) { return new DoubleVector.Rel<RU>(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutableDoubleVector.Abs<AU, RU> instantiateMutableType(final DoubleVectorData dvd, final AU unit) { return new MutableDoubleVector.Abs<AU, RU>(dvd, unit); } /** {@inheritDoc} */ @Override protected final DoubleScalar.Abs<AU, RU> instantiateScalar(final double value, final AU unit) { return new DoubleScalar.Abs<AU, RU>(value, unit); } /** {@inheritDoc} */ @Override public final DoubleVector.Abs<AU, RU> toDense() |
File | Line |
---|---|
org\djunits\value\vfloat\vector\FloatVector.java | 30 |
org\djunits\value\vfloat\vector\MutableFloatVector.java | 32 |
public static class Abs<AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>> extends AbstractFloatVectorAbs<AU, RU, FloatVector.Abs<AU, RU>, FloatVector.Rel<RU>, MutableFloatVector.Abs<AU, RU>, FloatScalar.Abs<AU, RU>> { /** */ private static final long serialVersionUID = 20150626L; /** * Construct a new Absolute Mutable FloatVector. * @param values float[]; the values of the entries in the new Absolute Mutable FloatVector * @param unit AU; the unit of the new Absolute Mutable FloatVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Abs(final float[] values, final AU unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Absolute Mutable FloatVector. * @param values List<Float>; the values of the entries in the new Absolute Mutable FloatVector * @param unit AU; the unit of the new Absolute Mutable FloatVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Abs(final List<Float> values, final AU unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Absolute Mutable FloatVector. * @param values FloatScalar.Abs<AU, RU>[]; the values of the entries in the new Absolute Mutable FloatVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Abs(final FloatScalar.Abs<AU, RU>[] values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Absolute Mutable FloatVector. * @param values List<FloatScalar.Abs<AU, RU>>; the values of the entries in the new Absolute Mutable * FloatVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Abs(final List<FloatScalar.Abs<AU, RU>> values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Absolute Mutable FloatVector. * @param values SortedMap<Integer, FloatScalar.Abs<AU, RU>>; the values of the entries in the new Absolute * Sparse Mutable FloatVector * @param length int; the size of the vector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Abs(final SortedMap<Integer, FloatScalar.Abs<AU, RU>> values, final int length, final StorageType storageType) throws ValueException { super(values, length, storageType); } /** * Construct a new Absolute Mutable FloatVector. * @param values SortedMap<Integer, Float>; the map of indexes to values of the Absolute Sparse Mutable * FloatVector * @param unit AU; the unit of the new Absolute Sparse Mutable FloatVector * @param length int; the size of the vector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Abs(final SortedMap<Integer, Float> values, final AU unit, final int length, final StorageType storageType) throws ValueException { super(values, unit, length, storageType); } /** * Construct a new Absolute Mutable FloatVector. * @param data FloatVectorData; an internal data object * @param unit AU; the unit */ public Abs(final FloatVectorData data, final AU unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final FloatVector.Abs<AU, RU> instantiateTypeAbs(final FloatVectorData dvd, final AU unit) { return new FloatVector.Abs<AU, RU>(dvd, unit); } /** {@inheritDoc} */ @Override protected final FloatVector.Rel<RU> instantiateTypeRel(final FloatVectorData dvd, final RU unit) { return new FloatVector.Rel<RU>(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatVector.Abs<AU, RU> instantiateMutableType(final FloatVectorData dvd, final AU unit) { return new MutableFloatVector.Abs<AU, RU>(dvd, unit); } /** {@inheritDoc} */ @Override protected final FloatScalar.Abs<AU, RU> instantiateScalar(final float value, final AU unit) { return new FloatScalar.Abs<AU, RU>(value, unit); } /** {@inheritDoc} */ @Override public final FloatVector.Abs<AU, RU> toDense() |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractMutableDoubleMatrixRel.java | 103 |
org\djunits\value\vdouble\vector\AbstractMutableDoubleVectorRel.java | 157 |
public final R immutable() { setCopyOnWrite(true); return instantiateType(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableDoubleMatrix. <br> * @return DoubleMatrix<U>; deep copy of this MutableDoubleMatrix */ public final MR copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed matrix. * @param increment R; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MR) this; } /** * Increment the value by the supplied value and return the changed matrix. * @param increment S; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ public final MR incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed matrix. * @param increment double; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MR incrementBy(final double increment) { checkCopyOnWrite(); this.data.incrementBy(increment); return (MR) this; } /** * Decrement the value by the supplied value and return the changed matrix. * @param decrement R; amount by which the value is decremented * @return the changed MutableDoubleMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR decrementBy(final R decrement) throws ValueException { checkCopyOnWrite(); this.data.decrementBy(decrement.getData()); return (MR) this; } /** * Decrement the value by the supplied value and return the changed matrix. * @param decrement S; amount by which the value is decremented * @return the changed MutableDoubleMatrix.Rel<U> */ public final MR decrementBy(final S decrement) { return decrementBy(decrement.si); } /** * Decrement the value by the supplied constant and return the changed matrix. * @param decrement double; amount by which the value is decremented * @return the changed MutableDoubleMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MR decrementBy(final double decrement) { checkCopyOnWrite(); this.data.decrementBy(decrement); return (MR) this; } /** * Multiply the values in the matrix by the supplied values and return the changed matrix. * @param factors R; amounts by which the value is multiplied * @return the changed MutableDoubleMatrix.Rel<U> * @throws ValueException when the size of the factors is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR multiplyBy(final R factors) throws ValueException { checkCopyOnWrite(); this.data.multiplyBy(factors.getData()); return (MR) this; } /** * Multiply the values in the matrix by the supplied value and return the changed matrix. * @param factor S; amount by which the values in the matrix are multiplied * @return the changed MutableDoubleMatrix.Rel<U> */ public final MR multiplyBy(final S factor) { return multiplyBy(factor.si); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public final MR multiplyBy(final double factor) { checkCopyOnWrite(); this.data.multiplyBy(factor); return (MR) this; } /** * Divide the values in the matrix by the supplied values and return the changed matrix. * @param factors R; amounts by which the value is divided * @return the changed MutableDoubleMatrix.Rel<U> * @throws ValueException when the size of the factors is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR divideBy(final R factors) throws ValueException { checkCopyOnWrite(); this.data.divideBy(factors.getData()); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings({ "checkstyle:designforextension", "unchecked" }) public MR divideBy(final double factor) { this.data.divideBy(factor); return (MR) this; } /** * Divide the values in the matrix by the supplied value and return the changed matrix. * @param factor S; amount by which the values in the matrix are divided * @return the changed MutableDoubleMatrix.Rel<U> */ public final MR divideBy(final S factor) { return divideBy(factor.si); } /**********************************************************************************/ /********************************** MATH METHODS **********************************/ /**********************************************************************************/ /** * Execute a function on a cell by cell basis. Note: because many functions have to act on zero cells or can generate cells * with a zero value, the functions have to be applied on a dense dataset which has to be transformed back to a sparse * dataset if necessary. * @param doubleFunction DoubleFunction; the function to apply */ public final void assign(final DoubleFunction doubleFunction) { checkCopyOnWrite(); if (this.data instanceof DoubleMatrixDataDense) |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\AbstractMutableFloatMatrixRel.java | 103 |
org\djunits\value\vfloat\vector\AbstractMutableFloatVectorRel.java | 157 |
public final R immutable() { setCopyOnWrite(true); return instantiateType(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableFloatMatrix. <br> * @return FloatMatrix<U>; deep copy of this MutableFloatMatrix */ public final MR copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed matrix. * @param increment R; amount by which the value is incremented * @return the changed MutableFloatMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MR) this; } /** * Increment the value by the supplied value and return the changed matrix. * @param increment S; amount by which the value is incremented * @return the changed MutableFloatMatrix.Rel<U> */ public final MR incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed matrix. * @param increment float; amount by which the value is incremented * @return the changed MutableFloatMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MR incrementBy(final float increment) { checkCopyOnWrite(); this.data.incrementBy(increment); return (MR) this; } /** * Decrement the value by the supplied value and return the changed matrix. * @param decrement R; amount by which the value is decremented * @return the changed MutableFloatMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR decrementBy(final R decrement) throws ValueException { checkCopyOnWrite(); this.data.decrementBy(decrement.getData()); return (MR) this; } /** * Decrement the value by the supplied value and return the changed matrix. * @param decrement S; amount by which the value is decremented * @return the changed MutableFloatMatrix.Rel<U> */ public final MR decrementBy(final S decrement) { return decrementBy(decrement.si); } /** * Decrement the value by the supplied constant and return the changed matrix. * @param decrement float; amount by which the value is decremented * @return the changed MutableFloatMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MR decrementBy(final float decrement) { checkCopyOnWrite(); this.data.decrementBy(decrement); return (MR) this; } /** * Multiply the values in the matrix by the supplied values and return the changed matrix. * @param factors R; amounts by which the value is multiplied * @return the changed MutableFloatMatrix.Rel<U> * @throws ValueException when the size of the factors is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR multiplyBy(final R factors) throws ValueException { checkCopyOnWrite(); this.data.multiplyBy(factors.getData()); return (MR) this; } /** * Multiply the values in the matrix by the supplied value and return the changed matrix. * @param factor S; amount by which the values in the matrix are multiplied * @return the changed MutableFloatMatrix.Rel<U> */ public final MR multiplyBy(final S factor) { return multiplyBy(factor.si); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public final MR multiplyBy(final float factor) { checkCopyOnWrite(); this.data.multiplyBy(factor); return (MR) this; } /** * Divide the values in the matrix by the supplied values and return the changed matrix. * @param factors R; amounts by which the value is divided * @return the changed MutableFloatMatrix.Rel<U> * @throws ValueException when the size of the factors is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR divideBy(final R factors) throws ValueException { checkCopyOnWrite(); this.data.divideBy(factors.getData()); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings({ "checkstyle:designforextension", "unchecked" }) public MR divideBy(final float factor) { this.data.divideBy(factor); return (MR) this; } /** * Divide the values in the matrix by the supplied value and return the changed matrix. * @param factor S; amount by which the values in the matrix are divided * @return the changed MutableFloatMatrix.Rel<U> */ public final MR divideBy(final S factor) { return divideBy(factor.si); } /**********************************************************************************/ /********************************** MATH METHODS **********************************/ /**********************************************************************************/ /** * Execute a function on a cell by cell basis. Note: because many functions have to act on zero cells or can generate cells * with a zero value, the functions have to be applied on a dense dataset which has to be transformed back to a sparse * dataset if necessary. * @param floatFunction FloatFunction; the function to apply */ public final void assign(final FloatFunction floatFunction) { checkCopyOnWrite(); if (this.data instanceof FloatMatrixDataDense) |
File | Line |
---|---|
org\djunits\value\vdouble\vector\DoubleVector.java | 171 |
org\djunits\value\vdouble\vector\MutableDoubleVector.java | 174 |
extends AbstractDoubleVectorRel<U, DoubleVector.Rel<U>, MutableDoubleVector.Rel<U>, DoubleScalar.Rel<U>> { /** */ private static final long serialVersionUID = 20150626L; /** * Construct a new Relative Mutable DoubleVector. * @param values double[]; the values of the entries in the new Relative Mutable DoubleVector * @param unit U; the unit of the new Relative Mutable DoubleVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Rel(final double[] values, final U unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Relative Mutable DoubleVector. * @param values List<Double>; the values of the entries in the new Relative Mutable DoubleVector * @param unit U; the unit of the new Relative Mutable DoubleVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Rel(final List<Double> values, final U unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Relative Mutable DoubleVector. * @param values DoubleScalar.Rel<U>[]; the values of the entries in the new Relative Mutable DoubleVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Rel(final DoubleScalar.Rel<U>[] values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Relative Mutable DoubleVector. * @param values List<DoubleScalar.Rel<U>>; the values of the entries in the new Relative Mutable * DoubleVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Rel(final List<DoubleScalar.Rel<U>> values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Relative Mutable DoubleVector. * @param values SortedMap<Integer, DoubleScalar.Rel<U>>; the values of the entries in the new Relative * Sparse Mutable DoubleVector * @param length int; the size of the vector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Rel(final SortedMap<Integer, DoubleScalar.Rel<U>> values, final int length, final StorageType storageType) throws ValueException { super(values, length, storageType); } /** * Construct a new Relative Mutable DoubleVector. * @param values SortedMap<Integer, Double>; the map of indexes to values of the Relative Sparse Mutable * DoubleVector * @param unit U; the unit of the new Relative Sparse Mutable DoubleVector * @param length int; the size of the vector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Rel(final SortedMap<Integer, Double> values, final U unit, final int length, final StorageType storageType) throws ValueException { super(values, unit, length, storageType); } /** * Construct a new Relative Mutable DoubleVector. * @param data DoubleVectorData; an internal data object * @param unit U; the unit */ public Rel(final DoubleVectorData data, final U unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final DoubleVector.Rel<U> instantiateType(final DoubleVectorData dvd, final U unit) { return new DoubleVector.Rel<U>(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutableDoubleVector.Rel<U> instantiateMutableType(final DoubleVectorData dvd, final U unit) { return new MutableDoubleVector.Rel<U>(dvd, unit); } /** {@inheritDoc} */ @Override protected final DoubleScalar.Rel<U> instantiateScalar(final double value, final U unit) { return new DoubleScalar.Rel<U>(value, unit); } /** {@inheritDoc} */ @Override public final DoubleVector.Rel<U> toDense() |
File | Line |
---|---|
org\djunits\value\vfloat\vector\FloatVector.java | 171 |
org\djunits\value\vfloat\vector\MutableFloatVector.java | 174 |
extends AbstractFloatVectorRel<U, FloatVector.Rel<U>, MutableFloatVector.Rel<U>, FloatScalar.Rel<U>> { /** */ private static final long serialVersionUID = 20150626L; /** * Construct a new Relative Mutable FloatVector. * @param values float[]; the values of the entries in the new Relative Mutable FloatVector * @param unit U; the unit of the new Relative Mutable FloatVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Rel(final float[] values, final U unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Relative Mutable FloatVector. * @param values List<Float>; the values of the entries in the new Relative Mutable FloatVector * @param unit U; the unit of the new Relative Mutable FloatVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Rel(final List<Float> values, final U unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Relative Mutable FloatVector. * @param values FloatScalar.Rel<U>[]; the values of the entries in the new Relative Mutable FloatVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Rel(final FloatScalar.Rel<U>[] values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Relative Mutable FloatVector. * @param values List<FloatScalar.Rel<U>>; the values of the entries in the new Relative Mutable FloatVector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Rel(final List<FloatScalar.Rel<U>> values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Relative Mutable FloatVector. * @param values SortedMap<Integer, FloatScalar.Rel<U>>; the values of the entries in the new Relative * Sparse Mutable FloatVector * @param length int; the size of the vector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Rel(final SortedMap<Integer, FloatScalar.Rel<U>> values, final int length, final StorageType storageType) throws ValueException { super(values, length, storageType); } /** * Construct a new Relative Mutable FloatVector. * @param values SortedMap<Integer, Float>; the map of indexes to values of the Relative Sparse Mutable * FloatVector * @param unit U; the unit of the new Relative Sparse Mutable FloatVector * @param length int; the size of the vector * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Rel(final SortedMap<Integer, Float> values, final U unit, final int length, final StorageType storageType) throws ValueException { super(values, unit, length, storageType); } /** * Construct a new Relative Mutable FloatVector. * @param data FloatVectorData; an internal data object * @param unit U; the unit */ public Rel(final FloatVectorData data, final U unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final FloatVector.Rel<U> instantiateType(final FloatVectorData dvd, final U unit) { return new FloatVector.Rel<U>(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatVector.Rel<U> instantiateMutableType(final FloatVectorData dvd, final U unit) { return new MutableFloatVector.Rel<U>(dvd, unit); } /** {@inheritDoc} */ @Override protected final FloatScalar.Rel<U> instantiateScalar(final float value, final U unit) { return new FloatScalar.Rel<U>(value, unit); } /** {@inheritDoc} */ @Override public final FloatVector.Rel<U> toDense() |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractMutableDoubleMatrixAbs.java | 107 |
org\djunits\value\vdouble\vector\AbstractMutableDoubleVectorAbs.java | 163 |
public final A immutable() { setCopyOnWrite(true); return instantiateTypeAbs(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableDoubleMatrix. <br> * @return DoubleMatrix<U>; deep copy of this MutableDoubleMatrix */ public final MA copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed matrix. * @param increment R; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MA incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MA) this; } /** * Increment the value by the supplied value and return the changed matrix. * @param increment S; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ public final MA incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed matrix. * @param increment double; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MA incrementBy(final double increment) { checkCopyOnWrite(); this.data.incrementBy(increment); return (MA) this; } /** * Decrement the value by the supplied value and return the changed matrix. * @param decrement R; amount by which the value is decremented * @return the changed MutableDoubleMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MA decrementBy(final R decrement) throws ValueException { checkCopyOnWrite(); this.data.decrementBy(decrement.getData()); return (MA) this; } /** * Decrement the value by the supplied value and return the changed matrix. * @param decrement S; amount by which the value is decremented * @return the changed MutableDoubleMatrix.Rel<U> */ public final MA decrementBy(final S decrement) { return decrementBy(decrement.si); } /** * Decrement the value by the supplied constant and return the changed matrix. * @param decrement double; amount by which the value is decremented * @return the changed MutableDoubleMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MA decrementBy(final double decrement) { checkCopyOnWrite(); this.data.decrementBy(decrement); return (MA) this; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public final MA multiplyBy(final double factor) { checkCopyOnWrite(); this.data.multiplyBy(factor); return (MA) this; } /** {@inheritDoc} */ @Override @SuppressWarnings({ "checkstyle:designforextension", "unchecked" }) public MA divideBy(final double factor) { this.data.divideBy(factor); return (MA) this; } /** * Multiply the values in the matrix by the supplied values and return the changed matrix. * @param factors R; amounts by which the value is multiplied * @return the changed MutableDoubleMatrix.Rel<U> * @throws ValueException when the size of the factors is not identical to the size of this */ @SuppressWarnings("unchecked") public final MA multiplyBy(final R factors) throws ValueException { checkCopyOnWrite(); this.data.multiplyBy(factors.getData()); return (MA) this; } /**********************************************************************************/ /********************************** MATH METHODS **********************************/ /**********************************************************************************/ /** * Execute a function on a cell by cell basis. Note: because many functions have to act on zero cells or can generate cells * with a zero value, the functions have to be applied on a dense dataset which has to be transformed back to a sparse * dataset if necessary. * @param doubleFunction DoubleFunction; the function to apply */ public final void assign(final DoubleFunction doubleFunction) { checkCopyOnWrite(); if (this.data instanceof DoubleMatrixDataDense) |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\AbstractMutableFloatMatrixAbs.java | 107 |
org\djunits\value\vfloat\vector\AbstractMutableFloatVectorAbs.java | 162 |
public final A immutable() { setCopyOnWrite(true); return instantiateTypeAbs(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableFloatMatrix. <br> * @return FloatMatrix<U>; deep copy of this MutableFloatMatrix */ public final MA copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed matrix. * @param increment R; amount by which the value is incremented * @return the changed MutableFloatMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MA incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MA) this; } /** * Increment the value by the supplied value and return the changed matrix. * @param increment S; amount by which the value is incremented * @return the changed MutableFloatMatrix.Rel<U> */ public final MA incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed matrix. * @param increment float; amount by which the value is incremented * @return the changed MutableFloatMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MA incrementBy(final float increment) { checkCopyOnWrite(); this.data.incrementBy(increment); return (MA) this; } /** * Decrement the value by the supplied value and return the changed matrix. * @param decrement R; amount by which the value is decremented * @return the changed MutableFloatMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MA decrementBy(final R decrement) throws ValueException { checkCopyOnWrite(); this.data.decrementBy(decrement.getData()); return (MA) this; } /** * Decrement the value by the supplied value and return the changed matrix. * @param decrement S; amount by which the value is decremented * @return the changed MutableFloatMatrix.Rel<U> */ public final MA decrementBy(final S decrement) { return decrementBy(decrement.si); } /** * Decrement the value by the supplied constant and return the changed matrix. * @param decrement float; amount by which the value is decremented * @return the changed MutableFloatMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MA decrementBy(final float decrement) { checkCopyOnWrite(); this.data.decrementBy(decrement); return (MA) this; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public final MA multiplyBy(final float factor) { checkCopyOnWrite(); this.data.multiplyBy(factor); return (MA) this; } /** {@inheritDoc} */ @Override @SuppressWarnings({ "checkstyle:designforextension", "unchecked" }) public MA divideBy(final float factor) { this.data.divideBy(factor); return (MA) this; } /** * Multiply the values in the matrix by the supplied values and return the changed matrix. * @param factors R; amounts by which the value is multiplied * @return the changed MutableFloatMatrix.Rel<U> * @throws ValueException when the size of the factors is not identical to the size of this */ @SuppressWarnings("unchecked") public final MA multiplyBy(final R factors) throws ValueException { checkCopyOnWrite(); this.data.multiplyBy(factors.getData()); return (MA) this; } /**********************************************************************************/ /********************************** MATH METHODS **********************************/ /**********************************************************************************/ /** * Execute a function on a cell by cell basis. Note: because many functions have to act on zero cells or can generate cells * with a zero value, the functions have to be applied on a dense dataset which has to be transformed back to a sparse * dataset if necessary. * @param floatFunction FloatFunction; the function to apply */ public final void assign(final FloatFunction floatFunction) { checkCopyOnWrite(); if (this.data instanceof FloatMatrixDataDense) |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractDoubleMatrix.java | 134 |
org\djunits\value\vfloat\matrix\AbstractFloatMatrix.java | 134 |
public final double zSum() { return this.data.zSum(); } /** {@inheritDoc} */ @Override public final int cardinality() { return this.data.cardinality(); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getUnit(), false, true); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit) { return toString(displayUnit, false, true); } /** {@inheritDoc} */ @Override public final String toString(final boolean verbose, final boolean withUnit) { return toString(getUnit(), verbose, withUnit); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit) { StringBuffer buf = new StringBuffer(); if (verbose) { String ab = this instanceof Absolute ? "Abs " : "Rel "; String ds = this.data.isDense() ? "Dense " : this.data.isSparse() ? "Sparse " : "?????? "; if (this instanceof Mutable) { buf.append("Mutable " + ab + ds); } else { buf.append("Immutable " + ab + ds); } } for (int row = 0; row < rows(); row++) { buf.append("\r\n\t"); for (int column = 0; column < columns(); column++) { try { |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractDoubleVector.java | 134 |
org\djunits\value\vfloat\vector\AbstractFloatVector.java | 143 |
public final double zSum() { return this.data.zSum(); } /** {@inheritDoc} */ @Override public final int cardinality() { return this.data.cardinality(); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getUnit(), false, true); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit) { return toString(displayUnit, false, true); } /** {@inheritDoc} */ @Override public final String toString(final boolean verbose, final boolean withUnit) { return toString(getUnit(), verbose, withUnit); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit) { StringBuffer buf = new StringBuffer(); if (verbose) { String ar = this instanceof Absolute ? "Abs " : "Rel "; String ds = this.data.isDense() ? "Dense " : this.data.isSparse() ? "Sparse " : "?????? "; if (this instanceof Mutable) { buf.append("Mutable " + ar + ds); } else { buf.append("Immutable " + ar + ds); } } buf.append("["); for (int i = 0; i < size(); i++) { try { |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractMutableDoubleMatrixRel.java | 282 |
org\djunits\value\vdouble\vector\AbstractMutableDoubleVectorRel.java | 336 |
DoubleMatrixDataDense dvdd = ((DoubleMatrixDataSparse) this.data).toDense(); dvdd.assign(doubleFunction); this.data = dvdd.toSparse(); } } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public final MR abs() { assign(DoubleMathFunctions.ABS); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MR ceil() { assign(DoubleMathFunctions.CEIL); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MR floor() { assign(DoubleMathFunctions.FLOOR); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MR neg() { assign(DoubleMathFunctions.NEG); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MR rint() { assign(DoubleMathFunctions.RINT); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MR round() { assign(DoubleMathFunctions.ROUND); return (MR) this; } /** * Check the copyOnWrite flag and, if it is set, make a deep copy of the data and clear the flag. */ protected final void checkCopyOnWrite() { if (isCopyOnWrite()) { this.data = this.data.copy(); setCopyOnWrite(false); } } /** * Set the value for a cell in the matrix. * @param row int; the row * @param column int; the column * @param valueSI double; the value, expressed in the SI unit * @throws ValueException when the row/column is out of range */ public final void setSI(final int row, final int column, final double valueSI) throws ValueException |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\AbstractMutableFloatMatrixRel.java | 282 |
org\djunits\value\vfloat\vector\AbstractMutableFloatVectorRel.java | 336 |
FloatMatrixDataDense dvdd = ((FloatMatrixDataSparse) this.data).toDense(); dvdd.assign(floatFunction); this.data = dvdd.toSparse(); } } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public final MR abs() { assign(FloatMathFunctions.ABS); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MR ceil() { assign(FloatMathFunctions.CEIL); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MR floor() { assign(FloatMathFunctions.FLOOR); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MR neg() { assign(FloatMathFunctions.NEG); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MR rint() { assign(FloatMathFunctions.RINT); return (MR) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MR round() { assign(FloatMathFunctions.ROUND); return (MR) this; } /** * Check the copyOnWrite flag and, if it is set, make a deep copy of the data and clear the flag. */ protected final void checkCopyOnWrite() { if (isCopyOnWrite()) { this.data = this.data.copy(); setCopyOnWrite(false); } } /** * Set the value for a cell in the matrix. * @param row int; the row * @param column int; the column * @param valueSI float; the value, expressed in the SI unit * @throws ValueException when the row/column is out of range */ public final void setSI(final int row, final int column, final float valueSI) throws ValueException |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractDoubleMatrixRel.java | 99 |
org\djunits\value\vfloat\matrix\AbstractFloatMatrixRel.java | 99 |
protected abstract S instantiateScalar(double value, U unit); /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public final S get(final int row, final int column) throws ValueException { checkIndex(row, column); return instantiateScalar(getInUnit(row, column, getUnit()), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Add a Relative value to this Relative value for a matrix or matrix. The addition is done value by value and store the * result in a new Relative value. If both operands are sparse, the result is a sparse matrix or matrix, otherwise the * result is a dense matrix or matrix. * @param rel R; the right operand * @return the addition of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R plus(final R rel) throws ValueException { return instantiateType(this.getData().plus(rel.getData()), getUnit()); } /** * Subtract a Relative value from this Relative value for a matrix or matrix. The subtraction is done value by value and * store the result in a new Relative value. If both operands are sparse, the result is a sparse matrix or matrix, otherwise * the result is a dense matrix or matrix. * @param rel R; the right operand * @return the subtraction of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R minus(final R rel) throws ValueException { return instantiateType(this.getData().minus(rel.getData()), getUnit()); } /** * Multiply a Relative value with this Relative value for a matrix or matrix. The multiplication is done value by value and * store the result in a new Relative value. If both operands are dense, the result is a dense matrix or matrix, otherwise * the result is a sparse matrix or matrix. * @param rel R; the right operand * @return the multiplication of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R times(final R rel) throws ValueException { return instantiateType(this.getData().times(rel.getData()), getUnit()); } /** * Divide this Relative value by a Relative value for a matrix or matrix. The division is done value by value and store the * result in a new Relative value. If both operands are dense, the result is a dense matrix or matrix, otherwise the result * is a sparse matrix or matrix. * @param rel R; the right operand * @return the division of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R divide(final R rel) throws ValueException { return instantiateType(this.getData().divide(rel.getData()), getUnit()); } /* ============================================================================================ */ /* ============================= STATIC CONSTRUCTOR HELP METHODS ============================== */ /* ============================================================================================ */ /** * Check that a provided array can be used to create some descendant of a DoubleMatrix, and return the Unit. * @param dsArray S[][]; the array to check and get the unit for * @param <U> the unit * @param <S> the scalar type * @return the unit of the object * @throws ValueException when the array is null, has length equal to 0, or has first entry with length equal to 0 */ static <U extends Unit<U>, S extends AbstractDoubleScalarRel<U, S>> U checkUnit(final S[][] dsArray) throws ValueException |
File | Line |
---|---|
org\djunits\value\vdouble\vector\DoubleVectorDataSparse.java | 229 |
org\djunits\value\vfloat\vector\FloatVectorDataSparse.java | 228 |
double[] newVectorSI = new double[newLength]; int[] newIndices = new int[newLength]; // fill the sparse data structures. Cannot be parallelized because of stateful and sequence-sensitive count int count = 0; for (int i = 0; i < size(); i++) { if (this.getSI(i) != 0.0 && right.getSI(i) != 0.0) { newVectorSI[count] = getSI(i) / right.getSI(i); newIndices[count] = i; count++; } } this.indices = newIndices; this.vectorSI = newVectorSI; } /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + Arrays.hashCode(this.indices); result = prime * result + this.size; return result; } /** {@inheritDoc} */ @SuppressWarnings({"checkstyle:needbraces", "checkstyle:designforextension"}) @Override public boolean equals(final Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractDoubleMatrixAbs.java | 112 |
org\djunits\value\vfloat\matrix\AbstractFloatMatrixAbs.java | 113 |
protected abstract S instantiateScalar(double value, AU unit); /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public final S get(final int row, final int column) throws ValueException { checkIndex(row, column); return instantiateScalar(getInUnit(row, column, getUnit()), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** {@inheritDoc} */ @Override public final A plus(final R rel) throws ValueException { return instantiateTypeAbs(this.getData().plus(rel.getData()), getUnit()); } /** {@inheritDoc} */ @Override public final A minus(final R rel) throws ValueException { return instantiateTypeAbs(this.getData().minus(rel.getData()), getUnit()); } /** {@inheritDoc} */ @Override public final R minus(final A abs) throws ValueException { return instantiateTypeRel(this.getData().minus(abs.getData()), getUnit().getRelativeUnit()); } /* ============================================================================================ */ /* ============================= STATIC CONSTRUCTOR HELP METHODS ============================== */ /* ============================================================================================ */ /** * Check that a provided array can be used to create some descendant of a DoubleMatrix, and return the Unit. * @param dsArray S[][]; the array to check and get the unit for * @param <AU> the absolute unit * @param <RU> the corresponding relative unit * @param <S> the scalar type * @return the unit of the object * @throws ValueException when the array is null, has length equal to 0, or has first entry with length equal to 0 */ static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, S extends AbstractDoubleScalarAbs<AU, S, RU, ?>> AU checkUnit(final S[][] dsArray) throws ValueException |
File | Line |
---|---|
org\djunits\value\vdouble\scalar\AbstractDoubleScalarRel.java | 55 |
org\djunits\value\vfloat\scalar\AbstractFloatScalarRel.java | 55 |
public abstract R instantiateRel(double value, U unit); /** * Increment the value by the supplied value and return the result. If the units are equal, the result is expressed in that * unit. If the units are unequal, the result is expressed in the standard (often SI) unit. * @param increment R, a relative typed DoubleScalar; amount by which the value is incremented * @return Absolute DoubleScalar */ public final R plus(final R increment) { if (getUnit().isBaseSIUnit()) { return instantiateRel(this.si + increment.si, getUnit().getStandardUnit()); } return getUnit().equals(increment.getUnit()) ? instantiateRel(getInUnit() + increment.getInUnit(), getUnit()) : instantiateRel(this.si + increment.si, getUnit().getStandardUnit()); } /** * Decrement the value by the supplied value and return the result. If the units are equal, the result is expressed in that * unit. If the units are unequal, the result is expressed in the standard (often SI) unit. * @param decrement R, a relative typed DoubleScalar; amount by which the value is decremented * @return Relative DoubleScalar */ public final R minus(final R decrement) { if (getUnit().isBaseSIUnit()) { return instantiateRel(this.si - decrement.si, getUnit().getStandardUnit()); } return getUnit().equals(decrement.getUnit()) ? instantiateRel(getInUnit() - decrement.getInUnit(), getUnit()) : instantiateRel(this.si - decrement.si, getUnit().getStandardUnit()); } |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractDoubleVectorAbs.java | 255 |
org\djunits\value\vdouble\vector\AbstractDoubleVectorRel.java | 268 |
S extends AbstractDoubleScalarAbs<AU, S, RU, ?>> AU checkUnit(final SortedMap<Integer, S> dsMap) throws ValueException { if (dsMap != null && dsMap.size() > 0) { return dsMap.get(dsMap.firstKey()).getUnit(); } throw new ValueException( "Cannot create a DoubleVector or MutableDoubleVector from a null or empty Map of DoubleScalar"); } /* ============================================================================================ */ /* =============================== ITERATOR METHODS AND CLASS ================================= */ /* ============================================================================================ */ /** * Returns an iterator over the scalars in this vector in proper sequence. * @return an iterator over the scalars in this vector in proper sequence */ @Override public Iterator<S> iterator() { return new Itr(); } /** * The iterator class is loosely based in AbstractList.Itr. It does not throw a ConcurrentModificationException, because the * size of the vector does not change. Normal (non-mutable) vectors cannot change their size, nor their content. The only * thing for the MutableVector that can change is its content, not its length. */ protected class Itr implements Iterator<S> { /** index of next element to return. */ private int cursor = 0; @Override public boolean hasNext() { return this.cursor != size(); } /** {@inheritDoc} */ @Override public S next() { if (this.cursor >= size()) { throw new NoSuchElementException(); } try { int i = this.cursor; S next = get(i); this.cursor = i + 1; return next; } catch (ValueException exception) { throw new RuntimeException(exception); } } /** {@inheritDoc} */ @Override public void remove() { throw new RuntimeException("Remove function cannot be applied on fixed-size DJUNITS Vector"); } } } |
File | Line |
---|---|
org\djunits\value\vfloat\vector\AbstractFloatVectorAbs.java | 253 |
org\djunits\value\vfloat\vector\AbstractFloatVectorRel.java | 266 |
S extends AbstractFloatScalarAbs<AU, S, RU, ?>> AU checkUnit(final SortedMap<Integer, S> dsMap) throws ValueException { if (dsMap != null && dsMap.size() > 0) { return dsMap.get(dsMap.firstKey()).getUnit(); } throw new ValueException("Cannot create a FloatVector or MutableFloatVector from a null or empty Map of FloatScalar"); } /* ============================================================================================ */ /* =============================== ITERATOR METHODS AND CLASS ================================= */ /* ============================================================================================ */ /** * Returns an iterator over the scalars in this vector in proper sequence. * @return an iterator over the scalars in this vector in proper sequence */ @Override public Iterator<S> iterator() { return new Itr(); } /** * The iterator class is loosely based in AbstractList.Itr. It does not throw a ConcurrentModificationException, because the * size of the vector does not change. Normal (non-mutable) vectors cannot change their size, nor their content. The only * thing for the MutableVector that can change is its content, not its length. */ protected class Itr implements Iterator<S> { /** index of next element to return. */ private int cursor = 0; @Override public boolean hasNext() { return this.cursor != size(); } /** {@inheritDoc} */ @Override public S next() { if (this.cursor >= size()) { throw new NoSuchElementException(); } try { int i = this.cursor; S next = get(i); this.cursor = i + 1; return next; } catch (ValueException exception) { throw new RuntimeException(exception); } } /** {@inheritDoc} */ @Override public void remove() { throw new RuntimeException("Remove function cannot be applied on fixed-size DJUNITS Vector"); } } } |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\DoubleMatrix.java | 82 |
org\djunits\value\vdouble\matrix\MutableDoubleMatrix.java | 89 |
return this.data.isSparse() ? this : instantiateTypeAbs(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final DoubleMatrix.Abs<AU, RU> instantiateTypeAbs(final DoubleMatrixData dmd, final AU unit) { return new DoubleMatrix.Abs<AU, RU>(dmd, unit); } /** {@inheritDoc} */ @Override protected final DoubleMatrix.Rel<RU> instantiateTypeRel(final DoubleMatrixData dmd, final RU unit) { return new DoubleMatrix.Rel<RU>(dmd, unit); } /** {@inheritDoc} */ @Override protected final MutableDoubleMatrix.Abs<AU, RU> instantiateMutableType(final DoubleMatrixData dmd, final AU unit) { return new MutableDoubleMatrix.Abs<AU, RU>(dmd, unit); } /** {@inheritDoc} */ @Override protected final DoubleScalar.Abs<AU, RU> instantiateScalar(final double value, final AU unit) { return new DoubleScalar.Abs<AU, RU>(value, unit); } } /** * RELATIVE implementation of DoubleMatrix. * @param <U> Unit the unit for which this Matrix will be created */ public static class Rel<U extends Unit<U>> extends AbstractDoubleMatrixRel<U, DoubleMatrix.Rel<U>, MutableDoubleMatrix.Rel<U>, DoubleScalar.Rel<U>> |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\FloatMatrix.java | 81 |
org\djunits\value\vfloat\matrix\MutableFloatMatrix.java | 86 |
return this.data.isSparse() ? this : instantiateTypeAbs(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final FloatMatrix.Abs<AU, RU> instantiateTypeAbs(final FloatMatrixData dmd, final AU unit) { return new FloatMatrix.Abs<AU, RU>(dmd, unit); } /** {@inheritDoc} */ @Override protected final FloatMatrix.Rel<RU> instantiateTypeRel(final FloatMatrixData dmd, final RU unit) { return new FloatMatrix.Rel<RU>(dmd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatMatrix.Abs<AU, RU> instantiateMutableType(final FloatMatrixData dmd, final AU unit) { return new MutableFloatMatrix.Abs<AU, RU>(dmd, unit); } /** {@inheritDoc} */ @Override protected final FloatScalar.Abs<AU, RU> instantiateScalar(final float value, final AU unit) { return new FloatScalar.Abs<AU, RU>(value, unit); } } /** * RELATIVE implementation of FloatMatrix. * @param <U> Unit the unit for which this Matrix will be created */ public static class Rel<U extends Unit<U>> extends AbstractFloatMatrixRel<U, FloatMatrix.Rel<U>, MutableFloatMatrix.Rel<U>, FloatScalar.Rel<U>> |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractMutableDoubleVectorAbs.java | 125 |
org\djunits\value\vfloat\vector\AbstractMutableFloatVectorAbs.java | 124 |
AbstractMutableDoubleVectorAbs(final DoubleVectorData data, final AU unit) { super(data, unit); } /** * Retrieve the value of the copyOnWrite flag. * @return boolean */ private boolean isCopyOnWrite() { return this.copyOnWrite; } /** * Change the copyOnWrite flag. * @param copyOnWrite boolean; the new value for the copyOnWrite flag */ final void setCopyOnWrite(final boolean copyOnWrite) { this.copyOnWrite = copyOnWrite; } /** {@inheritDoc} */ @Override public final MA mutable() { setCopyOnWrite(true); final MA result = instantiateMutableType(getData(), getUnit()); result.setCopyOnWrite(true); return result; } /** * Create a immutable version of this MutableDoubleVector. <br> * @return DoubleVector<U>; mutable version of this MutableDoubleVector */ @Override public A immutable() { setCopyOnWrite(true); return instantiateTypeAbs(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableDoubleVector. <br> * @return DoubleVector<U>; deep copy of this MutableDoubleVector */ public final MA copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed vector. * @param increment R; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MA incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MA) this; } /** * Increment the value by the supplied value and return the changed vector. * @param increment S; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> */ public final MA incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed vector. * @param increment double; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> */ @SuppressWarnings("unchecked") public final MA incrementBy(final double increment) |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractMutableDoubleVectorRel.java | 119 |
org\djunits\value\vfloat\vector\AbstractMutableFloatVectorRel.java | 119 |
AbstractMutableDoubleVectorRel(final DoubleVectorData data, final U unit) { super(data, unit); } /** * Retrieve the value of the copyOnWrite flag. * @return boolean */ private boolean isCopyOnWrite() { return this.copyOnWrite; } /** * Change the copyOnWrite flag. * @param copyOnWrite boolean; the new value for the copyOnWrite flag */ final void setCopyOnWrite(final boolean copyOnWrite) { this.copyOnWrite = copyOnWrite; } /** {@inheritDoc} */ @Override public final MR mutable() { setCopyOnWrite(true); final MR result = instantiateMutableType(getData(), getUnit()); result.setCopyOnWrite(true); return result; } /** * Create a immutable version of this MutableDoubleVector. <br> * @return DoubleVector<U>; mutable version of this MutableDoubleVector */ @Override public R immutable() { setCopyOnWrite(true); return instantiateType(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableDoubleVector. <br> * @return DoubleVector<U>; deep copy of this MutableDoubleVector */ public final MR copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed vector. * @param increment R; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MR) this; } /** * Increment the value by the supplied value and return the changed vector. * @param increment S; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> */ public final MR incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed vector. * @param increment double; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> */ @SuppressWarnings("unchecked") public final MR incrementBy(final double increment) |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractMutableDoubleMatrixAbs.java | 70 |
org\djunits\value\vfloat\matrix\AbstractMutableFloatMatrixAbs.java | 70 |
AbstractMutableDoubleMatrixAbs(final DoubleMatrixData data, final AU unit) { super(data, unit); } /** * Retrieve the value of the copyOnWrite flag. * @return boolean */ private boolean isCopyOnWrite() { return this.copyOnWrite; } /** * Change the copyOnWrite flag. * @param copyOnWrite boolean; the new value for the copyOnWrite flag */ final void setCopyOnWrite(final boolean copyOnWrite) { this.copyOnWrite = copyOnWrite; } /** {@inheritDoc} */ @Override public final MA mutable() { setCopyOnWrite(true); final MA result = instantiateMutableType(getData(), getUnit()); result.setCopyOnWrite(true); return result; } /** * Create a immutable version of this MutableDoubleMatrix. <br> * @return DoubleMatrix<U>; mutable version of this MutableDoubleMatrix */ public final A immutable() { setCopyOnWrite(true); return instantiateTypeAbs(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableDoubleMatrix. <br> * @return DoubleMatrix<U>; deep copy of this MutableDoubleMatrix */ public final MA copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed matrix. * @param increment R; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MA incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MA) this; } /** * Increment the value by the supplied value and return the changed matrix. * @param increment S; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ public final MA incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed matrix. * @param increment double; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MA incrementBy(final double increment) |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractMutableDoubleMatrixRel.java | 66 |
org\djunits\value\vfloat\matrix\AbstractMutableFloatMatrixRel.java | 66 |
AbstractMutableDoubleMatrixRel(final DoubleMatrixData data, final U unit) { super(data, unit); } /** * Retrieve the value of the copyOnWrite flag. * @return boolean */ private boolean isCopyOnWrite() { return this.copyOnWrite; } /** * Change the copyOnWrite flag. * @param copyOnWrite boolean; the new value for the copyOnWrite flag */ final void setCopyOnWrite(final boolean copyOnWrite) { this.copyOnWrite = copyOnWrite; } /** {@inheritDoc} */ @Override public final MR mutable() { setCopyOnWrite(true); final MR result = instantiateMutableType(getData(), getUnit()); result.setCopyOnWrite(true); return result; } /** * Create a immutable version of this MutableDoubleMatrix. <br> * @return DoubleMatrix<U>; mutable version of this MutableDoubleMatrix */ public final R immutable() { setCopyOnWrite(true); return instantiateType(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableDoubleMatrix. <br> * @return DoubleMatrix<U>; deep copy of this MutableDoubleMatrix */ public final MR copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed matrix. * @param increment R; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MR) this; } /** * Increment the value by the supplied value and return the changed matrix. * @param increment S; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ public final MR incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed matrix. * @param increment double; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MR incrementBy(final double increment) |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractDoubleVectorRel.java | 158 |
org\djunits\value\vfloat\vector\AbstractFloatVectorRel.java | 158 |
public final S get(final int index) throws ValueException { return instantiateScalar(getInUnit(index, getUnit()), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Add a Relative value to this Relative value for a vector or matrix. The addition is done value by value and store the * result in a new Relative value. If both operands are sparse, the result is a sparse vector or matrix, otherwise the * result is a dense vector or matrix. * @param rel R; the right operand * @return the addition of this vector and the operand * @throws ValueException in case this vector or matrix and the operand have a different size */ public final R plus(final R rel) throws ValueException { return instantiateType(this.getData().plus(rel.getData()), getUnit()); } /** * Subtract a Relative value from this Relative value for a vector or matrix. The subtraction is done value by value and * store the result in a new Relative value. If both operands are sparse, the result is a sparse vector or matrix, otherwise * the result is a dense vector or matrix. * @param rel R; the right operand * @return the subtraction of this vector and the operand * @throws ValueException in case this vector or matrix and the operand have a different size */ public final R minus(final R rel) throws ValueException { return instantiateType(this.getData().minus(rel.getData()), getUnit()); } /** * Multiply a Relative value with this Relative value for a vector or matrix. The multiplication is done value by value and * store the result in a new Relative value. If both operands are dense, the result is a dense vector or matrix, otherwise * the result is a sparse vector or matrix. * @param rel R; the right operand * @return the multiplication of this vector and the operand * @throws ValueException in case this vector or matrix and the operand have a different size */ public final R times(final R rel) throws ValueException { return instantiateType(this.getData().times(rel.getData()), getUnit()); } /** * Divide this Relative value by a Relative value for a vector or matrix. The division is done value by value and store the * result in a new Relative value. If both operands are dense, the result is a dense vector or matrix, otherwise the result * is a sparse vector or matrix. * @param rel R; the right operand * @return the division of this vector and the operand * @throws ValueException in case this vector or matrix and the operand have a different size */ public final R divide(final R rel) throws ValueException { return instantiateType(this.getData().divide(rel.getData()), getUnit()); } /* ============================================================================================ */ /* ============================= STATIC CONSTRUCTOR HELP METHODS ============================== */ /* ============================================================================================ */ /** * Check that a provided array can be used to create some descendant of a DoubleVector, and return the Unit. * @param dsArray AbstractDoubleScalarRel<U,S>[]; the array to check and get the unit for * @param <U> the unit * @param <S> the scalar type * @return the unit of the object * @throws ValueException when the array has length equal to 0 */ static <U extends Unit<U>, S extends AbstractDoubleScalarRel<U, S>> U checkUnit( |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractDoubleMatrixRel.java | 107 |
org\djunits\value\vdouble\vector\AbstractDoubleVectorRel.java | 160 |
return instantiateScalar(getInUnit(row, column, getUnit()), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Add a Relative value to this Relative value for a matrix or matrix. The addition is done value by value and store the * result in a new Relative value. If both operands are sparse, the result is a sparse matrix or matrix, otherwise the * result is a dense matrix or matrix. * @param rel R; the right operand * @return the addition of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R plus(final R rel) throws ValueException { return instantiateType(this.getData().plus(rel.getData()), getUnit()); } /** * Subtract a Relative value from this Relative value for a matrix or matrix. The subtraction is done value by value and * store the result in a new Relative value. If both operands are sparse, the result is a sparse matrix or matrix, otherwise * the result is a dense matrix or matrix. * @param rel R; the right operand * @return the subtraction of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R minus(final R rel) throws ValueException { return instantiateType(this.getData().minus(rel.getData()), getUnit()); } /** * Multiply a Relative value with this Relative value for a matrix or matrix. The multiplication is done value by value and * store the result in a new Relative value. If both operands are dense, the result is a dense matrix or matrix, otherwise * the result is a sparse matrix or matrix. * @param rel R; the right operand * @return the multiplication of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R times(final R rel) throws ValueException { return instantiateType(this.getData().times(rel.getData()), getUnit()); } /** * Divide this Relative value by a Relative value for a matrix or matrix. The division is done value by value and store the * result in a new Relative value. If both operands are dense, the result is a dense matrix or matrix, otherwise the result * is a sparse matrix or matrix. * @param rel R; the right operand * @return the division of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R divide(final R rel) throws ValueException { return instantiateType(this.getData().divide(rel.getData()), getUnit()); } /* ============================================================================================ */ /* ============================= STATIC CONSTRUCTOR HELP METHODS ============================== */ /* ============================================================================================ */ /** * Check that a provided array can be used to create some descendant of a DoubleMatrix, and return the Unit. * @param dsArray S[][]; the array to check and get the unit for * @param <U> the unit * @param <S> the scalar type * @return the unit of the object * @throws ValueException when the array is null, has length equal to 0, or has first entry with length equal to 0 */ static <U extends Unit<U>, S extends AbstractDoubleScalarRel<U, S>> U checkUnit(final S[][] dsArray) throws ValueException |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\AbstractFloatMatrixRel.java | 107 |
org\djunits\value\vfloat\vector\AbstractFloatVectorRel.java | 160 |
return instantiateScalar(getInUnit(row, column, getUnit()), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Add a Relative value to this Relative value for a matrix or matrix. The addition is done value by value and store the * result in a new Relative value. If both operands are sparse, the result is a sparse matrix or matrix, otherwise the * result is a dense matrix or matrix. * @param rel R; the right operand * @return the addition of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R plus(final R rel) throws ValueException { return instantiateType(this.getData().plus(rel.getData()), getUnit()); } /** * Subtract a Relative value from this Relative value for a matrix or matrix. The subtraction is done value by value and * store the result in a new Relative value. If both operands are sparse, the result is a sparse matrix or matrix, otherwise * the result is a dense matrix or matrix. * @param rel R; the right operand * @return the subtraction of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R minus(final R rel) throws ValueException { return instantiateType(this.getData().minus(rel.getData()), getUnit()); } /** * Multiply a Relative value with this Relative value for a matrix or matrix. The multiplication is done value by value and * store the result in a new Relative value. If both operands are dense, the result is a dense matrix or matrix, otherwise * the result is a sparse matrix or matrix. * @param rel R; the right operand * @return the multiplication of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R times(final R rel) throws ValueException { return instantiateType(this.getData().times(rel.getData()), getUnit()); } /** * Divide this Relative value by a Relative value for a matrix or matrix. The division is done value by value and store the * result in a new Relative value. If both operands are dense, the result is a dense matrix or matrix, otherwise the result * is a sparse matrix or matrix. * @param rel R; the right operand * @return the division of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R divide(final R rel) throws ValueException { return instantiateType(this.getData().divide(rel.getData()), getUnit()); } /* ============================================================================================ */ /* ============================= STATIC CONSTRUCTOR HELP METHODS ============================== */ /* ============================================================================================ */ /** * Check that a provided array can be used to create some descendant of a FloatMatrix, and return the Unit. * @param dsArray S[][]; the array to check and get the unit for * @param <U> the unit * @param <S> the scalar type * @return the unit of the object * @throws ValueException when the array is null, has length equal to 0, or has first entry with length equal to 0 */ static <U extends Unit<U>, S extends AbstractFloatScalarRel<U, S>> U checkUnit(final S[][] dsArray) throws ValueException |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\DoubleMatrixDataSparse.java | 424 |
org\djunits\value\vfloat\matrix\FloatMatrixDataSparse.java | 431 |
double value = this.getSI(r, c) / right.getSI(r, c); if (value != 0.0) { int index = r * cols() + c; newMatrixSI[count] = value; newIndices[count] = index; count++; } } } this.indices = newIndices; this.matrixSI = newMatrixSI; } /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + Arrays.hashCode(this.indices); result = prime * result + this.length; return result; } /** {@inheritDoc} */ @Override @SuppressWarnings({ "checkstyle:needbraces", "checkstyle:designforextension" }) public boolean equals(final Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractMutableDoubleMatrixAbs.java | 252 |
org\djunits\value\vdouble\vector\AbstractMutableDoubleVectorAbs.java | 308 |
DoubleMatrixDataDense dvdd = ((DoubleMatrixDataSparse) this.data).toDense(); dvdd.assign(doubleFunction); this.data = dvdd.toSparse(); } } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MA ceil() { assign(DoubleMathFunctions.CEIL); return (MA) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MA floor() { assign(DoubleMathFunctions.FLOOR); return (MA) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MA rint() { assign(DoubleMathFunctions.RINT); return (MA) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MA round() { assign(DoubleMathFunctions.ROUND); return (MA) this; } /** * Check the copyOnWrite flag and, if it is set, make a deep copy of the data and clear the flag. */ protected final void checkCopyOnWrite() { if (isCopyOnWrite()) { this.data = this.data.copy(); setCopyOnWrite(false); } } /** * Set the value for a cell in the matrix. * @param row int; the row * @param column int; the column * @param valueSI double; the value, expressed in the SI unit * @throws ValueException when the row/column is out of range */ public final void setSI(final int row, final int column, final double valueSI) throws ValueException |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\AbstractMutableFloatMatrixAbs.java | 252 |
org\djunits\value\vfloat\vector\AbstractMutableFloatVectorAbs.java | 307 |
FloatMatrixDataDense dvdd = ((FloatMatrixDataSparse) this.data).toDense(); dvdd.assign(floatFunction); this.data = dvdd.toSparse(); } } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MA ceil() { assign(FloatMathFunctions.CEIL); return (MA) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MA floor() { assign(FloatMathFunctions.FLOOR); return (MA) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MA rint() { assign(FloatMathFunctions.RINT); return (MA) this; } /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public final MA round() { assign(FloatMathFunctions.ROUND); return (MA) this; } /** * Check the copyOnWrite flag and, if it is set, make a deep copy of the data and clear the flag. */ protected final void checkCopyOnWrite() { if (isCopyOnWrite()) { this.data = this.data.copy(); setCopyOnWrite(false); } } /** * Set the value for a cell in the matrix. * @param row int; the row * @param column int; the column * @param valueSI float; the value, expressed in the SI unit * @throws ValueException when the row/column is out of range */ public final void setSI(final int row, final int column, final float valueSI) throws ValueException |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractDoubleMatrixRel.java | 107 |
org\djunits\value\vfloat\vector\AbstractFloatVectorRel.java | 160 |
return instantiateScalar(getInUnit(row, column, getUnit()), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Add a Relative value to this Relative value for a matrix or matrix. The addition is done value by value and store the * result in a new Relative value. If both operands are sparse, the result is a sparse matrix or matrix, otherwise the * result is a dense matrix or matrix. * @param rel R; the right operand * @return the addition of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R plus(final R rel) throws ValueException { return instantiateType(this.getData().plus(rel.getData()), getUnit()); } /** * Subtract a Relative value from this Relative value for a matrix or matrix. The subtraction is done value by value and * store the result in a new Relative value. If both operands are sparse, the result is a sparse matrix or matrix, otherwise * the result is a dense matrix or matrix. * @param rel R; the right operand * @return the subtraction of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R minus(final R rel) throws ValueException { return instantiateType(this.getData().minus(rel.getData()), getUnit()); } /** * Multiply a Relative value with this Relative value for a matrix or matrix. The multiplication is done value by value and * store the result in a new Relative value. If both operands are dense, the result is a dense matrix or matrix, otherwise * the result is a sparse matrix or matrix. * @param rel R; the right operand * @return the multiplication of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R times(final R rel) throws ValueException { return instantiateType(this.getData().times(rel.getData()), getUnit()); } /** * Divide this Relative value by a Relative value for a matrix or matrix. The division is done value by value and store the * result in a new Relative value. If both operands are dense, the result is a dense matrix or matrix, otherwise the result * is a sparse matrix or matrix. * @param rel R; the right operand * @return the division of this matrix and the operand * @throws ValueException in case this matrix or matrix and the operand have a different size */ public final R divide(final R rel) throws ValueException { return instantiateType(this.getData().divide(rel.getData()), getUnit()); } /* ============================================================================================ */ /* ============================= STATIC CONSTRUCTOR HELP METHODS ============================== */ /* ============================================================================================ */ /** * Check that a provided array can be used to create some descendant of a DoubleMatrix, and return the Unit. * @param dsArray S[][]; the array to check and get the unit for * @param <U> the unit * @param <S> the scalar type * @return the unit of the object * @throws ValueException when the array is null, has length equal to 0, or has first entry with length equal to 0 */ static <U extends Unit<U>, S extends AbstractDoubleScalarRel<U, S>> U checkUnit(final S[][] dsArray) throws ValueException |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractDoubleVectorRel.java | 160 |
org\djunits\value\vfloat\matrix\AbstractFloatMatrixRel.java | 107 |
return instantiateScalar(getInUnit(index, getUnit()), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Add a Relative value to this Relative value for a vector or matrix. The addition is done value by value and store the * result in a new Relative value. If both operands are sparse, the result is a sparse vector or matrix, otherwise the * result is a dense vector or matrix. * @param rel R; the right operand * @return the addition of this vector and the operand * @throws ValueException in case this vector or matrix and the operand have a different size */ public final R plus(final R rel) throws ValueException { return instantiateType(this.getData().plus(rel.getData()), getUnit()); } /** * Subtract a Relative value from this Relative value for a vector or matrix. The subtraction is done value by value and * store the result in a new Relative value. If both operands are sparse, the result is a sparse vector or matrix, otherwise * the result is a dense vector or matrix. * @param rel R; the right operand * @return the subtraction of this vector and the operand * @throws ValueException in case this vector or matrix and the operand have a different size */ public final R minus(final R rel) throws ValueException { return instantiateType(this.getData().minus(rel.getData()), getUnit()); } /** * Multiply a Relative value with this Relative value for a vector or matrix. The multiplication is done value by value and * store the result in a new Relative value. If both operands are dense, the result is a dense vector or matrix, otherwise * the result is a sparse vector or matrix. * @param rel R; the right operand * @return the multiplication of this vector and the operand * @throws ValueException in case this vector or matrix and the operand have a different size */ public final R times(final R rel) throws ValueException { return instantiateType(this.getData().times(rel.getData()), getUnit()); } /** * Divide this Relative value by a Relative value for a vector or matrix. The division is done value by value and store the * result in a new Relative value. If both operands are dense, the result is a dense vector or matrix, otherwise the result * is a sparse vector or matrix. * @param rel R; the right operand * @return the division of this vector and the operand * @throws ValueException in case this vector or matrix and the operand have a different size */ public final R divide(final R rel) throws ValueException { return instantiateType(this.getData().divide(rel.getData()), getUnit()); } /* ============================================================================================ */ /* ============================= STATIC CONSTRUCTOR HELP METHODS ============================== */ /* ============================================================================================ */ /** * Check that a provided array can be used to create some descendant of a DoubleVector, and return the Unit. * @param dsArray AbstractDoubleScalarRel<U,S>[]; the array to check and get the unit for * @param <U> the unit * @param <S> the scalar type * @return the unit of the object * @throws ValueException when the array has length equal to 0 */ static <U extends Unit<U>, S extends AbstractDoubleScalarRel<U, S>> U checkUnit( |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractDoubleVectorAbs.java | 171 |
org\djunits\value\vfloat\vector\AbstractFloatVectorAbs.java | 171 |
public final S get(final int index) throws ValueException { return instantiateScalar(getInUnit(index, getUnit()), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** {@inheritDoc} */ @Override public final A plus(final R rel) throws ValueException { return instantiateTypeAbs(this.getData().plus(rel.getData()), getUnit()); } /** {@inheritDoc} */ @Override public A minus(final R rel) throws ValueException { return instantiateTypeAbs(this.getData().minus(rel.getData()), getUnit()); } /** {@inheritDoc} */ @Override public R minus(final A abs) throws ValueException { return instantiateTypeRel(this.getData().minus(abs.getData()), getUnit().getRelativeUnit()); } /* ============================================================================================ */ /* ============================= STATIC CONSTRUCTOR HELP METHODS ============================== */ /* ============================================================================================ */ /** * Check that a provided array can be used to create some descendant of a DoubleVector, and return the Unit. * @param dsArray S[]; the array to check and get the unit for * @param <AU> the absolute unit * @param <RU> the corresponding relative unit * @param <S> the scalar type * @return the unit of the object * @throws ValueException when the array has length equal to 0 */ static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, S extends AbstractDoubleScalarAbs<AU, S, RU, ?>> AU checkUnit(final S[] dsArray) throws ValueException |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\DoubleMatrixData.java | 398 |
org\djunits\value\vfloat\matrix\FloatMatrixData.java | 406 |
public void divideBy(final double valueSI) { IntStream.range(0, this.matrixSI.length).parallel().forEach(i -> this.matrixSI[i] /= valueSI); } /* ============================================================================================ */ /* =============================== EQUALS, HASHCODE, TOSTRING ================================= */ /* ============================================================================================ */ /** {@inheritDoc} */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + this.rows; result = prime * result + this.cols; result = prime * result + ((this.storageType == null) ? 0 : this.storageType.hashCode()); result = prime * result + Arrays.hashCode(this.matrixSI); return result; } /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:needbraces") public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; |
File | Line |
---|---|
org\djunits\value\vdouble\scalar\Energy.java | 217 |
org\djunits\value\vdouble\scalar\Torque.java | 217 |
public final Dimensionless divideBy(final Energy v) { return new Dimensionless(this.si / v.si, DimensionlessUnit.SI); } /** * Calculate the division of Energy and Force, which results in a Length scalar. * @param v Energy scalar * @return Length scalar as a division of Energy and Force */ public final Length divideBy(final Force v) { return new Length(this.si / v.si, LengthUnit.SI); } /** * Calculate the division of Energy and Length, which results in a Force scalar. * @param v Energy scalar * @return Force scalar as a division of Energy and Length */ public final Force divideBy(final Length v) { return new Force(this.si / v.si, ForceUnit.SI); } /** * Calculate the multiplication of Energy and LinearDensity, which results in a Force scalar. * @param v Energy scalar * @return Force scalar as a multiplication of Energy and LinearDensity */ public final Force multiplyBy(final LinearDensity v) { return new Force(this.si * v.si, ForceUnit.SI); } /** * Calculate the division of Energy and Duration, which results in a Power scalar. * @param v Energy scalar * @return Power scalar as a division of Energy and Duration */ public final Power divideBy(final Duration v) { return new Power(this.si / v.si, PowerUnit.SI); } /** * Calculate the division of Energy and Power, which results in a Duration scalar. * @param v Energy scalar * @return Duration scalar as a division of Energy and Power */ public final Duration divideBy(final Power v) { return new Duration(this.si / v.si, DurationUnit.SI); } /** * Calculate the division of Energy and Volume, which results in a Pressure scalar. * @param v Energy scalar * @return Pressure scalar as a division of Energy and Volume */ public final Pressure divideBy(final Volume v) |
File | Line |
---|---|
org\djunits\value\vfloat\scalar\FloatEnergy.java | 227 |
org\djunits\value\vfloat\scalar\FloatTorque.java | 227 |
public final FloatDimensionless divideBy(final FloatEnergy v) { return new FloatDimensionless(this.si / v.si, DimensionlessUnit.SI); } /** * Calculate the division of FloatEnergy and FloatForce, which results in a FloatLength scalar. * @param v FloatEnergy scalar * @return FloatLength scalar as a division of FloatEnergy and FloatForce */ public final FloatLength divideBy(final FloatForce v) { return new FloatLength(this.si / v.si, LengthUnit.SI); } /** * Calculate the division of FloatEnergy and FloatLength, which results in a FloatForce scalar. * @param v FloatEnergy scalar * @return FloatForce scalar as a division of FloatEnergy and FloatLength */ public final FloatForce divideBy(final FloatLength v) { return new FloatForce(this.si / v.si, ForceUnit.SI); } /** * Calculate the multiplication of FloatEnergy and FloatLinearDensity, which results in a FloatForce scalar. * @param v FloatEnergy scalar * @return FloatForce scalar as a multiplication of FloatEnergy and FloatLinearDensity */ public final FloatForce multiplyBy(final FloatLinearDensity v) { return new FloatForce(this.si * v.si, ForceUnit.SI); } /** * Calculate the division of FloatEnergy and FloatDuration, which results in a FloatPower scalar. * @param v FloatEnergy scalar * @return FloatPower scalar as a division of FloatEnergy and FloatDuration */ public final FloatPower divideBy(final FloatDuration v) { return new FloatPower(this.si / v.si, PowerUnit.SI); } /** * Calculate the division of FloatEnergy and FloatPower, which results in a FloatDuration scalar. * @param v FloatEnergy scalar * @return FloatDuration scalar as a division of FloatEnergy and FloatPower */ public final FloatDuration divideBy(final FloatPower v) { return new FloatDuration(this.si / v.si, DurationUnit.SI); } /** * Calculate the division of FloatEnergy and FloatVolume, which results in a FloatPressure scalar. * @param v FloatEnergy scalar * @return FloatPressure scalar as a division of FloatEnergy and FloatVolume */ public final FloatPressure divideBy(final FloatVolume v) |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractDoubleVector.java | 228 |
org\djunits\value\vfloat\vector\AbstractFloatVector.java | 237 |
protected final void checkSize(final double[] other) throws ValueException { if (size() != other.length) { throw new ValueException("The vector and the array have different sizes: " + size() + " != " + other.length); } } /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public int hashCode() { final int prime = 31; int result = getUnit().getStandardUnit().hashCode(); result = prime * result + ((this.data == null) ? 0 : this.data.hashCode()); return result; } /** {@inheritDoc} */ @Override @SuppressWarnings({ "checkstyle:designforextension", "checkstyle:needbraces", "unchecked" }) public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractDoubleMatrix.java | 258 |
org\djunits\value\vfloat\matrix\AbstractFloatMatrix.java | 258 |
protected final void checkSize(final double[][] other) throws ValueException { ensureRectangularAndNonEmpty(other); final int otherColumns = other[0].length; if (rows() != other.length || columns() != otherColumns) { throw new ValueException("The matrix and the array have different sizes: " + rows() + "x" + columns() + " != " + other.length + "x" + otherColumns); } } /** * Check that provided row and column indices are valid. * @param row int; the row value to check * @param column int; the column value to check * @throws ValueException when row or column is invalid */ protected final void checkIndex(final int row, final int column) throws ValueException { if (row < 0 || row >= rows() || column < 0 || column >= columns()) { throw new ValueException("index out of range (valid range is 0.." + (rows() - 1) + ", 0.." + (columns() - 1) + ", got " + row + ", " + column + ")"); } } /** {@inheritDoc} */ @Override public final double determinant() throws ValueException |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractDoubleMatrix.java | 129 |
org\djunits\value\vdouble\vector\AbstractDoubleVector.java | 129 |
return ValueUtil.expressAsUnit(getSI(row, column), targetUnit); } /** {@inheritDoc} */ @Override public final double zSum() { return this.data.zSum(); } /** {@inheritDoc} */ @Override public final int cardinality() { return this.data.cardinality(); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getUnit(), false, true); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit) { return toString(displayUnit, false, true); } /** {@inheritDoc} */ @Override public final String toString(final boolean verbose, final boolean withUnit) { return toString(getUnit(), verbose, withUnit); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit) { StringBuffer buf = new StringBuffer(); if (verbose) { String ab = this instanceof Absolute ? "Abs " : "Rel "; |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\AbstractFloatMatrix.java | 129 |
org\djunits\value\vfloat\vector\AbstractFloatVector.java | 138 |
return (float) ValueUtil.expressAsUnit(getSI(row, column), targetUnit); } /** {@inheritDoc} */ @Override public final float zSum() { return this.data.zSum(); } /** {@inheritDoc} */ @Override public final int cardinality() { return this.data.cardinality(); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getUnit(), false, true); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit) { return toString(displayUnit, false, true); } /** {@inheritDoc} */ @Override public final String toString(final boolean verbose, final boolean withUnit) { return toString(getUnit(), verbose, withUnit); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit) { StringBuffer buf = new StringBuffer(); if (verbose) { String ab = this instanceof Absolute ? "Abs " : "Rel "; |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractDoubleMatrix.java | 292 |
org\djunits\value\vfloat\matrix\AbstractFloatMatrix.java | 292 |
return m.getDeterminant().doubleValue(); } catch (IllegalArgumentException exception) { throw new ValueException(exception); // Matrix must be square } } /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public int hashCode() { final int prime = 31; int result = getUnit().getStandardUnit().hashCode(); result = prime * result + ((this.data == null) ? 0 : this.data.hashCode()); return result; } /** {@inheritDoc} */ @Override @SuppressWarnings({ "checkstyle:designforextension", "checkstyle:needbraces", "unchecked" }) public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractDoubleMatrix.java | 134 |
org\djunits\value\vfloat\vector\AbstractFloatVector.java | 143 |
public final double zSum() { return this.data.zSum(); } /** {@inheritDoc} */ @Override public final int cardinality() { return this.data.cardinality(); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getUnit(), false, true); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit) { return toString(displayUnit, false, true); } /** {@inheritDoc} */ @Override public final String toString(final boolean verbose, final boolean withUnit) { return toString(getUnit(), verbose, withUnit); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit) { StringBuffer buf = new StringBuffer(); if (verbose) { String ab = this instanceof Absolute ? "Abs " : "Rel "; |
File | Line |
---|---|
org\djunits\value\vdouble\scalar\AbstractDoubleScalar.java | 45 |
org\djunits\value\vfloat\scalar\AbstractFloatScalar.java | 45 |
public final double getSI() { return this.si; } /** * Test if this DoubleScalar is less than a DoubleScalar. * @param o T, a relative typed DoubleScalar; the right hand side operand of the comparison * @return boolean */ public final boolean lt(final T o) { return this.si < o.si; } /** * Test if this DoubleScalar is less than or equal to a DoubleScalar. * @param o T, a relative typed DoubleScalar; the right hand side operand of the comparison * @return boolean */ public final boolean le(final T o) { return this.si <= o.si; } /** * Test if this DoubleScalar is greater than or equal to a DoubleScalar. * @param o T, a relative typed DoubleScalar; the right hand side operand of the comparison * @return boolean */ public final boolean gt(final T o) { return this.si > o.si; } /** * Test if this DoubleScalar is greater than a DoubleScalar. * @param o T, a relative typed DoubleScalar; the right hand side operand of the comparison * @return boolean */ public final boolean ge(final T o) { return this.si >= o.si; } /** * Test if this DoubleScalar is equal to a DoubleScalar. * @param o T, a relative typed DoubleScalar; the right hand side operand of the comparison * @return boolean */ public final boolean eq(final T o) { return this.si == o.si; } /** * Test if this DoubleScalar is not equal to a DoubleScalar. * @param o T, a relative typed DoubleScalar; the right hand side operand of the comparison * @return boolean */ public final boolean ne(final T o) { return this.si != o.si; } /** * Test if this DoubleScalar is less than 0.0. * @return boolean */ public final boolean lt0() { return this.si < 0.0; |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractDoubleVector.java | 134 |
org\djunits\value\vfloat\matrix\AbstractFloatMatrix.java | 134 |
public final double zSum() { return this.data.zSum(); } /** {@inheritDoc} */ @Override public final int cardinality() { return this.data.cardinality(); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getUnit(), false, true); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit) { return toString(displayUnit, false, true); } /** {@inheritDoc} */ @Override public final String toString(final boolean verbose, final boolean withUnit) { return toString(getUnit(), verbose, withUnit); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit) { StringBuffer buf = new StringBuffer(); if (verbose) { String ar = this instanceof Absolute ? "Abs " : "Rel "; |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractDoubleVectorAbs.java | 263 |
org\djunits\value\vdouble\vector\AbstractDoubleVectorRel.java | 276 |
org\djunits\value\vfloat\vector\AbstractFloatVectorAbs.java | 260 |
org\djunits\value\vfloat\vector\AbstractFloatVectorRel.java | 273 |
"Cannot create a DoubleVector or MutableDoubleVector from a null or empty Map of DoubleScalar"); } /* ============================================================================================ */ /* =============================== ITERATOR METHODS AND CLASS ================================= */ /* ============================================================================================ */ /** * Returns an iterator over the scalars in this vector in proper sequence. * @return an iterator over the scalars in this vector in proper sequence */ @Override public Iterator<S> iterator() { return new Itr(); } /** * The iterator class is loosely based in AbstractList.Itr. It does not throw a ConcurrentModificationException, because the * size of the vector does not change. Normal (non-mutable) vectors cannot change their size, nor their content. The only * thing for the MutableVector that can change is its content, not its length. */ protected class Itr implements Iterator<S> { /** index of next element to return. */ private int cursor = 0; @Override public boolean hasNext() { return this.cursor != size(); } /** {@inheritDoc} */ @Override public S next() { if (this.cursor >= size()) { throw new NoSuchElementException(); } try { int i = this.cursor; S next = get(i); this.cursor = i + 1; return next; } catch (ValueException exception) { throw new RuntimeException(exception); } } /** {@inheritDoc} */ @Override public void remove() { throw new RuntimeException("Remove function cannot be applied on fixed-size DJUNITS Vector"); } } } |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractMutableDoubleMatrixAbs.java | 291 |
org\djunits\value\vdouble\matrix\AbstractMutableDoubleMatrixRel.java | 339 |
return (MA) this; } /** * Check the copyOnWrite flag and, if it is set, make a deep copy of the data and clear the flag. */ protected final void checkCopyOnWrite() { if (isCopyOnWrite()) { this.data = this.data.copy(); setCopyOnWrite(false); } } /** * Set the value for a cell in the matrix. * @param row int; the row * @param column int; the column * @param valueSI double; the value, expressed in the SI unit * @throws ValueException when the row/column is out of range */ public final void setSI(final int row, final int column, final double valueSI) throws ValueException { checkIndex(row, column); checkCopyOnWrite(); this.data.setSI(row, column, valueSI); } /** * Set the value for a cell in the matrix. * @param row int; the row * @param column int; the column * @param value S; the value * @throws ValueException when the row/column is out of range */ public final void set(final int row, final int column, final S value) throws ValueException { setSI(row, column, value.getSI()); } /** * Set the value for a cell in the matrix. * @param row int; the row * @param column int; the column * @param value double; the value, expressed in the given unit * @param valueUnit AU; the unit of the value * @throws ValueException when the row/column is out of range */ public final void setInUnit(final int row, final int column, final double value, final AU valueUnit) throws ValueException |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\AbstractMutableFloatMatrixAbs.java | 291 |
org\djunits\value\vfloat\matrix\AbstractMutableFloatMatrixRel.java | 339 |
return (MA) this; } /** * Check the copyOnWrite flag and, if it is set, make a deep copy of the data and clear the flag. */ protected final void checkCopyOnWrite() { if (isCopyOnWrite()) { this.data = this.data.copy(); setCopyOnWrite(false); } } /** * Set the value for a cell in the matrix. * @param row int; the row * @param column int; the column * @param valueSI float; the value, expressed in the SI unit * @throws ValueException when the row/column is out of range */ public final void setSI(final int row, final int column, final float valueSI) throws ValueException { checkIndex(row, column); checkCopyOnWrite(); this.data.setSI(row, column, valueSI); } /** * Set the value for a cell in the matrix. * @param row int; the row * @param column int; the column * @param value S; the value * @throws ValueException when the row/column is out of range */ public final void set(final int row, final int column, final S value) throws ValueException { setSI(row, column, value.getSI()); } /** * Set the value for a cell in the matrix. * @param row int; the row * @param column int; the column * @param value float; the value, expressed in the given unit * @param valueUnit AU; the unit of the value * @throws ValueException when the row/column is out of range */ public final void setInUnit(final int row, final int column, final float value, final AU valueUnit) throws ValueException |
File | Line |
---|---|
org\djunits\value\vdouble\vector\DoubleVectorDataSparse.java | 148 |
org\djunits\value\vdouble\vector\DoubleVectorDataSparse.java | 174 |
public final void incrementBy(final DoubleVectorData right) throws ValueException { int newLength = (int) IntStream.range(0, size()).parallel().filter(i -> this.getSI(i) != 0.0 || right.getSI(i) != 0.0).count(); double[] newVectorSI = new double[newLength]; int[] newIndices = new int[newLength]; // fill the sparse data structures. Cannot be parallelized because of stateful and sequence-sensitive count // note: if adding -2 and +2, a 0-value will be part of the new sparse vector. int count = 0; for (int i = 0; i < size(); i++) { if (this.getSI(i) != 0.0 || right.getSI(i) != 0.0) { newVectorSI[count] = getSI(i) + right.getSI(i); |
File | Line |
---|---|
org\djunits\value\vdouble\vector\DoubleVectorDataSparse.java | 200 |
org\djunits\value\vdouble\vector\DoubleVectorDataSparse.java | 225 |
public final void multiplyBy(final DoubleVectorData right) throws ValueException { int newLength = (int) IntStream.range(0, size()).parallel().filter(i -> this.getSI(i) != 0.0 && right.getSI(i) != 0.0).count(); double[] newVectorSI = new double[newLength]; int[] newIndices = new int[newLength]; // fill the sparse data structures. Cannot be parallelized because of stateful and sequence-sensitive count int count = 0; for (int i = 0; i < size(); i++) { if (this.getSI(i) != 0.0 && right.getSI(i) != 0.0) { newVectorSI[count] = getSI(i) * right.getSI(i); |
File | Line |
---|---|
org\djunits\value\vfloat\vector\FloatVectorDataSparse.java | 147 |
org\djunits\value\vfloat\vector\FloatVectorDataSparse.java | 173 |
public final void incrementBy(final FloatVectorData right) throws ValueException { int newLength = (int) IntStream.range(0, size()).parallel().filter(i -> this.getSI(i) != 0.0 || right.getSI(i) != 0.0).count(); float[] newVectorSI = new float[newLength]; int[] newIndices = new int[newLength]; // fill the sparse data structures. Cannot be parallelized because of stateful and sequence-sensitive count // note: if adding -2 and +2, a 0-value will be part of the new sparse matrix. int count = 0; for (int i = 0; i < size(); i++) { if (this.getSI(i) != 0.0 || right.getSI(i) != 0.0) { newVectorSI[count] = getSI(i) + right.getSI(i); |
File | Line |
---|---|
org\djunits\value\vfloat\vector\FloatVectorDataSparse.java | 199 |
org\djunits\value\vfloat\vector\FloatVectorDataSparse.java | 224 |
public final void multiplyBy(final FloatVectorData right) throws ValueException { int newLength = (int) IntStream.range(0, size()).parallel().filter(i -> this.getSI(i) != 0.0 && right.getSI(i) != 0.0).count(); float[] newVectorSI = new float[newLength]; int[] newIndices = new int[newLength]; // fill the sparse data structures. Cannot be parallelized because of stateful and sequence-sensitive count int count = 0; for (int i = 0; i < size(); i++) { if (this.getSI(i) != 0.0 && right.getSI(i) != 0.0) { newVectorSI[count] = getSI(i) * right.getSI(i); |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbsoluteTemperatureVector.java | 115 |
org\djunits\value\vdouble\vector\MutableAbsoluteTemperatureVector.java | 115 |
AbsoluteTemperatureVector(final DoubleVectorData data, final AbsoluteTemperatureUnit unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final AbsoluteTemperatureVector instantiateTypeAbs(final DoubleVectorData dvd, final AbsoluteTemperatureUnit unit) { return new AbsoluteTemperatureVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final TemperatureVector instantiateTypeRel(final DoubleVectorData dvd, final TemperatureUnit unit) { return new TemperatureVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutableAbsoluteTemperatureVector instantiateMutableType(final DoubleVectorData dvd, final AbsoluteTemperatureUnit unit) { return new MutableAbsoluteTemperatureVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final AbsoluteTemperature instantiateScalar(final double value, final AbsoluteTemperatureUnit unit) { return new AbsoluteTemperature(value, unit); } /** {@inheritDoc} */ @Override public final AbsoluteTemperatureVector toDense() |
File | Line |
---|---|
org\djunits\value\vdouble\vector\DirectionVector.java | 110 |
org\djunits\value\vdouble\vector\MutableDirectionVector.java | 111 |
DirectionVector(final DoubleVectorData data, final DirectionUnit unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final DirectionVector instantiateTypeAbs(final DoubleVectorData dvd, final DirectionUnit unit) { return new DirectionVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final AngleVector instantiateTypeRel(final DoubleVectorData dvd, final AngleUnit unit) { return new AngleVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutableDirectionVector instantiateMutableType(final DoubleVectorData dvd, final DirectionUnit unit) { return new MutableDirectionVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final Direction instantiateScalar(final double value, final DirectionUnit unit) { return new Direction(value, unit); } /** {@inheritDoc} */ @Override public final DirectionVector toDense() |
File | Line |
---|---|
org\djunits\value\vdouble\vector\MutablePositionVector.java | 111 |
org\djunits\value\vdouble\vector\PositionVector.java | 110 |
MutablePositionVector(final DoubleVectorData data, final PositionUnit unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final PositionVector instantiateTypeAbs(final DoubleVectorData dvd, final PositionUnit unit) { return new PositionVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final LengthVector instantiateTypeRel(final DoubleVectorData dvd, final LengthUnit unit) { return new LengthVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutablePositionVector instantiateMutableType(final DoubleVectorData dvd, final PositionUnit unit) { return new MutablePositionVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final Position instantiateScalar(final double value, final PositionUnit unit) { return new Position(value, unit); } /** {@inheritDoc} */ @Override public final MutablePositionVector toDense() |
File | Line |
---|---|
org\djunits\value\vdouble\vector\MutableTimeVector.java | 110 |
org\djunits\value\vdouble\vector\TimeVector.java | 109 |
MutableTimeVector(final DoubleVectorData data, final TimeUnit unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final TimeVector instantiateTypeAbs(final DoubleVectorData dvd, final TimeUnit unit) { return new TimeVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final DurationVector instantiateTypeRel(final DoubleVectorData dvd, final DurationUnit unit) { return new DurationVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutableTimeVector instantiateMutableType(final DoubleVectorData dvd, final TimeUnit unit) { return new MutableTimeVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final Time instantiateScalar(final double value, final TimeUnit unit) { return new Time(value, unit); } /** {@inheritDoc} */ @Override public final MutableTimeVector toDense() |
File | Line |
---|---|
org\djunits\value\vfloat\vector\FloatAbsoluteTemperatureVector.java | 115 |
org\djunits\value\vfloat\vector\MutableFloatAbsoluteTemperatureVector.java | 116 |
FloatAbsoluteTemperatureVector(final FloatVectorData data, final AbsoluteTemperatureUnit unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final FloatAbsoluteTemperatureVector instantiateTypeAbs(final FloatVectorData dvd, final AbsoluteTemperatureUnit unit) { return new FloatAbsoluteTemperatureVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final FloatTemperatureVector instantiateTypeRel(final FloatVectorData dvd, final TemperatureUnit unit) { return new FloatTemperatureVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatAbsoluteTemperatureVector instantiateMutableType(final FloatVectorData dvd, final AbsoluteTemperatureUnit unit) { return new MutableFloatAbsoluteTemperatureVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final FloatAbsoluteTemperature instantiateScalar(final float value, final AbsoluteTemperatureUnit unit) { return new FloatAbsoluteTemperature(value, unit); } /** {@inheritDoc} */ @Override public final FloatAbsoluteTemperatureVector toDense() |
File | Line |
---|---|
org\djunits\value\vfloat\vector\FloatDirectionVector.java | 111 |
org\djunits\value\vfloat\vector\MutableFloatDirectionVector.java | 111 |
FloatDirectionVector(final FloatVectorData data, final DirectionUnit unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final FloatDirectionVector instantiateTypeAbs(final FloatVectorData dvd, final DirectionUnit unit) { return new FloatDirectionVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final FloatAngleVector instantiateTypeRel(final FloatVectorData dvd, final AngleUnit unit) { return new FloatAngleVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatDirectionVector instantiateMutableType(final FloatVectorData dvd, final DirectionUnit unit) { return new MutableFloatDirectionVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final FloatDirection instantiateScalar(final float value, final DirectionUnit unit) { return new FloatDirection(value, unit); } /** {@inheritDoc} */ @Override public final FloatDirectionVector toDense() |
File | Line |
---|---|
org\djunits\value\vfloat\vector\FloatPositionVector.java | 111 |
org\djunits\value\vfloat\vector\MutableFloatPositionVector.java | 111 |
FloatPositionVector(final FloatVectorData data, final PositionUnit unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final FloatPositionVector instantiateTypeAbs(final FloatVectorData dvd, final PositionUnit unit) { return new FloatPositionVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final FloatLengthVector instantiateTypeRel(final FloatVectorData dvd, final LengthUnit unit) { return new FloatLengthVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatPositionVector instantiateMutableType(final FloatVectorData dvd, final PositionUnit unit) { return new MutableFloatPositionVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final FloatPosition instantiateScalar(final float value, final PositionUnit unit) { return new FloatPosition(value, unit); } /** {@inheritDoc} */ @Override public final FloatPositionVector toDense() |
File | Line |
---|---|
org\djunits\value\vfloat\vector\FloatTimeVector.java | 109 |
org\djunits\value\vfloat\vector\MutableFloatTimeVector.java | 111 |
FloatTimeVector(final FloatVectorData data, final TimeUnit unit) { super(data, unit); } /** {@inheritDoc} */ @Override protected final FloatTimeVector instantiateTypeAbs(final FloatVectorData dvd, final TimeUnit unit) { return new FloatTimeVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final FloatDurationVector instantiateTypeRel(final FloatVectorData dvd, final DurationUnit unit) { return new FloatDurationVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatTimeVector instantiateMutableType(final FloatVectorData dvd, final TimeUnit unit) { return new MutableFloatTimeVector(dvd, unit); } /** {@inheritDoc} */ @Override protected final FloatTime instantiateScalar(final float value, final TimeUnit unit) { return new FloatTime(value, unit); } /** {@inheritDoc} */ @Override public final FloatTimeVector toDense() |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\DoubleMatrix.java | 171 |
org\djunits\value\vdouble\matrix\MutableDoubleMatrix.java | 178 |
return this.data.isSparse() ? this : instantiateType(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final DoubleMatrix.Rel<U> instantiateType(final DoubleMatrixData dmd, final U unit) { return new DoubleMatrix.Rel<U>(dmd, unit); } /** {@inheritDoc} */ @Override protected final MutableDoubleMatrix.Rel<U> instantiateMutableType(final DoubleMatrixData dmd, final U unit) { return new MutableDoubleMatrix.Rel<U>(dmd, unit); } /** {@inheritDoc} */ @Override protected final DoubleScalar.Rel<U> instantiateScalar(final double value, final U unit) { return new DoubleScalar.Rel<U>(value, unit); } } |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\FloatMatrix.java | 169 |
org\djunits\value\vfloat\matrix\MutableFloatMatrix.java | 175 |
return this.data.isSparse() ? this : instantiateType(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final FloatMatrix.Rel<U> instantiateType(final FloatMatrixData dmd, final U unit) { return new FloatMatrix.Rel<U>(dmd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatMatrix.Rel<U> instantiateMutableType(final FloatMatrixData dmd, final U unit) { return new MutableFloatMatrix.Rel<U>(dmd, unit); } /** {@inheritDoc} */ @Override protected final FloatScalar.Rel<U> instantiateScalar(final float value, final U unit) { return new FloatScalar.Rel<U>(value, unit); } } |
File | Line |
---|---|
org\djunits\value\vdouble\scalar\AbstractDoubleScalar.java | 216 |
org\djunits\value\vfloat\scalar\AbstractFloatScalar.java | 217 |
public final double doubleValue() { return getSI(); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getUnit(), false, true); } /** * Print this DoubleScalar with the value expressed in the specified unit. * @param displayUnit U; the unit into which the value is converted for display * @return String; printable string with the scalar contents expressed in the specified unit */ public final String toString(final U displayUnit) { return toString(displayUnit, false, true); } /** * Print this DoubleScalar with optional type and unit information. * @param verbose boolean; if true; include type info; if false; exclude type info * @param withUnit boolean; if true; include the unit; of false; exclude the unit * @return String; printable string with the scalar contents */ public final String toString(final boolean verbose, final boolean withUnit) { return toString(getUnit(), verbose, withUnit); } /** * Print this DoubleScalar with the value expressed in the specified unit. * @param displayUnit U; the unit into which the value is converted for display * @param verbose boolean; if true; include type info; if false; exclude type info * @param withUnit boolean; if true; include the unit; of false; exclude the unit * @return String; printable string with the scalar contents */ public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit) { StringBuffer buf = new StringBuffer(); if (verbose) { buf.append(this instanceof Absolute ? "Abs " : "Rel "); } |
File | Line |
---|---|
org\djunits\value\vdouble\scalar\AbstractDoubleScalarAbs.java | 67 |
org\djunits\value\vfloat\scalar\AbstractFloatScalarAbs.java | 67 |
public abstract R instantiateRel(double value, RU unit); /** * Increment the value by the supplied value and return the result using the current unit of the Absolute value. * @param increment R, a relative typed DoubleScalar; amount by which the value is incremented * @return Absolute DoubleScalar */ public final A plus(final R increment) { AU targetUnit = getUnit(); return instantiateAbs(getInUnit() + increment.getInUnit(targetUnit.getRelativeUnit()), targetUnit); } /** * Decrement the value by the supplied value and return the result using the current unit of the Absolute value. * @param decrement R, a relative typed DoubleScalar; amount by which the value is decremented * @return Absolute DoubleScalar */ public final A minus(final R decrement) { AU targetUnit = getUnit(); return instantiateAbs(getInUnit() - decrement.getInUnit(targetUnit.getRelativeUnit()), targetUnit); } /** * Decrement the value by the supplied value and return the result using the relative unit belonging to the unit of the * Absolute value. * @param decrement A, an absolute typed DoubleScalar; amount by which the value is decremented * @return Relative DoubleScalar */ public final R minus(final A decrement) { RU targetUnit = getUnit().getRelativeUnit(); return instantiateRel(getInUnit() - decrement.getInUnit(getUnit()), targetUnit); } |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\DoubleMatrixDataSparse.java | 194 |
org\djunits\value\vfloat\matrix\FloatMatrixDataSparse.java | 193 |
double[] matrixSINew = new double[this.matrixSI.length + 1]; System.arraycopy(this.indices, 0, indicesNew, 0, internalIndex); System.arraycopy(this.matrixSI, 0, matrixSINew, 0, internalIndex); System.arraycopy(this.indices, internalIndex, indicesNew, internalIndex - 1, this.indices.length - internalIndex); System.arraycopy(this.matrixSI, internalIndex, matrixSINew, internalIndex - 1, this.indices.length - internalIndex); indicesNew[internalIndex] = index; matrixSINew[internalIndex] = valueSI; this.indices = indicesNew; this.matrixSI = matrixSINew; } /** {@inheritDoc} */ @Override public final double[][] getDenseMatrixSI() |
File | Line |
---|---|
org\djunits\value\vdouble\vector\DoubleVectorDataSparse.java | 86 |
org\djunits\value\vfloat\vector\FloatVectorDataSparse.java | 86 |
double[] vectorSINew = new double[this.vectorSI.length + 1]; System.arraycopy(this.indices, 0, indicesNew, 0, internalIndex); System.arraycopy(this.vectorSI, 0, vectorSINew, 0, internalIndex); // System.out.println("arraycopy1 current size is " + this.indices.length + " srcPos=" + internalIndex + // ", new size is " // + indicesNew.length + " dstPos=" + (internalIndex + 1) + " length=" + (this.indices.length - internalIndex)); System.arraycopy(this.indices, internalIndex, indicesNew, internalIndex + 1, this.indices.length - internalIndex); System.arraycopy(this.vectorSI, internalIndex, vectorSINew, internalIndex + 1, this.indices.length - internalIndex); // System.arraycopy(this.indices, internalIndex, indicesNew, internalIndex - 1, this.indices.length - internalIndex); // System.arraycopy(this.vectorSI, internalIndex, vectorSINew, internalIndex - 1, this.indices.length - internalIndex); indicesNew[internalIndex] = index; vectorSINew[internalIndex] = valueSI; this.indices = indicesNew; this.vectorSI = vectorSINew; } /** {@inheritDoc} */ @Override public final double[] getDenseVectorSI() |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbsoluteTemperatureMatrix.java | 71 |
org\djunits\value\vdouble\matrix\MutableAbsoluteTemperatureMatrix.java | 73 |
return this.data.isSparse() ? this : instantiateTypeAbs(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final AbsoluteTemperatureMatrix instantiateTypeAbs(final DoubleMatrixData dmd, final AbsoluteTemperatureUnit unit) { return new AbsoluteTemperatureMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final TemperatureMatrix instantiateTypeRel(final DoubleMatrixData dmd, final TemperatureUnit unit) { return new TemperatureMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final MutableAbsoluteTemperatureMatrix instantiateMutableType(final DoubleMatrixData dmd, final AbsoluteTemperatureUnit unit) { return new MutableAbsoluteTemperatureMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final AbsoluteTemperature instantiateScalar(final double value, final AbsoluteTemperatureUnit unit) { return new AbsoluteTemperature(value, unit); } } |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractDoubleMatrix.java | 296 |
org\djunits\value\vdouble\vector\AbstractDoubleVector.java | 232 |
org\djunits\value\vfloat\matrix\AbstractFloatMatrix.java | 296 |
org\djunits\value\vfloat\vector\AbstractFloatVector.java | 241 |
throw new ValueException(exception); // Matrix must be square } } /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public int hashCode() { final int prime = 31; int result = getUnit().getStandardUnit().hashCode(); result = prime * result + ((this.data == null) ? 0 : this.data.hashCode()); return result; } /** {@inheritDoc} */ @Override @SuppressWarnings({ "checkstyle:designforextension", "checkstyle:needbraces", "unchecked" }) public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\DirectionMatrix.java | 71 |
org\djunits\value\vdouble\matrix\MutableDirectionMatrix.java | 71 |
return this.data.isSparse() ? this : instantiateTypeAbs(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final DirectionMatrix instantiateTypeAbs(final DoubleMatrixData dmd, final DirectionUnit unit) { return new DirectionMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final AngleMatrix instantiateTypeRel(final DoubleMatrixData dmd, final AngleUnit unit) { return new AngleMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final MutableDirectionMatrix instantiateMutableType(final DoubleMatrixData dmd, final DirectionUnit unit) { return new MutableDirectionMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final Direction instantiateScalar(final double value, final DirectionUnit unit) { return new Direction(value, unit); } } |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\MutablePositionMatrix.java | 71 |
org\djunits\value\vdouble\matrix\PositionMatrix.java | 70 |
return this.data.isSparse() ? this : instantiateMutableType(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final PositionMatrix instantiateTypeAbs(final DoubleMatrixData dmd, final PositionUnit unit) { return new PositionMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final LengthMatrix instantiateTypeRel(final DoubleMatrixData dmd, final LengthUnit unit) { return new LengthMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final MutablePositionMatrix instantiateMutableType(final DoubleMatrixData dmd, final PositionUnit unit) { return new MutablePositionMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final Position instantiateScalar(final double value, final PositionUnit unit) { return new Position(value, unit); } } |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\MutableTimeMatrix.java | 76 |
org\djunits\value\vdouble\matrix\TimeMatrix.java | 76 |
return this.data.isSparse() ? this : instantiateMutableType(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final TimeMatrix instantiateTypeAbs(final DoubleMatrixData dmd, final TimeUnit unit) { return new TimeMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final DurationMatrix instantiateTypeRel(final DoubleMatrixData dmd, final DurationUnit unit) { return new DurationMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final MutableTimeMatrix instantiateMutableType(final DoubleMatrixData dmd, final TimeUnit unit) { return new MutableTimeMatrix(dmd, unit); } /** {@inheritDoc} */ @Override protected final Time instantiateScalar(final double value, final TimeUnit unit) { return new Time(value, unit); } } |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\FloatAbsoluteTemperatureMatrix.java | 73 |
org\djunits\value\vfloat\matrix\MutableFloatAbsoluteTemperatureMatrix.java | 74 |
return this.data.isSparse() ? this : instantiateTypeAbs(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final FloatAbsoluteTemperatureMatrix instantiateTypeAbs(final FloatMatrixData fmd, final AbsoluteTemperatureUnit unit) { return new FloatAbsoluteTemperatureMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final FloatTemperatureMatrix instantiateTypeRel(final FloatMatrixData fmd, final TemperatureUnit unit) { return new FloatTemperatureMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatAbsoluteTemperatureMatrix instantiateMutableType(final FloatMatrixData fmd, final AbsoluteTemperatureUnit unit) { return new MutableFloatAbsoluteTemperatureMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final FloatAbsoluteTemperature instantiateScalar(final float value, final AbsoluteTemperatureUnit unit) { return new FloatAbsoluteTemperature(value, unit); } } |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\FloatDirectionMatrix.java | 71 |
org\djunits\value\vfloat\matrix\MutableFloatDirectionMatrix.java | 71 |
return this.data.isSparse() ? this : instantiateTypeAbs(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final FloatDirectionMatrix instantiateTypeAbs(final FloatMatrixData fmd, final DirectionUnit unit) { return new FloatDirectionMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final FloatAngleMatrix instantiateTypeRel(final FloatMatrixData fmd, final AngleUnit unit) { return new FloatAngleMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatDirectionMatrix instantiateMutableType(final FloatMatrixData fmd, final DirectionUnit unit) { return new MutableFloatDirectionMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final FloatDirection instantiateScalar(final float value, final DirectionUnit unit) { return new FloatDirection(value, unit); } } |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\FloatPositionMatrix.java | 71 |
org\djunits\value\vfloat\matrix\MutableFloatPositionMatrix.java | 71 |
return this.data.isSparse() ? this : instantiateTypeAbs(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final FloatPositionMatrix instantiateTypeAbs(final FloatMatrixData fmd, final PositionUnit unit) { return new FloatPositionMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final FloatLengthMatrix instantiateTypeRel(final FloatMatrixData fmd, final LengthUnit unit) { return new FloatLengthMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatPositionMatrix instantiateMutableType(final FloatMatrixData fmd, final PositionUnit unit) { return new MutableFloatPositionMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final FloatPosition instantiateScalar(final float value, final PositionUnit unit) { return new FloatPosition(value, unit); } } |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\FloatTimeMatrix.java | 70 |
org\djunits\value\vfloat\matrix\MutableFloatTimeMatrix.java | 71 |
return this.data.isSparse() ? this : instantiateTypeAbs(this.data.toSparse(), getUnit()); } /** {@inheritDoc} */ @Override protected final FloatTimeMatrix instantiateTypeAbs(final FloatMatrixData fmd, final TimeUnit unit) { return new FloatTimeMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final FloatDurationMatrix instantiateTypeRel(final FloatMatrixData fmd, final DurationUnit unit) { return new FloatDurationMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final MutableFloatTimeMatrix instantiateMutableType(final FloatMatrixData fmd, final TimeUnit unit) { return new MutableFloatTimeMatrix(fmd, unit); } /** {@inheritDoc} */ @Override protected final FloatTime instantiateScalar(final float value, final TimeUnit unit) { return new FloatTime(value, unit); } } |
File | Line |
---|---|
org\djunits\value\vdouble\vector\DoubleVectorData.java | 530 |
org\djunits\value\vfloat\vector\FloatVectorData.java | 503 |
public void divideBy(final double valueSI) { IntStream.range(0, this.vectorSI.length).parallel().forEach(i -> this.vectorSI[i] /= valueSI); } /* ============================================================================================ */ /* =============================== EQUALS, HASHCODE, TOSTRING ================================= */ /* ============================================================================================ */ /** {@inheritDoc} */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(this.vectorSI); return result; } /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:needbraces") public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractMutableDoubleVectorAbs.java | 347 |
org\djunits\value\vdouble\vector\AbstractMutableDoubleVectorRel.java | 393 |
return (MA) this; } /** * Check the copyOnWrite flag and, if it is set, make a deep copy of the data and clear the flag. */ protected final void checkCopyOnWrite() { if (isCopyOnWrite()) { this.data = this.data.copy(); setCopyOnWrite(false); } } /** * Replace the value at index by the supplied value which is expressed in the standard SI unit. * @param index int; index of the value to replace * @param valueSI double; the value to store (expressed in the standard SI unit) * @throws ValueException when index out of range (index < 0 or index >= size()) */ public final void setSI(final int index, final double valueSI) throws ValueException { checkIndex(index); checkCopyOnWrite(); this.data.setSI(index, valueSI); } /** * Replace the value at index by the supplied value which is in a compatible unit. * @param index int; index of the value to replace * @param value S; the strongly typed value to store * @throws ValueException when index out of range (index < 0 or index >= size()) */ public final void set(final int index, final S value) throws ValueException { setSI(index, value.getSI()); } /** * Replace the value at index by the supplied value which is expressed in a supplied (compatible) unit. * @param index int; index of the value to replace * @param value double; the value to store (which is expressed in valueUnit) * @param valueUnit AU; unit of the supplied value * @throws ValueException when index out of range (index < 0 or index >= size()) */ public final void setInUnit(final int index, final double value, final AU valueUnit) throws ValueException |
File | Line |
---|---|
org\djunits\value\vfloat\vector\AbstractMutableFloatVectorAbs.java | 346 |
org\djunits\value\vfloat\vector\AbstractMutableFloatVectorRel.java | 393 |
return (MA) this; } /** * Check the copyOnWrite flag and, if it is set, make a deep copy of the data and clear the flag. */ protected final void checkCopyOnWrite() { if (isCopyOnWrite()) { this.data = this.data.copy(); setCopyOnWrite(false); } } /** * Replace the value at index by the supplied value which is expressed in the standard SI unit. * @param index int; index of the value to replace * @param valueSI float; the value to store (expressed in the standard SI unit) * @throws ValueException when index out of range (index < 0 or index >= size()) */ public final void setSI(final int index, final float valueSI) throws ValueException { checkIndex(index); checkCopyOnWrite(); this.data.setSI(index, valueSI); } /** * Replace the value at index by the supplied value which is in a compatible unit. * @param index int; index of the value to replace * @param value S; the strongly typed value to store * @throws ValueException when index out of range (index < 0 or index >= size()) */ public final void set(final int index, final S value) throws ValueException { setSI(index, value.getSI()); } /** * Replace the value at index by the supplied value which is expressed in a supplied (compatible) unit. * @param index int; index of the value to replace * @param value float; the value to store (which is expressed in valueUnit) * @param valueUnit AU; unit of the supplied value * @throws ValueException when index out of range (index < 0 or index >= size()) */ public final void setInUnit(final int index, final float value, final AU valueUnit) throws ValueException |
File | Line |
---|---|
org\djunits\unit\ElectricalPotentialUnit.java | 194 |
org\djunits\unit\ElectricalResistanceUnit.java | 201 |
final ElectricalPotentialUnit referenceUnit, final double scaleFactorToReferenceUnit) { super(name, abbreviation, unitSystem, referenceUnit, scaleFactorToReferenceUnit); this.massUnit = referenceUnit.getMassUnit(); this.lengthUnit = referenceUnit.getLengthUnit(); this.electricalCurrentUnit = referenceUnit.getElectricalCurrentUnit(); this.durationUnit = referenceUnit.getDurationUnit(); } /** * @return massUnit */ public final MassUnit getMassUnit() { return this.massUnit; } /** * @return lengthUnit */ public final LengthUnit getLengthUnit() { return this.lengthUnit; } /** * @return electricalCurrentUnit */ public final ElectricalCurrentUnit getElectricalCurrentUnit() { return this.electricalCurrentUnit; } /** * @return durationUnit */ public final DurationUnit getDurationUnit() { return this.durationUnit; } /** {@inheritDoc} */ @Override public final ElectricalPotentialUnit getStandardUnit() |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\DoubleMatrix.java | 30 |
org\djunits\value\vdouble\matrix\MutableDoubleMatrix.java | 38 |
DoubleMatrix.Abs<AU, RU>, DoubleMatrix.Rel<RU>, MutableDoubleMatrix.Abs<AU, RU>, DoubleScalar.Abs<AU, RU>> { /** */ private static final long serialVersionUID = 20151003L; /** * Construct a new Absolute Immutable DoubleMatrix. * @param values double[][]; the values of the entries in the new Absolute Immutable DoubleMatrix * @param unit AU; the unit of the new Absolute Immutable DoubleMatrix * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Abs(final double[][] values, final AU unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Absolute Immutable DoubleMatrix. * @param values DoubleScalar.Abs<AU, RU>[][]; the values of the entries in the new Absolute Immutable * DoubleMatrix * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Abs(final DoubleScalar.Abs<AU, RU>[][] values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Absolute Immutable DoubleMatrix. * @param data DoubleMatrixData; an internal data object * @param unit AU; the unit */ Abs(final DoubleMatrixData data, final AU unit) { super(data, unit); } /** {@inheritDoc} */ @Override @SuppressWarnings("designforextension") public DoubleMatrix.Abs<AU, RU> toDense() |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\FloatMatrix.java | 30 |
org\djunits\value\vfloat\matrix\MutableFloatMatrix.java | 35 |
FloatMatrix.Abs<AU, RU>, FloatMatrix.Rel<RU>, MutableFloatMatrix.Abs<AU, RU>, FloatScalar.Abs<AU, RU>> { /** */ private static final long serialVersionUID = 20151003L; /** * Construct a new Absolute Immutable FloatMatrix. * @param values float[][]; the values of the entries in the new Absolute Immutable FloatMatrix * @param unit AU; the unit of the new Absolute Immutable FloatMatrix * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Abs(final float[][] values, final AU unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Absolute Immutable FloatMatrix. * @param values FloatScalar.Abs<AU, RU>[][]; the values of the entries in the new Absolute Immutable FloatMatrix * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Abs(final FloatScalar.Abs<AU, RU>[][] values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Absolute Immutable FloatMatrix. * @param data FloatMatrixData; an internal data object * @param unit AU; the unit */ Abs(final FloatMatrixData data, final AU unit) { super(data, unit); } /** {@inheritDoc} */ @Override @SuppressWarnings("designforextension") public FloatMatrix.Abs<AU, RU> toDense() |
File | Line |
---|---|
org\djunits\unit\SICoefficients.java | 228 |
org\djunits\unit\SICoefficients.java | 263 |
public static SICoefficients multiply(final SICoefficients a, final SICoefficients b) { EnumMap<SI, Integer> coefficients = new EnumMap<SI, Integer>(SI.class); for (SI si : a.getCoefficientsMap().keySet()) { coefficients.put(si, a.getCoefficientsMap().get(si)); } for (SI si : b.getCoefficientsMap().keySet()) { if (coefficients.containsKey(si)) { coefficients.put(si, coefficients.get(si) + b.getCoefficientsMap().get(si)); |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\DoubleMatrix.java | 119 |
org\djunits\value\vdouble\matrix\MutableDoubleMatrix.java | 127 |
extends AbstractDoubleMatrixRel<U, DoubleMatrix.Rel<U>, MutableDoubleMatrix.Rel<U>, DoubleScalar.Rel<U>> { /** */ private static final long serialVersionUID = 20151003L; /** * Construct a new Relative Immutable DoubleMatrix. * @param values double[][]; the values of the entries in the new Relative Immutable DoubleMatrix * @param unit U; the unit of the new Relative Immutable DoubleMatrix * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Rel(final double[][] values, final U unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Relative Immutable DoubleMatrix. * @param values DoubleScalar.Rel<U>[][]; the values of the entries in the new Relative Immutable DoubleMatrix * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Rel(final DoubleScalar.Rel<U>[][] values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Relative Immutable DoubleMatrix. * @param data DoubleMatrixData; an internal data object * @param unit U; the unit */ Rel(final DoubleMatrixData data, final U unit) { super(data, unit); } /** {@inheritDoc} */ @Override @SuppressWarnings("designforextension") public DoubleMatrix.Rel<U> toDense() |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\FloatMatrix.java | 118 |
org\djunits\value\vfloat\matrix\MutableFloatMatrix.java | 124 |
extends AbstractFloatMatrixRel<U, FloatMatrix.Rel<U>, MutableFloatMatrix.Rel<U>, FloatScalar.Rel<U>> { /** */ private static final long serialVersionUID = 20151003L; /** * Construct a new Relative Immutable FloatMatrix. * @param values float[][]; the values of the entries in the new Relative Immutable FloatMatrix * @param unit U; the unit of the new Relative Immutable FloatMatrix * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values is null */ public Rel(final float[][] values, final U unit, final StorageType storageType) throws ValueException { super(values, unit, storageType); } /** * Construct a new Relative Immutable FloatMatrix. * @param values FloatScalar.Rel<U>[][]; the values of the entries in the new Relative Immutable FloatMatrix * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE) * @throws ValueException when values has zero entries */ public Rel(final FloatScalar.Rel<U>[][] values, final StorageType storageType) throws ValueException { super(values, storageType); } /** * Construct a new Relative Immutable FloatMatrix. * @param data FloatMatrixData; an internal data object * @param unit U; the unit */ Rel(final FloatMatrixData data, final U unit) { super(data, unit); } /** {@inheritDoc} */ @Override @SuppressWarnings("designforextension") public FloatMatrix.Rel<U> toDense() |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractMutableDoubleMatrixAbs.java | 107 |
org\djunits\value\vfloat\vector\AbstractMutableFloatVectorAbs.java | 162 |
public final A immutable() { setCopyOnWrite(true); return instantiateTypeAbs(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableDoubleMatrix. <br> * @return DoubleMatrix<U>; deep copy of this MutableDoubleMatrix */ public final MA copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed matrix. * @param increment R; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MA incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MA) this; } /** * Increment the value by the supplied value and return the changed matrix. * @param increment S; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ public final MA incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed matrix. * @param increment double; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MA incrementBy(final double increment) |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\AbstractMutableDoubleMatrixRel.java | 103 |
org\djunits\value\vfloat\vector\AbstractMutableFloatVectorRel.java | 157 |
public final R immutable() { setCopyOnWrite(true); return instantiateType(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableDoubleMatrix. <br> * @return DoubleMatrix<U>; deep copy of this MutableDoubleMatrix */ public final MR copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed matrix. * @param increment R; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MR) this; } /** * Increment the value by the supplied value and return the changed matrix. * @param increment S; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ public final MR incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed matrix. * @param increment double; amount by which the value is incremented * @return the changed MutableDoubleMatrix.Rel<U> */ @SuppressWarnings("unchecked") public final MR incrementBy(final double increment) |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractMutableDoubleVectorAbs.java | 163 |
org\djunits\value\vfloat\matrix\AbstractMutableFloatMatrixAbs.java | 107 |
public A immutable() { setCopyOnWrite(true); return instantiateTypeAbs(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableDoubleVector. <br> * @return DoubleVector<U>; deep copy of this MutableDoubleVector */ public final MA copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed vector. * @param increment R; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MA incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MA) this; } /** * Increment the value by the supplied value and return the changed vector. * @param increment S; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> */ public final MA incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed vector. * @param increment double; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> */ @SuppressWarnings("unchecked") public final MA incrementBy(final double increment) |
File | Line |
---|---|
org\djunits\value\vdouble\vector\AbstractMutableDoubleVectorRel.java | 157 |
org\djunits\value\vfloat\matrix\AbstractMutableFloatMatrixRel.java | 103 |
public R immutable() { setCopyOnWrite(true); return instantiateType(getData(), getUnit()); } /**********************************************************************************/ /**************************** TYPED CALCULATION METHODS ***************************/ /**********************************************************************************/ /** * Create a deep copy of this MutableDoubleVector. <br> * @return DoubleVector<U>; deep copy of this MutableDoubleVector */ public final MR copy() { return mutable(); } /** * Increment the value by the supplied value and return the changed vector. * @param increment R; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> * @throws ValueException when the size of increment is not identical to the size of this */ @SuppressWarnings("unchecked") public final MR incrementBy(final R increment) throws ValueException { checkCopyOnWrite(); this.data.incrementBy(increment.getData()); return (MR) this; } /** * Increment the value by the supplied value and return the changed vector. * @param increment S; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> */ public final MR incrementBy(final S increment) { return incrementBy(increment.si); } /** * Increment the value by the supplied constant and return the changed vector. * @param increment double; amount by which the value is incremented * @return the changed MutableDoubleVector.Rel<U> */ @SuppressWarnings("unchecked") public final MR incrementBy(final double increment) |