Class QuantitySumOrDifferenceOperation<S>
- java.lang.Object
-
- org.tensorics.core.quantity.operations.AbstractQuantityOperation<V>
-
- org.tensorics.core.quantity.operations.QuantityBinaryOperation<S>
-
- org.tensorics.core.quantity.operations.QuantitySumOrDifferenceOperation<S>
-
- Type Parameters:
S
- the type of the scalars (field elements) on which all the operations are based on
- All Implemented Interfaces:
java.io.Serializable
,BinaryFunction<QuantifiedValue<S>,QuantifiedValue<S>>
,BinaryOperation<QuantifiedValue<S>>
- Direct Known Subclasses:
QuantityAddition
,QuantitySubtraction
public class QuantitySumOrDifferenceOperation<S> extends QuantityBinaryOperation<S>
Base class for operations on physical quantities, that can perform sum or difference, depending on the scalar operation that is passed into the constructor. The left and right operand will be converted to the same base (if they are not provided like this). The errors and validity flags will be propagated according to corresponding strategies given in the environment.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description QuantitySumOrDifferenceOperation(QuantityEnvironment<S> environment, BinaryOperation<S> operation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QuantifiedValue<S>
perform(QuantifiedValue<S> left, QuantifiedValue<S> right)
Has to be implemented to perform the actual operation.-
Methods inherited from class org.tensorics.core.quantity.operations.QuantityBinaryOperation
equals, hashCode, operation, toString
-
Methods inherited from class org.tensorics.core.quantity.operations.AbstractQuantityOperation
environment, productError, validityFor
-
-
-
-
Constructor Detail
-
QuantitySumOrDifferenceOperation
public QuantitySumOrDifferenceOperation(QuantityEnvironment<S> environment, BinaryOperation<S> operation)
-
-
Method Detail
-
perform
public QuantifiedValue<S> perform(QuantifiedValue<S> left, QuantifiedValue<S> right)
Description copied from interface:BinaryFunction
Has to be implemented to perform the actual operation. The order of operands might be important or not, depending, if the operation is commutative or not.- Parameters:
left
- the left operand to be used in the operationright
- the right operand to be used in the operation- Returns:
- the result of the operation
-
-