cdm.product.qualification.functions.Qualify_CreditDefaultSwaption Maven / Gradle / Ivy
package cdm.product.qualification.functions;
import cdm.product.template.ContractualProduct;
import cdm.product.template.EconomicTerms;
import cdm.product.template.OptionPayout;
import cdm.product.template.Payout;
import cdm.product.template.Product;
import com.google.inject.ImplementedBy;
import com.rosetta.model.lib.expression.CardinalityOperator;
import com.rosetta.model.lib.functions.IQualifyFunctionExtension;
import com.rosetta.model.lib.functions.RosettaFunction;
import com.rosetta.model.lib.mapper.MapperS;
import java.util.Arrays;
import javax.inject.Inject;
import static com.rosetta.model.lib.expression.ExpressionOperators.*;
@ImplementedBy(Qualify_CreditDefaultSwaption.Qualify_CreditDefaultSwaptionDefault.class)
public abstract class Qualify_CreditDefaultSwaption implements RosettaFunction,IQualifyFunctionExtension {
// RosettaFunction dependencies
//
@Inject protected Qualify_AssetClass_Credit qualify_AssetClass_Credit;
/**
* @param economicTerms
* @return is_product
*/
@Override
public Boolean evaluate(EconomicTerms economicTerms) {
Boolean is_product = doEvaluate(economicTerms);
return is_product;
}
protected abstract Boolean doEvaluate(EconomicTerms economicTerms);
public static class Qualify_CreditDefaultSwaptionDefault extends Qualify_CreditDefaultSwaption {
@Override
protected Boolean doEvaluate(EconomicTerms economicTerms) {
Boolean is_product = null;
return assignOutput(is_product, economicTerms);
}
protected Boolean assignOutput(Boolean is_product, EconomicTerms economicTerms) {
is_product = onlyExists(MapperS.of(economicTerms).map("getPayout", _economicTerms -> _economicTerms.getPayout()), Arrays.asList("interestRatePayout", "creditDefaultPayout", "optionPayout", "commodityPayout", "forwardPayout", "fixedPricePayout", "cashflow", "performancePayout", "assetPayout", "settlementPayout"), Arrays.asList("optionPayout")).and(areEqual(MapperS.of(qualify_AssetClass_Credit.evaluate(MapperS.of(MapperS.of(economicTerms).map("getPayout", _economicTerms -> _economicTerms.getPayout()).mapC("getOptionPayout", payout -> payout.getOptionPayout()).get()).map("getUnderlier", optionPayout -> optionPayout.getUnderlier()).map("getContractualProduct", product -> product.getContractualProduct()).map("getEconomicTerms", contractualProduct -> contractualProduct.getEconomicTerms()).get())), MapperS.of(true), CardinalityOperator.All)).get();
return is_product;
}
}
@Override
public String getNamePrefix() {
return "Qualify";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy