com.softicar.platform.common.container.matrix.traits.NumericMatrixTraits Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.container.matrix.traits;
import com.softicar.platform.common.container.matrix.IMatrixTraits;
import com.softicar.platform.common.math.arithmetic.IArithmetic;
/**
* A {@link IMatrixTraits} implementation based on {@link IArithmetic}.
*
* @author Oliver Richers
*/
public class NumericMatrixTraits implements IMatrixTraits {
private final IArithmetic arithmetic;
public NumericMatrixTraits(IArithmetic arithmetic) {
this.arithmetic = arithmetic;
}
@Override
public V getDefaultValue() {
return arithmetic.getZero();
}
@Override
public V plus(V q1, V q2) {
return arithmetic.plus(q1, q2);
}
}