All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cdm.base.math.functions.VectorGrowthOperation Maven / Gradle / Ivy

There is a newer version: 6.0.0-dev.89
Show newest version
package cdm.base.math.functions;

import com.google.inject.ImplementedBy;
import com.rosetta.model.lib.functions.RosettaFunction;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


@ImplementedBy(VectorGrowthOperation.VectorGrowthOperationDefault.class)
public abstract class VectorGrowthOperation implements RosettaFunction {

	/**
	* @param baseValue Original value, typically 1.0.
	* @param factor Vector of growth factors, which are all typically slightly greater than 1.0.
	* @return result Result vector, showing all of the interim growth values
	*/
	public List evaluate(BigDecimal baseValue, List factor) {
		List result = doEvaluate(baseValue, factor);
		
		return result;
	}

	protected abstract List doEvaluate(BigDecimal baseValue, List factor);

	public static class VectorGrowthOperationDefault extends VectorGrowthOperation {
		@Override
		protected List doEvaluate(BigDecimal baseValue, List factor) {
			if (factor == null) {
				factor = Collections.emptyList();
			}
			List result = new ArrayList<>();
			return assignOutput(result, baseValue, factor);
		}
		
		protected List assignOutput(List result, BigDecimal baseValue, List factor) {
			return result;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy