The following document contains the results of PMD's CPD 6.13.0.
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrix.java | 262 |
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrix.java | 262 |
DoubleVectorData.instantiate(getDiagonalSI(), getDisplayUnit().getStandardUnit().getScale(), getStorageType()); return instantiateVector(dvd, getDisplayUnit()); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public S[] getRowScalars(final int row) throws ValueRuntimeException { checkRowIndex(row); S[] array = (S[]) Array.newInstance(getScalarClass(), cols()); for (int col = 0; col < cols(); col++) { array[col] = get(row, col); } return array; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public S[] getColumnScalars(final int col) throws ValueRuntimeException { checkColumnIndex(col); S[] array = (S[]) Array.newInstance(getScalarClass(), rows()); for (int row = 0; row < rows(); row++) { array[row] = get(row, col); } return array; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public S[] getDiagonalScalars() throws ValueRuntimeException { checkSquare(); S[] array = (S[]) Array.newInstance(getScalarClass(), rows()); for (int row = 0; row < rows(); row++) { array[row] = get(row, row); } return array; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public M toSparse() { M result; if (getStorageType().equals(StorageType.SPARSE)) { result = (M) this; result.setDisplayUnit(getDisplayUnit()); } else { result = instantiateMatrix(this.data.toSparse(), getDisplayUnit()); } result.setDisplayUnit(getDisplayUnit()); return result; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public M toDense() { M result; if (getStorageType().equals(StorageType.DENSE)) { result = (M) this; result.setDisplayUnit(getDisplayUnit()); } else { result = instantiateMatrix(this.data.toDense(), getDisplayUnit()); } return result; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public final M assign(final DoubleFunction doubleFunction) |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrix.java | 436 |
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrix.java | 437 |
double d = ValueUtil.expressAsUnit(getSI(row, col), displayUnit); buf.append(" " + Format.format(d)); } catch (ValueRuntimeException ve) { buf.append(" " + "********************".substring(0, Format.DEFAULTSIZE)); } } } buf.append("\n"); if (withUnit) { buf.append(displayUnit.getDefaultDisplayAbbreviation()); } return buf.toString(); } /** * Check that provided row and column indices are valid. * @param row int; the row value to check * @param col int; the column value to check * @throws ValueRuntimeException when row or column is invalid */ protected final void checkIndex(final int row, final int col) throws ValueRuntimeException { if (row < 0 || row >= rows() || col < 0 || col >= cols()) { throw new ValueRuntimeException("index out of range (valid range is 0.." + (rows() - 1) + ", 0.." + (cols() - 1) + ", got " + row + ", " + col + ")"); } } /** * Check that provided row index is valid. * @param row int; the row value to check * @throws ValueRuntimeException when row is invalid */ protected final void checkRowIndex(final int row) throws ValueRuntimeException { if (row < 0 || row >= rows()) { throw new ValueRuntimeException("row index out of range (valid range is 0.." + (rows() - 1) + ", got " + row + ")"); } } /** * Check that provided column index is valid. * @param col int; the column value to check * @throws ValueRuntimeException when row is invalid */ protected final void checkColumnIndex(final int col) throws ValueRuntimeException { if (col < 0 || col >= cols()) { throw new ValueRuntimeException( "column index out of range (valid range is 0.." + (cols() - 1) + ", got " + col + ")"); } } /** * Check that the matrix is square. * @throws ValueRuntimeException when matrix is not square */ protected final void checkSquare() throws ValueRuntimeException { Throw.when(rows() != cols(), ValueRuntimeException.class, "Matrix is not square, rows=%d, cols=%d", rows(), cols()); } /** {@inheritDoc} */ @Override public final double determinant() throws ValueRuntimeException |
File | Line |
---|---|
org\djunits\value\vdouble\scalar\base\AbstractDoubleScalar.java | 59 |
org\djunits\value\vfloat\scalar\base\AbstractFloatScalar.java | 59 |
return ValueUtil.expressAsUnit(getSI(), targetUnit); } /** {@inheritDoc} */ @Override public final boolean lt(final S o) { return this.getSI() < o.getSI(); } /** {@inheritDoc} */ @Override public final boolean le(final S o) { return this.getSI() <= o.getSI(); } /** {@inheritDoc} */ @Override public final boolean gt(final S o) { return this.getSI() > o.getSI(); } /** {@inheritDoc} */ @Override public final boolean ge(final S o) { return this.getSI() >= o.getSI(); } /** {@inheritDoc} */ @Override public final boolean eq(final S o) { return this.getSI() == o.getSI(); } /** {@inheritDoc} */ @Override public final boolean ne(final S o) { return this.getSI() != o.getSI(); } /** {@inheritDoc} */ @Override public final boolean lt0() { return this.getSI() < 0.0; } /** {@inheritDoc} */ @Override public final boolean le0() { return this.getSI() <= 0.0; } /** {@inheritDoc} */ @Override public final boolean gt0() { return this.getSI() > 0.0; } /** {@inheritDoc} */ @Override public final boolean ge0() { return this.getSI() >= 0.0; } /** {@inheritDoc} */ @Override public final boolean eq0() { return this.getSI() == 0.0; } /** {@inheritDoc} */ @Override public final boolean ne0() { return this.getSI() != 0.0; } /** {@inheritDoc} */ @Override public final int compareTo(final S o) { return Double.compare(this.getSI(), o.getSI()); |
File | Line |
---|---|
org\djunits\value\vdouble\vector\base\AbstractDoubleVector.java | 169 |
org\djunits\value\vfloat\vector\base\AbstractFloatVector.java | 167 |
setSI(index, ValueUtil.expressAsSIUnit(valueInUnit, valueUnit)); } /** {@inheritDoc} */ @Override public void set(final int index, final S value) throws ValueRuntimeException { setSI(index, value.si); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public S[] getScalars() { S[] array = (S[]) Array.newInstance(getScalarClass(), size()); for (int i = 0; i < size(); i++) { array[i] = get(i); } return array; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public V toSparse() { V result; if (getStorageType().equals(StorageType.SPARSE)) { result = (V) this; result.setDisplayUnit(getDisplayUnit()); } else { result = instantiateVector(getData().toSparse(), getDisplayUnit()); } result.setDisplayUnit(getDisplayUnit()); return result; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public V toDense() { V result; if (getStorageType().equals(StorageType.DENSE)) { result = (V) this; result.setDisplayUnit(getDisplayUnit()); } else { result = instantiateVector(getData().toDense(), getDisplayUnit()); } return result; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public final V assign(final DoubleFunction doubleFunction) |
File | Line |
---|---|
org\djunits\value\vdouble\scalar\base\Constants.java | 23 |
org\djunits\value\vfloat\scalar\base\FloatConstants.java | 21 |
private Constants() { // utility class } /** * Number of constituent particles in a Mole; a.k.a. Avogadro's number. This value is exact since the 2019 redefinition of * the SI base units. */ public static final SIScalar AVOGADRO = SIScalar.of(6.02214076e23, "1/mol"); /** * Boltzmann constant in Joule per Kelvin (this value is exact since the 2019 redefinition of SI base units). See * <a href="https://en.wikipedia.org/wiki/Boltzmann_constant">Wikipedia: Boltzmann constant</a> */ public static final SIScalar BOLTZMANN = SIScalar.of(1.380649e-23, "kgm2/s2K"); /** * The Cesium 133 ground state hyperfine structure transition frequency. This value is exact since the 2006 redefinition of * the SI base units. */ public static final Frequency CESIUM133_FREQUENCY = Frequency.of(9192631770d, "1/s"); /** Electrical charge of one electron. This value is exact since the 2019 redefinition of the SI base units. */ public static final ElectricalCharge ELECTRONCHARGE = new ElectricalCharge(-1, ElectricalChargeUnit.ATOMIC_UNIT); /** * Mass of an electron. See <a href="https://en.wikipedia.org/wiki/Physical_constant">Wikipedia Physical constant</a>. This * value of this physical constant has an uncertainty of 2.8e-40 kg. */ public static final Mass ELECTRONMASS = Mass.of(9.1093837015e-31, "kg"); /** ElectricalCharge of one proton. */ public static final ElectricalCharge PROTONCHARGE = new ElectricalCharge(1, ElectricalChargeUnit.ATOMIC_UNIT); /** * Mass of a neutron. See <a href="https://en.wikipedia.org/wiki/List_of_physical_constants">Wikipedia List of physical * constants</a>. This value of this physical constant has an uncertainty of 9.5e-37 kg. */ public static final Mass NEUTRONMASS = Mass.of(1.6749274714e-27, "kg"); /** * Mass of a proton. See <a href="https://en.wikipedia.org/wiki/Physical_constant">Wikipedia Physical constant</a>. This * value of this physical constant has an uncertainty of 5.1e-37. */ public static final Mass PROTONMASS = Mass.of(1.67262192369e-27, "kg"); /** * Gravitational constant, a.k.a. Newtonian constant of gravitation. This is the 2018 best known approximation, which has an * uncertainty 1.5e-15 m^3/kgs^2 */ public static final SIScalar G = SIScalar.of(6.67430e-11, "m3/kgs2"); /** Speed of light in vacuum. This value is exact (since the 2006 redefinition of the SI base units). */ public static final Speed LIGHTSPEED = Speed.of(299792458, "m/s"); /** * Permeability of vacuum. See <a href="https://en.wikipedia.org/wiki/Vacuum_permeability">Wikipedia, Vacuum * permeability</a>. The uncertainty of this value is 1.9e-16N/A^2. */ public static final SIScalar VACUUMPERMEABILITY = SIScalar.of(1.25663706212e-6, "kgm/s2A2"); /** * Permittivity of vacuum. See <a href="https://en.wikipedia.org/wiki/Vacuum_permittivity">Wikipedia Vacuum * permittivity</a>. The uncertainty of this value is 1.3e-21 F/m. */ public static final SIScalar VACUUMPERMITTIVITY = SIScalar.of(8.8541878128e-12, "s4A2/kgm3"); /** Impedance of vacuum. */ public static final SIScalar VACUUMIMPEDANCE = VACUUMPERMEABILITY.times(LIGHTSPEED); /** * Planck constant; ratio of a photon's energy and its frequency. This value is exact since the 2019 redefinition of the SI * base units. */ public static final SIScalar PLANCK = SIScalar.of(6.62607015e-34, "kgm2/s"); /** * The luminous efficacy Kcd of monochromatic radiation of frequency 540×10^12 Hz (540 THz). This is the frequency of a * green-colored light at approximately the peak sensitivity of the human eye. This value is exact since the 2006 * redefinition of the SI base units. */ public static final SIScalar LUMINOUS_EFFICACY_540THZ = SIScalar.of(683d, "cdsrs3/kg"); /** Ratio of circumference of circle and its radius. */ public static final Dimensionless TAU = new Dimensionless(Math.PI * 2, DimensionlessUnit.SI); /** Reduced Planck constant, a.k.a. angular Planck constant; Planck constant divided by 2 pi. */ public static final SIScalar PLANKREDUCED = PLANCK.divide(TAU); } |
File | Line |
---|---|
org\djunits\value\vdouble\vector\base\AbstractDoubleVector.java | 376 |
org\djunits\value\vfloat\vector\base\AbstractFloatVector.java | 367 |
AbstractDoubleVector<?, ?, ?> other = (AbstractDoubleVector<?, ?, ?>) obj; if (!getDisplayUnit().getStandardUnit().equals(other.getDisplayUnit().getStandardUnit())) return false; if (this.data == null) { if (other.data != null) return false; } else if (!this.data.equals(other.data)) return false; return true; } /* ============================================================================================ */ /* =============================== ITERATOR METHODS AND CLASS ================================= */ /* ============================================================================================ */ /** {@inheritDoc} */ @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>, Serializable { /** ... */ private static final long serialVersionUID = 20191018L; /** index of next element to return. */ private int cursor = 0; /** {@inheritDoc} */ @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 (ValueRuntimeException exception) { throw new RuntimeException(exception); } } /** {@inheritDoc} */ @Override public void remove() { throw new RuntimeException("Remove function cannot be applied on fixed-size DJUNITS Vector"); } /** {@inheritDoc} */ @Override public String toString() { return "Itr [cursor=" + this.cursor + "]"; } } } |
File | Line |
---|---|
org\djunits\value\vdouble\scalar\base\AbstractDoubleScalarRel.java | 41 |
org\djunits\value\vfloat\scalar\base\AbstractFloatScalarRel.java | 41 |
public AbstractDoubleScalarRel(final R value) { super(value.getDisplayUnit(), value.getSI()); } /** {@inheritDoc} */ @Override public final R plus(final R increment) { if (getDisplayUnit().isBaseSIUnit()) { return instantiateRel(this.getSI() + increment.getSI(), getDisplayUnit().getStandardUnit()); } return getDisplayUnit().equals(increment.getDisplayUnit()) ? instantiateRel(getInUnit() + increment.getInUnit(), getDisplayUnit()) : instantiateRel(this.getSI() + increment.getSI(), getDisplayUnit().getStandardUnit()); } /** {@inheritDoc} */ @Override public final R minus(final R decrement) { if (getDisplayUnit().isBaseSIUnit()) { return instantiateRel(this.getSI() - decrement.getSI(), getDisplayUnit().getStandardUnit()); } return getDisplayUnit().equals(decrement.getDisplayUnit()) ? instantiateRel(getInUnit() - decrement.getInUnit(), getDisplayUnit()) : instantiateRel(this.getSI() - decrement.getSI(), getDisplayUnit().getStandardUnit()); } /** * Multiply this scalar by another scalar and create a new scalar. * @param otherScalar AbstractDoubleScalarRel<?, ?>; the value by which this scalar is multiplied * @return DoubleScalar<?>; a new scalar instance with correct SI dimensions */ public SIScalar times(final AbstractDoubleScalarRel<?, ?> otherScalar) |
File | Line |
---|---|
org\djunits\unit\Unit.java | 193 |
org\djunits\unit\Unit.java | 348 |
String cloneDefaultTextualAbbreviation = siPrefix.getDefaultTextualPrefix() + clone.getDefaultTextualAbbreviation(); // Make a builder and set values Builder<U> builder = makeBuilder(); builder.setId(cloneId); builder.setName(cloneName); builder.setQuantity(this.quantity); builder.setSiPrefixes(SIPrefixes.NONE, 1.0); builder.setDefaultDisplayAbbreviation(cloneDefaultAbbreviation); builder.setDefaultTextualAbbreviation(cloneDefaultTextualAbbreviation); builder.setAdditionalAbbreviations(cloneAbbreviations.toArray(new String[cloneAbbreviations.size()])); if (getScale() instanceof OffsetLinearScale) { builder.setScale(new OffsetLinearScale( (siPrefixPower == 1.0 ? siPrefix.getFactor() : Math.pow(siPrefix.getFactor(), siPrefixPower)) * ((LinearScale) getScale()).getConversionFactorToStandardUnit(), 0.0)); } else { builder.setScale(new LinearScale( (siPrefixPower == 1.0 ? siPrefix.getFactor() : Math.pow(siPrefix.getFactor(), siPrefixPower)) * ((LinearScale) getScale()).getConversionFactorToStandardUnit())); } builder.setUnitSystem(this.unitSystem); // SI_BASE stays SI_BASE with prefix builder.setGenerated(automaticallyGenerated); return clone.build(builder); } catch (CloneNotSupportedException exception) { throw new UnitRuntimeException(exception); } } /** * Create a scaled version of this unit with the same unit system but another SI prefix and scale. This method is used for a * unit that is explicitly scaled with an SI prefix. * @param siPrefix SIPrefix; the prefix for which to scale the unit * @param siPrefixPower the power factor of the SI prefixes, e.g. 2.0 for square meters and 3.0 for cubic meters. * @return a scaled instance of this unit * @throws UnitRuntimeException when cloning fails */ public U deriveSI(final SIPrefix siPrefix, final double siPrefixPower) |
File | Line |
---|---|
org\djunits\unit\Unit.java | 193 |
org\djunits\unit\Unit.java | 281 |
org\djunits\unit\Unit.java | 348 |
String cloneDefaultTextualAbbreviation = siPrefix.getDefaultTextualPrefix() + clone.getDefaultTextualAbbreviation(); // Make a builder and set values Builder<U> builder = makeBuilder(); builder.setId(cloneId); builder.setName(cloneName); builder.setQuantity(this.quantity); builder.setSiPrefixes(SIPrefixes.NONE, 1.0); builder.setDefaultDisplayAbbreviation(cloneDefaultAbbreviation); builder.setDefaultTextualAbbreviation(cloneDefaultTextualAbbreviation); builder.setAdditionalAbbreviations(cloneAbbreviations.toArray(new String[cloneAbbreviations.size()])); if (getScale() instanceof OffsetLinearScale) { builder.setScale(new OffsetLinearScale( (siPrefixPower == 1.0 ? siPrefix.getFactor() : Math.pow(siPrefix.getFactor(), siPrefixPower)) * ((LinearScale) getScale()).getConversionFactorToStandardUnit(), 0.0)); } else { builder.setScale(new LinearScale( (siPrefixPower == 1.0 ? siPrefix.getFactor() : Math.pow(siPrefix.getFactor(), siPrefixPower)) * ((LinearScale) getScale()).getConversionFactorToStandardUnit())); } builder.setUnitSystem(this.unitSystem); // SI_BASE stays SI_BASE with prefix builder.setGenerated(automaticallyGenerated); return clone.build(builder); } catch (CloneNotSupportedException exception) { throw new UnitRuntimeException(exception); } } /** * Create a scaled version of this unit with the same unit system but another SI prefix and scale. This method is used for a * unit that is explicitly scaled with an SI prefix. * @param siPrefix SIPrefix; the prefix for which to scale the unit * @param siPrefixPower the power factor of the SI prefixes, e.g. 2.0 for square meters and 3.0 for cubic meters. * @return a scaled instance of this unit * @throws UnitRuntimeException when cloning fails */ public U deriveSI(final SIPrefix siPrefix, final double siPrefixPower) |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrix.java | 387 |
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrix.java | 388 |
return assign(DoubleMathFunctions.RINT); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getDisplayUnit(), 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(getDisplayUnit(), 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 (isMutable()) { 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 col = 0; col < cols(); col++) { try { |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrix.java | 190 |
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrix.java | 190 |
values[i][j] = ValueUtil.expressAsUnit(values[i][j], targetUnit); } } return values; } /** {@inheritDoc} */ @Override public int rows() { return this.data.rows(); } /** {@inheritDoc} */ @Override public int cols() { return this.data.cols(); } /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public S[][] getScalars() { S[][] array = (S[][]) Array.newInstance(getScalarClass(), rows(), cols()); for (int i = 0; i < rows(); i++) { S[] row = (S[]) Array.newInstance(getScalarClass(), cols()); array[i] = row; for (int j = 0; j < cols(); j++) { row[j] = get(i, j); } } return array; } /** {@inheritDoc} */ @Override public S get(final int row, final int column) throws ValueRuntimeException { checkIndex(row, column); return DoubleScalar.instantiateSI(getSI(row, column), getDisplayUnit()); |
File | Line |
---|---|
org\djunits\value\vdouble\vector\base\AbstractDoubleVector.java | 278 |
org\djunits\value\vfloat\vector\base\AbstractFloatVector.java | 269 |
return assign(DoubleMathFunctions.RINT); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getDisplayUnit(), 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(getDisplayUnit(), 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 = getData().isDense() ? "Dense " : getData().isSparse() ? "Sparse " : "?????? "; if (isMutable()) { 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\scalar\base\AbstractDoubleScalarAbs.java | 44 |
org\djunits\value\vfloat\scalar\base\AbstractFloatScalarAbs.java | 44 |
public AbstractDoubleScalarAbs(final A value) { super(value.getDisplayUnit(), value.getSI()); } /** {@inheritDoc} */ @Override public final A plus(final R increment) { AU targetUnit = getDisplayUnit(); return instantiateAbs(getInUnit() + increment.getInUnit(targetUnit.getRelativeUnit()), targetUnit); } /** {@inheritDoc} */ @Override public final A minus(final R decrement) { AU targetUnit = getDisplayUnit(); return instantiateAbs(getInUnit() - decrement.getInUnit(targetUnit.getRelativeUnit()), targetUnit); } /** {@inheritDoc} */ @Override public final R minus(final A decrement) { RU targetUnit = getDisplayUnit().getRelativeUnit(); return instantiateRel(getInUnit() - decrement.getInUnit(getDisplayUnit()), targetUnit); } /**********************************************************************************/ /********************************** MATH METHODS **********************************/ /**********************************************************************************/ /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public A abs() { return instantiateAbs(Math.abs(getInUnit()), getDisplayUnit()); } /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public A ceil() { return instantiateAbs(Math.ceil(getInUnit()), getDisplayUnit()); |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\data\DoubleMatrixData.java | 270 |
org\djunits\value\vfloat\matrix\data\FloatMatrixData.java | 278 |
protected static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>> S[][] checkRectangularAndNonEmpty( final S[][] values) throws ValueRuntimeException { Throw.when(null == values, NullPointerException.class, "Cannot create a matrix from a null Scalar[][]"); Throw.when(0 == values.length, ValueRuntimeException.class, "Cannot create a matrix from zero length Scalar[][]"); for (int row = 0; row < values.length; row++) { Throw.when(null == values[row], ValueRuntimeException.class, "Cannot create a matrix from Scalar[][] containing null row(s)"); Throw.when(values[row].length != values[0].length, ValueRuntimeException.class, "Cannot create a matrix from a jagged Scalar[][]"); for (int col = 0; col < values[row].length; col++) { Throw.whenNull(values[row][col], "Cannot create a matrix from Scalar[][] containing null(s)"); } } Throw.when(0 == values[0].length, ValueRuntimeException.class, "Cannot create a matrix from a Scalar[][] with zero values"); return values; } /** * Check the sizes of this data object and the other data object. * @param other DoubleMatrixData; the other data object * @throws ValueRuntimeException if matrices have different lengths */ protected void checkSizes(final DoubleMatrixData other) throws ValueRuntimeException |
File | Line |
---|---|
org\djunits\value\vdouble\vector\base\AbstractDoubleVector.java | 347 |
org\djunits\value\vfloat\vector\base\AbstractFloatVector.java | 338 |
protected final void checkSize(final DoubleVectorInterface<?, ?, ?> other) throws ValueRuntimeException { Throw.whenNull(other, "Other vector is null"); Throw.when(size() != other.size(), ValueRuntimeException.class, "The vectors have different sizes: %d != %d", size(), other.size()); } /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public int hashCode() { final int prime = 31; int result = getDisplayUnit().getStandardUnit().hashCode(); result = prime * result + ((this.data == null) ? 0 : this.data.hashCode()); return result; } /** {@inheritDoc} */ @Override @SuppressWarnings({"checkstyle:designforextension", "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 | 220 |
org\djunits\value\vdouble\scalar\Torque.java | 220 |
public final Dimensionless divide(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 divide(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 divide(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 times(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 divide(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 divide(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 divide(final Volume v) |
File | Line |
---|---|
org\djunits\value\vfloat\scalar\FloatEnergy.java | 231 |
org\djunits\value\vfloat\scalar\FloatTorque.java | 231 |
public final FloatDimensionless divide(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 divide(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 divide(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 times(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 divide(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 divide(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 divide(final FloatVolume v) |
File | Line |
---|---|
org\djunits\value\vdouble\vector\base\AbstractDoubleVectorAbs.java | 47 |
org\djunits\value\vfloat\vector\base\AbstractFloatVectorAbs.java | 47 |
protected AbstractDoubleVectorAbs(final DoubleVectorData data, final AU unit) { super(data.copy(), unit); } /** {@inheritDoc} */ @Override public AV plus(final RV increment) throws ValueRuntimeException { return instantiateVector(this.getData().plus(increment.getData()), getDisplayUnit()); } /** {@inheritDoc} */ @Override public AV minus(final RV decrement) throws ValueRuntimeException { return instantiateVector(this.getData().minus(decrement.getData()), getDisplayUnit()); } /** {@inheritDoc} */ @Override public RV minus(final AV decrement) throws ValueRuntimeException { return instantiateVectorRel(this.getData().minus(decrement.getData()), decrement.getDisplayUnit().getRelativeUnit()); } /** * Decrement all values of this vector by the decrement. This only works if this vector is mutable. * @param decrement R; the scalar by which to decrement all values * @return AV; this modified vector * @throws ValueRuntimeException in case this vector is immutable */ @SuppressWarnings("unchecked") public AV decrementBy(final R decrement) { checkCopyOnWrite(); assign(DoubleMathFunctions.DEC(decrement.si)); |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrixRel.java | 41 |
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrixRel.java | 41 |
protected AbstractDoubleMatrixRel(final DoubleMatrixData data, final U unit) { super(data.copy(), unit); } /** * Compute the sum of all SI values of this matrix. * @return S; the sum of all SI values of this matrix with the same display unit as this matrix */ public final S zSum() { return instantiateScalarSI(this.data.zSum(), getDisplayUnit()); } /** {@inheritDoc} */ @Override public final RM plus(final RM rel) throws ValueRuntimeException { return instantiateMatrix(this.getData().plus(rel.getData()), getDisplayUnit()); } /** {@inheritDoc} */ @Override public final RM minus(final RM rel) throws ValueRuntimeException { return instantiateMatrix(this.getData().minus(rel.getData()), getDisplayUnit()); } /** * Increment all values of this matrix by the increment. This only works if this matrix is mutable. * @param increment S; the scalar by which to increment all values * @return RM; this modified matrix * @throws ValueRuntimeException in case this matrix is immutable */ @SuppressWarnings("unchecked") public RM incrementBy(final S increment) { checkCopyOnWrite(); assign(DoubleMathFunctions.INC(increment.si)); |
File | Line |
---|---|
org\djunits\value\vdouble\vector\base\AbstractDoubleVectorRel.java | 37 |
org\djunits\value\vfloat\vector\base\AbstractFloatVectorRel.java | 36 |
protected AbstractDoubleVectorRel(final DoubleVectorData data, final U unit) { super(data.copy(), unit); } /** * Compute the sum of all SI values of this vector. * @return S; the sum of all SI values of this vector with the same display unit as this vector */ public final S zSum() { return instantiateScalarSI(getData().zSum(), getDisplayUnit()); } /** {@inheritDoc} */ @Override public final RV plus(final RV rel) throws ValueRuntimeException { return instantiateVector(this.getData().plus(rel.getData()), getDisplayUnit()); } /** {@inheritDoc} */ @Override public final RV minus(final RV rel) throws ValueRuntimeException { return instantiateVector(this.getData().minus(rel.getData()), getDisplayUnit()); } /** * Increment all values of this vector by the increment. This only works if the vector is mutable. * @param increment S; the scalar by which to increment all values * @return RV; this modified vector * @throws ValueRuntimeException in case this vector is immutable */ @SuppressWarnings("unchecked") public RV incrementBy(final S increment) { checkCopyOnWrite(); assign(DoubleMathFunctions.INC(increment.si)); |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrixAbs.java | 54 |
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrixAbs.java | 54 |
protected AbstractDoubleMatrixAbs(final DoubleMatrixData data, final AU unit) { super(data.copy(), unit); } /** {@inheritDoc} */ @Override public AM plus(final RM increment) throws ValueRuntimeException { return instantiateMatrix(this.getData().plus(increment.getData()), getDisplayUnit()); } /** {@inheritDoc} */ @Override public AM minus(final RM decrement) throws ValueRuntimeException { return instantiateMatrix(this.getData().minus(decrement.getData()), getDisplayUnit()); } /** {@inheritDoc} */ @Override public RM minus(final AM decrement) throws ValueRuntimeException { return instantiateMatrixRel(this.getData().minus(decrement.getData()), decrement.getDisplayUnit().getRelativeUnit()); } |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrix.java | 516 |
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrix.java | 517 |
return m.getDeterminant().doubleValue(); } catch (IllegalArgumentException exception) { throw new ValueRuntimeException(exception); // Matrix must be square } } /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public int hashCode() { final int prime = 31; int result = getDisplayUnit().getStandardUnit().hashCode(); result = prime * result + ((this.data == null) ? 0 : this.data.hashCode()); return result; } /** {@inheritDoc} */ @Override @SuppressWarnings({"checkstyle:designforextension", "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\base\Matrix.java | 185 |
org\djunits\value\base\Matrix.java | 223 |
public interface RelWithAbs<AU extends AbsoluteLinearUnit<AU, RU>, A extends Scalar<AU, A>, AV extends Vector.Abs<AU, A, AV, RU, R, RV>, AM extends Matrix.Abs<AU, A, AV, AM, RU, R, RV, RM>, RU extends Unit<RU>, R extends Scalar<RU, R>, RV extends Vector.RelWithAbs<AU, A, AV, RU, R, RV>, RM extends Matrix.RelWithAbs<AU, A, AV, AM, RU, R, RV, RM>> extends Rel<RU, R, RV, RM> |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrixAbs.java | 33 |
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrixRelWithAbs.java | 30 |
public abstract class AbstractDoubleMatrixAbs< AU extends AbsoluteLinearUnit<AU, RU>, A extends AbstractDoubleScalarAbs<AU, A, RU, R>, AV extends AbstractDoubleVectorAbs<AU, A, AV, RU, R, RV>, AM extends AbstractDoubleMatrixAbs<AU, A, AV, AM, RU, R, RV, RM>, RU extends Unit<RU>, R extends AbstractDoubleScalarRelWithAbs<AU, A, RU, R>, RV extends AbstractDoubleVectorRelWithAbs<AU, A, AV, RU, R, RV>, RM extends AbstractDoubleMatrixRelWithAbs<AU, A, AV, AM, RU, R, RV, RM>> extends AbstractDoubleMatrix<AU, A, AV, AM> |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrixAbs.java | 33 |
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrixRelWithAbs.java | 30 |
public abstract class AbstractFloatMatrixAbs< AU extends AbsoluteLinearUnit<AU, RU>, A extends AbstractFloatScalarAbs<AU, A, RU, R>, AV extends AbstractFloatVectorAbs<AU, A, AV, RU, R, RV>, AM extends AbstractFloatMatrixAbs<AU, A, AV, AM, RU, R, RV, RM>, RU extends Unit<RU>, R extends AbstractFloatScalarRelWithAbs<AU, A, RU, R>, RV extends AbstractFloatVectorRelWithAbs<AU, A, AV, RU, R, RV>, RM extends AbstractFloatMatrixRelWithAbs<AU, A, AV, AM, RU, R, RV, RM>> extends AbstractFloatMatrix<AU, A, AV, AM> |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\data\DoubleMatrixDataSparse.java | 285 |
org\djunits\value\vdouble\matrix\data\DoubleMatrixDataSparse.java | 334 |
otherIndex++; } if (value != 0d) { if (nonZeroValues >= currentSize) { // increase size of arrays currentSize *= 2; if (currentSize > rows() * cols()) { currentSize = rows() * cols(); } long[] newNewIndices = new long[currentSize]; System.arraycopy(newIndices, 0, newNewIndices, 0, newIndices.length); newIndices = newNewIndices; double[] newNewValues = new double[currentSize]; System.arraycopy(newValues, 0, newNewValues, 0, newValues.length); newValues = newNewValues; } newIndices[nonZeroValues] = index; newValues[nonZeroValues] = value; nonZeroValues++; } } } |
File | Line |
---|---|
org\djunits\value\vdouble\scalar\base\AbstractDoubleScalar.java | 189 |
org\djunits\value\vfloat\scalar\base\AbstractFloatScalar.java | 178 |
return super.clone(); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getDisplayUnit(), 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(getDisplayUnit(), verbose, withUnit); } /** {@inheritDoc} */ @Override 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\vfloat\matrix\data\FloatMatrixDataSparse.java | 276 |
org\djunits\value\vfloat\matrix\data\FloatMatrixDataSparse.java | 325 |
otherIndex++; } if (value != 0f) { if (nonZeroValues >= currentSize) { // increase size of arrays currentSize *= 2; if (currentSize > rows() * cols()) { currentSize = rows() * cols(); } long[] newNewIndices = new long[currentSize]; System.arraycopy(newIndices, 0, newNewIndices, 0, newIndices.length); newIndices = newNewIndices; float[] newNewValues = new float[currentSize]; System.arraycopy(newValues, 0, newNewValues, 0, newValues.length); newValues = newNewValues; } newIndices[nonZeroValues] = index; newValues[nonZeroValues] = value; nonZeroValues++; } } } |
File | Line |
---|---|
org\djunits\value\vdouble\vector\data\DoubleVectorDataSparse.java | 314 |
org\djunits\value\vfloat\vector\data\FloatVectorDataSparse.java | 315 |
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.arraycopy(this.indices, internalIndex + 1, indicesNew, internalIndex, this.indices.length - internalIndex - 1); System.arraycopy(this.vectorSI, internalIndex + 1, vectorSINew, internalIndex, this.indices.length - internalIndex - 1); this.indices = indicesNew; this.vectorSI = vectorSINew; } else { this.vectorSI[internalIndex] = valueSI; } return; } |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrix.java | 385 |
org\djunits\value\vdouble\vector\base\AbstractDoubleVector.java | 276 |
public final M rint() { return assign(DoubleMathFunctions.RINT); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getDisplayUnit(), 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(getDisplayUnit(), 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\data\DoubleMatrixDataSparse.java | 424 |
org\djunits\value\vfloat\matrix\data\FloatMatrixDataSparse.java | 415 |
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\data\DoubleVectorDataSparse.java | 334 |
org\djunits\value\vfloat\vector\data\FloatVectorDataSparse.java | 338 |
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\vfloat\matrix\base\AbstractFloatMatrix.java | 386 |
org\djunits\value\vfloat\vector\base\AbstractFloatVector.java | 267 |
public final M rint() { return assign(FloatMathFunctions.RINT); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getDisplayUnit(), 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(getDisplayUnit(), 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\data\DoubleMatrixDataSparse.java | 183 |
org\djunits\value\vdouble\matrix\data\DoubleMatrixDataSparse.java | 287 |
org\djunits\value\vdouble\matrix\data\DoubleMatrixDataSparse.java | 336 |
if (value != 0d) { if (nonZeroValues >= currentSize) { // increase size of arrays currentSize *= 2; if (currentSize > rows() * cols()) { currentSize = rows() * cols(); } long[] newNewIndices = new long[currentSize]; System.arraycopy(newIndices, 0, newNewIndices, 0, newIndices.length); newIndices = newNewIndices; double[] newNewValues = new double[currentSize]; System.arraycopy(newValues, 0, newNewValues, 0, newValues.length); newValues = newNewValues; } newIndices[nonZeroValues] = index; newValues[nonZeroValues] = value; nonZeroValues++; } } |
File | Line |
---|---|
org\djunits\value\vfloat\matrix\data\FloatMatrixDataSparse.java | 183 |
org\djunits\value\vfloat\matrix\data\FloatMatrixDataSparse.java | 278 |
org\djunits\value\vfloat\matrix\data\FloatMatrixDataSparse.java | 327 |
if (value != 0f) { if (nonZeroValues >= currentSize) { // increase size of arrays currentSize *= 2; if (currentSize > rows() * cols()) { currentSize = rows() * cols(); } long[] newNewIndices = new long[currentSize]; System.arraycopy(newIndices, 0, newNewIndices, 0, newIndices.length); newIndices = newNewIndices; float[] newNewValues = new float[currentSize]; System.arraycopy(newValues, 0, newNewValues, 0, newValues.length); newValues = newNewValues; } newIndices[nonZeroValues] = index; newValues[nonZeroValues] = value; nonZeroValues++; } } |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrix.java | 522 |
org\djunits\value\vdouble\vector\base\AbstractDoubleVector.java | 352 |
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrix.java | 523 |
org\djunits\value\vfloat\vector\base\AbstractFloatVector.java | 343 |
} /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:designforextension") public int hashCode() { final int prime = 31; int result = getDisplayUnit().getStandardUnit().hashCode(); result = prime * result + ((this.data == null) ? 0 : this.data.hashCode()); return result; } /** {@inheritDoc} */ @Override @SuppressWarnings({"checkstyle:designforextension", "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\data\DoubleVectorDataSparse.java | 180 |
org\djunits\value\vdouble\vector\data\DoubleVectorDataSparse.java | 229 |
otherIndex++; } if (value != 0d) { if (nonZeroValues >= currentSize) { // increase size of arrays currentSize *= 2; if (currentSize > size()) { currentSize = size(); } int[] newNewIndices = new int[currentSize]; System.arraycopy(newIndices, 0, newNewIndices, 0, newIndices.length); newIndices = newNewIndices; double[] newNewValues = new double[currentSize]; System.arraycopy(newValues, 0, newNewValues, 0, newValues.length); newValues = newNewValues; } newIndices[nonZeroValues] = index; newValues[nonZeroValues] = value; nonZeroValues++; } } } |
File | Line |
---|---|
org\djunits\value\vfloat\vector\data\FloatVectorDataSparse.java | 181 |
org\djunits\value\vfloat\vector\data\FloatVectorDataSparse.java | 230 |
otherIndex++; } if (value != 0f) { if (nonZeroValues >= currentSize) { // increase size of arrays currentSize *= 2; if (currentSize > size()) { currentSize = size(); } int[] newNewIndices = new int[currentSize]; System.arraycopy(newIndices, 0, newNewIndices, 0, newIndices.length); newIndices = newNewIndices; float[] newNewValues = new float[currentSize]; System.arraycopy(newValues, 0, newNewValues, 0, newValues.length); newValues = newNewValues; } newIndices[nonZeroValues] = index; newValues[nonZeroValues] = value; nonZeroValues++; } } } |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrix.java | 387 |
org\djunits\value\vfloat\vector\base\AbstractFloatVector.java | 269 |
return assign(DoubleMathFunctions.RINT); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getDisplayUnit(), 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(getDisplayUnit(), 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\vector\base\AbstractDoubleVector.java | 278 |
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrix.java | 388 |
return assign(DoubleMathFunctions.RINT); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getDisplayUnit(), 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(getDisplayUnit(), 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\data\DoubleVectorDataSparse.java | 78 |
org\djunits\value\vdouble\vector\data\DoubleVectorDataSparse.java | 182 |
org\djunits\value\vdouble\vector\data\DoubleVectorDataSparse.java | 231 |
if (value != 0d) { if (nonZeroValues >= currentSize) { // increase size of arrays currentSize *= 2; if (currentSize > size()) { currentSize = size(); } int[] newNewIndices = new int[currentSize]; System.arraycopy(newIndices, 0, newNewIndices, 0, newIndices.length); newIndices = newNewIndices; double[] newNewValues = new double[currentSize]; System.arraycopy(newValues, 0, newNewValues, 0, newValues.length); newValues = newNewValues; } newIndices[nonZeroValues] = index; newValues[nonZeroValues] = value; nonZeroValues++; } } |
File | Line |
---|---|
org\djunits\value\vfloat\vector\data\FloatVectorDataSparse.java | 79 |
org\djunits\value\vfloat\vector\data\FloatVectorDataSparse.java | 183 |
org\djunits\value\vfloat\vector\data\FloatVectorDataSparse.java | 232 |
if (value != 0f) { if (nonZeroValues >= currentSize) { // increase size of arrays currentSize *= 2; if (currentSize > size()) { currentSize = size(); } int[] newNewIndices = new int[currentSize]; System.arraycopy(newIndices, 0, newNewIndices, 0, newIndices.length); newIndices = newNewIndices; float[] newNewValues = new float[currentSize]; System.arraycopy(newValues, 0, newNewValues, 0, newValues.length); newValues = newNewValues; } newIndices[nonZeroValues] = index; newValues[nonZeroValues] = value; nonZeroValues++; } } |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\base\AbstractDoubleMatrix.java | 387 |
org\djunits\value\vdouble\scalar\base\AbstractDoubleScalar.java | 189 |
org\djunits\value\vdouble\vector\base\AbstractDoubleVector.java | 278 |
org\djunits\value\vfloat\matrix\base\AbstractFloatMatrix.java | 388 |
org\djunits\value\vfloat\scalar\base\AbstractFloatScalar.java | 178 |
org\djunits\value\vfloat\vector\base\AbstractFloatVector.java | 269 |
return assign(DoubleMathFunctions.RINT); } /** {@inheritDoc} */ @Override public final String toString() { return toString(getDisplayUnit(), 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(getDisplayUnit(), verbose, withUnit); } /** {@inheritDoc} */ @Override public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit) { StringBuffer buf = new StringBuffer(); if (verbose) { |
File | Line |
---|---|
org\djunits\value\vdouble\matrix\data\DoubleMatrixData.java | 463 |
org\djunits\value\vfloat\matrix\data\FloatMatrixData.java | 470 |
protected boolean compareDenseMatrixWithSparseMatrix(final DoubleMatrixDataDense dm, final DoubleMatrixDataSparse sm) { for (int row = 0; row < dm.rows; row++) { for (int col = 0; col < dm.cols; col++) { if (dm.getSI(row, col) != sm.getSI(row, col)) { return false; } } } return true; } /** {@inheritDoc} */ @Override @SuppressWarnings("checkstyle:needbraces") public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof DoubleMatrixData)) |