cdm.event.common.functions.AdjustedValuationDates Maven / Gradle / Ivy
package cdm.event.common.functions;
import cdm.base.datetime.AdjustableOrRelativeDate;
import cdm.base.datetime.AdjustableRelativeOrPeriodicDates;
import cdm.base.datetime.functions.ResolveAdjustableDate;
import cdm.base.datetime.functions.ResolveAdjustableDates;
import cdm.observable.asset.PerformanceValuationDates;
import cdm.observable.asset.ValuationDates;
import com.google.inject.ImplementedBy;
import com.rosetta.model.lib.functions.RosettaFunction;
import com.rosetta.model.lib.mapper.MapperC;
import com.rosetta.model.lib.mapper.MapperS;
import com.rosetta.model.lib.records.Date;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
@ImplementedBy(AdjustedValuationDates.AdjustedValuationDatesDefault.class)
public abstract class AdjustedValuationDates implements RosettaFunction {
// RosettaFunction dependencies
//
@Inject protected ResolveAdjustableDate resolveAdjustableDate;
@Inject protected ResolveAdjustableDates resolveAdjustableDates;
/**
* @param valuationDates
* @return adjustedValuationDates
*/
public List evaluate(ValuationDates valuationDates) {
List adjustedValuationDates = doEvaluate(valuationDates);
return adjustedValuationDates;
}
protected abstract List doEvaluate(ValuationDates valuationDates);
public static class AdjustedValuationDatesDefault extends AdjustedValuationDates {
@Override
protected List doEvaluate(ValuationDates valuationDates) {
List adjustedValuationDates = new ArrayList<>();
return assignOutput(adjustedValuationDates, valuationDates);
}
protected List assignOutput(List adjustedValuationDates, ValuationDates valuationDates) {
adjustedValuationDates = MapperC.of(MapperC.of(resolveAdjustableDates.evaluate(MapperS.of(valuationDates).map("getInterimValuationDate", _valuationDates -> _valuationDates.getInterimValuationDate()).map("getValuationDates", performanceValuationDates -> performanceValuationDates.getValuationDates()).get())), MapperS.of(resolveAdjustableDate.evaluate(MapperS.of(valuationDates).map("getFinalValuationDate", _valuationDates -> _valuationDates.getFinalValuationDate()).map("getValuationDate", performanceValuationDates -> performanceValuationDates.getValuationDate()).get())))
.sort().getMulti();
return adjustedValuationDates;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy