From 778169434f5d58c82f70d2c38c42be033c5eea99 Mon Sep 17 00:00:00 2001 From: Lakshmi Krishnamurthy Date: Fri, 15 Dec 2023 22:07:51 -0500 Subject: [PATCH] Features: Bug Fixes/Re-organization: - XVA Topology Collateral Group (1, 2, 3) - XVA Topology Credit Debt Group #1 (4, 5) - XVA Topology Credit Debt Group #2 (6, 7) - XVA Topology Funding Group #1 (8, 9) - XVA Topology Funding Group #2 (10, 11) - XVA Topology Adiabat Market Parameters #1 (12, 13, 14) - XVA Topology Adiabat Market Parameters #2 (15, 16) - XVA Topology Adiabat #1 (17, 18) - XVA Topology Adiabat #2 (19, 20) - XVA Vertex Albanese Andersen (21) - XVA Vertex Burgard Kjaer Exposure (22, 23, 24) - XVA Vertex Burgard Kjaer (25, 26, 27) - XVA Vertex Burgard Kjaer Builder (28, 29) - Validation Distance Importance Weight (30, 31) - Validation Distance Hypothesis Suite (32, 33) - Validation Distance Gap Test Outcome (34, 35) - Validation Distance Hypothesis Outcome (36) - Validation Distance Hypothesis Outcome Suite (37, 38) - Validation Distance Gap Loss Test (39) - Validation Distance Gap Loss Weight Function (40) - Validation Distance Gap Test Setting (41, 42) - Validation Distance README (43, 44) - Validation Evidence Test Statistic Evaluator (45) - Validation Evidence Test Statistic Accumulator (46, 47) - Validation Evidence Native PIT Generator (48) - Validation Evidence Sample (49) - Validation Evidence Ensemble (50, 51, 52) - Validation Hypothesis T Test Outcome (53, 54, 55) - Validation Hypothesis Significance Test Setting (56, 57) - Validation Hypothesis Significance Test Outcome (58, 59, 60) Samples: IdeaDRIP: --- ReleaseNotes/01_26_2023.txt | 40 ++ ScheduleSheet.xlsx | Bin 48739 -> 48694 bytes .../validation/distance/GapLossFunction.java | 23 +- .../distance/GapLossWeightFunction.java | 23 +- .../validation/distance/GapTestOutcome.java | 34 +- .../validation/distance/GapTestSetting.java | 53 +- .../distance/HypothesisOutcome.java | 24 +- .../distance/HypothesisOutcomeSuite.java | 55 +- .../validation/distance/HypothesisSuite.java | 34 +- .../validation/distance/ImportanceWeight.java | 65 +-- .../org/drip/validation/distance/README.md | 5 +- .../drip/validation/evidence/Ensemble.java | 224 ++++---- .../evidence/NativePITGenerator.java | 8 +- .../org/drip/validation/evidence/Sample.java | 41 +- .../evidence/TestStatisticAccumulator.java | 77 ++- .../evidence/TestStatisticEvaluator.java | 7 +- .../hypothesis/SignificanceTestOutcome.java | 24 +- .../hypothesis/SignificanceTestSetting.java | 52 +- .../validation/hypothesis/TTestOutcome.java | 51 +- .../java/org/drip/xva/topology/Adiabat.java | 535 +++++++----------- .../xva/topology/AdiabatMarketParams.java | 117 ++-- .../drip/xva/topology/CollateralGroup.java | 69 +-- .../drip/xva/topology/CreditDebtGroup.java | 129 ++--- .../org/drip/xva/topology/FundingGroup.java | 251 ++++---- .../org/drip/xva/vertex/AlbaneseAndersen.java | 21 +- .../org/drip/xva/vertex/BurgardKjaer.java | 42 +- .../drip/xva/vertex/BurgardKjaerBuilder.java | 262 ++++----- .../drip/xva/vertex/BurgardKjaerExposure.java | 41 +- 28 files changed, 1014 insertions(+), 1293 deletions(-) create mode 100644 ReleaseNotes/01_26_2023.txt diff --git a/ReleaseNotes/01_26_2023.txt b/ReleaseNotes/01_26_2023.txt new file mode 100644 index 000000000000..9f885f60e88a --- /dev/null +++ b/ReleaseNotes/01_26_2023.txt @@ -0,0 +1,40 @@ + +Features: + +Bug Fixes/Re-organization: + + - XVA Topology Collateral Group (1, 2, 3) + - XVA Topology Credit Debt Group #1 (4, 5) + - XVA Topology Credit Debt Group #2 (6, 7) + - XVA Topology Funding Group #1 (8, 9) + - XVA Topology Funding Group #2 (10, 11) + - XVA Topology Adiabat Market Parameters #1 (12, 13, 14) + - XVA Topology Adiabat Market Parameters #2 (15, 16) + - XVA Topology Adiabat #1 (17, 18) + - XVA Topology Adiabat #2 (19, 20) + - XVA Vertex Albanese Andersen (21) + - XVA Vertex Burgard Kjaer Exposure (22, 23, 24) + - XVA Vertex Burgard Kjaer (25, 26, 27) + - XVA Vertex Burgard Kjaer Builder (28, 29) + - Validation Distance Importance Weight (30, 31) + - Validation Distance Hypothesis Suite (32, 33) + - Validation Distance Gap Test Outcome (34, 35) + - Validation Distance Hypothesis Outcome (36) + - Validation Distance Hypothesis Outcome Suite (37, 38) + - Validation Distance Gap Loss Test (39) + - Validation Distance Gap Loss Weight Function (40) + - Validation Distance Gap Test Setting (41, 42) + - Validation Distance README (43, 44) + - Validation Evidence Test Statistic Evaluator (45) + - Validation Evidence Test Statistic Accumulator (46, 47) + - Validation Evidence Native PIT Generator (48) + - Validation Evidence Sample (49) + - Validation Evidence Ensemble (50, 51, 52) + - Validation Hypothesis T Test Outcome (53, 54, 55) + - Validation Hypothesis Significance Test Setting (56, 57) + - Validation Hypothesis Significance Test Outcome (58, 59, 60) + + +Samples: + +IdeaDRIP: diff --git a/ScheduleSheet.xlsx b/ScheduleSheet.xlsx index d0efda5ce88fcc545d80de6e485d276f4fb8a75e..d9a67be933ad53408d99414f286ae2101e678ceb 100644 GIT binary patch delta 14715 zcmY+r1zeNu|2<9#qBH`dr3F!jG>lM6xo^ZEY%zFutiwfo|pT<3nD_c`a<7A|nAE^tc!;@`4NW)Ng3)K_;n8WVc1dwD;o_(c>9@mxqLDbps@ z8@%}X?A^1G(L75rxzx1HlP)@@O$d#GvR-!os1T?oCQE3 zgMK=0B{^;yEkHsdLVchC?ZXQSymf_BG#JBvUqy_IN8sI;5Nn2Mqc4%Ycc}UN`?u9E zp7-}%lSZ+J#oGk*OD0_IzwVP!!YkTXRtD`rB1-P>H+A8TU>Bq^MXeE0L`oc6u;Tb$ zFP_h`C$~#ddMGrmsWWym{4BFNQ@0YQt6^ghLkWbE8-I4x{`Ob%4V0LXm1fokC~NM~^DEXt_U#)xbmw@R9c8^m{x6yA zZSm5#(#MhC-SA;$GpZlggv!Yz)fQ$2qd32cGHIxdZ%-lT!a6v&q8X?6YuyJt=oQ8Y zbCxIZ-l;jnMvl^;9zhNJ&!p_0z=+6KiQ9R9z8YK`dahicPTjWYX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T9%VKb@G?;?o*0Oc^l! z{ymdtG?}J37s%!0X`*x$J#PfXrLQn}gL-Y6hOznX#)b|>c z@SEb{5;^ra&QX@>b=Le(m5h_hv2#D+-&FLUC{UZQT2Ix zRF#-X&f@wsY*M(ZjoP`dBf*(NPMbx?)96b?zE+^@LwbTo-+rlH;?|Sc03jl#1&bAh zB=7Pu0$!hQD|IG+93eM!nfXw8Cwxt|ld-5n)yfWTZ2JZ~Cb>x{me~Dg{BTXy>{4JE z#tcSe%O1W0P#UYD@Sfl(B_z04wwL*x^Y94TJg($DqFBDfyLWFro>^Mm)Ip!{%%tsB&y}f z0U}3bCoGsTOq%F-1}yU1C2agXZJ*T*OPg4TPuY`~GU3E8&0BG3X`GCJ&sP+1zl2BS z6jkCF|9-8~s7C!R;R7@@IL8BWcwfy!%Kv_?tP}$c0>bD2{OIArU(}MoAJ%fBZ^9*N zrO~V5fwdCo0`T@)T8h8Bhk=H6ijRi&=zm@V-WkI0)V;XFTmYA@Q@Qh`5FQU+o_>Ri z)HA|y>N(MW!JpS_qRYTP*E3N3-DeQD?e3tV5&mD3l)`)K#n6S}cnu7g*S}Ct{U2AP B Invalid Inputs"); + if (!NumberUtil.IsValid (gap)) { + throw new Exception ("GapLossFunction::loss => Invalid Inputs"); } return gap * gap; @@ -157,11 +161,10 @@ public static final GapLossFunction ConservativePortfolioTest() { @Override public double loss ( final double gap) - throws java.lang.Exception + throws Exception { - if (!org.drip.numerical.common.NumberUtil.IsValid (gap)) - { - throw new java.lang.Exception ("GapLossFunction::loss => Invalid Inputs"); + if (!NumberUtil.IsValid (gap)) { + throw new Exception ("GapLossFunction::loss => Invalid Inputs"); } return gap < 0. ? 0. : gap * gap; @@ -177,10 +180,10 @@ public static final GapLossFunction ConservativePortfolioTest() * * @return The Loss * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public abstract double loss ( final double gap) - throws java.lang.Exception; + throws Exception; } diff --git a/src/main/java/org/drip/validation/distance/GapLossWeightFunction.java b/src/main/java/org/drip/validation/distance/GapLossWeightFunction.java index 0c236c1340fd..a97b3ad9bc40 100644 --- a/src/main/java/org/drip/validation/distance/GapLossWeightFunction.java +++ b/src/main/java/org/drip/validation/distance/GapLossWeightFunction.java @@ -1,11 +1,16 @@ package org.drip.validation.distance; +import org.drip.numerical.common.NumberUtil; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -130,11 +135,10 @@ public static final GapLossWeightFunction CramersVonMises() { @Override public double weight ( final double pValueHypothesis) - throws java.lang.Exception + throws Exception { - if (!org.drip.numerical.common.NumberUtil.IsValid (pValueHypothesis)) - { - throw new java.lang.Exception ("GapLossWeightFunction::weight => Invalid Inputs"); + if (!NumberUtil.IsValid (pValueHypothesis)) { + throw new Exception ("GapLossWeightFunction::weight => Invalid Inputs"); } return 1.; @@ -154,11 +158,10 @@ public static final GapLossWeightFunction AndersonDarling() { @Override public double weight ( final double pValueHypothesis) - throws java.lang.Exception + throws Exception { - if (!org.drip.numerical.common.NumberUtil.IsValid (pValueHypothesis)) - { - throw new java.lang.Exception ("GapLossWeightFunction::weight => Invalid Inputs"); + if (!NumberUtil.IsValid (pValueHypothesis)) { + throw new Exception ("GapLossWeightFunction::weight => Invalid Inputs"); } return 0. == pValueHypothesis || 1. == pValueHypothesis ? 0. : @@ -175,10 +178,10 @@ public static final GapLossWeightFunction AndersonDarling() * * @return The Weight * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public abstract double weight ( final double pValueHypothesis) - throws java.lang.Exception; + throws Exception; } diff --git a/src/main/java/org/drip/validation/distance/GapTestOutcome.java b/src/main/java/org/drip/validation/distance/GapTestOutcome.java index f402864db621..2f274479d4fa 100644 --- a/src/main/java/org/drip/validation/distance/GapTestOutcome.java +++ b/src/main/java/org/drip/validation/distance/GapTestOutcome.java @@ -1,11 +1,17 @@ package org.drip.validation.distance; +import org.drip.numerical.common.NumberUtil; +import org.drip.validation.hypothesis.ProbabilityIntegralTransform; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -117,11 +123,9 @@ public class GapTestOutcome { - private double _distance = java.lang.Double.NaN; - private org.drip.validation.hypothesis.ProbabilityIntegralTransform - _probabilityIntegralTransformWeighted = null; - private org.drip.validation.hypothesis.ProbabilityIntegralTransform - _probabilityIntegralTransformUnweighted = null; + private double _distance = Double.NaN; + private ProbabilityIntegralTransform _probabilityIntegralTransformWeighted = null; + private ProbabilityIntegralTransform _probabilityIntegralTransformUnweighted = null; /** * GapTestOutcome Constructor @@ -131,22 +135,19 @@ public class GapTestOutcome * Losses * @param distance Distance Metric * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public GapTestOutcome ( - final org.drip.validation.hypothesis.ProbabilityIntegralTransform - probabilityIntegralTransformUnweighted, - final org.drip.validation.hypothesis.ProbabilityIntegralTransform - probabilityIntegralTransformWeighted, + final ProbabilityIntegralTransform probabilityIntegralTransformUnweighted, + final ProbabilityIntegralTransform probabilityIntegralTransformWeighted, final double distance) - throws java.lang.Exception + throws Exception { if (null == (_probabilityIntegralTransformUnweighted = probabilityIntegralTransformUnweighted) || null == (_probabilityIntegralTransformWeighted = probabilityIntegralTransformWeighted) || - !org.drip.numerical.common.NumberUtil.IsValid (_distance = distance)) - { - throw new java.lang.Exception ("GapTestOutcome Constructor => Invalid Inputs"); + !NumberUtil.IsValid (_distance = distance)) { + throw new Exception ("GapTestOutcome Constructor => Invalid Inputs"); } } @@ -156,8 +157,7 @@ public GapTestOutcome ( * @return The Probability Integral Transform of the Raw Gap Losses */ - public org.drip.validation.hypothesis.ProbabilityIntegralTransform - probabilityIntegralTransformUnweighted() + public ProbabilityIntegralTransform probabilityIntegralTransformUnweighted() { return _probabilityIntegralTransformUnweighted; } @@ -168,7 +168,7 @@ public GapTestOutcome ( * @return The Probability Integral Transform of the Weighted Gap Losses */ - public org.drip.validation.hypothesis.ProbabilityIntegralTransform probabilityIntegralTransformWeighted() + public ProbabilityIntegralTransform probabilityIntegralTransformWeighted() { return _probabilityIntegralTransformWeighted; } diff --git a/src/main/java/org/drip/validation/distance/GapTestSetting.java b/src/main/java/org/drip/validation/distance/GapTestSetting.java index 88e8c5bcff50..3d304e5555cb 100644 --- a/src/main/java/org/drip/validation/distance/GapTestSetting.java +++ b/src/main/java/org/drip/validation/distance/GapTestSetting.java @@ -6,6 +6,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -117,8 +120,8 @@ public class GapTestSetting { - private org.drip.validation.distance.GapLossFunction _lossFunction = null; - private org.drip.validation.distance.GapLossWeightFunction _lossWeightFunction = null; + private GapLossFunction _lossFunction = null; + private GapLossWeightFunction _lossWeightFunction = null; /** * Construct the Anfuso Karyampas Nawroth (2017) Risk Factor Loss Test Variant of the Gap Test Setting @@ -129,17 +132,11 @@ public class GapTestSetting */ public static final GapTestSetting RiskFactorLossTest ( - final org.drip.validation.distance.GapLossWeightFunction lossWeightFunction) + final GapLossWeightFunction lossWeightFunction) { - try - { - return new GapTestSetting ( - org.drip.validation.distance.GapLossFunction.RiskFactorTest(), - lossWeightFunction - ); - } - catch (java.lang.Exception e) - { + try { + return new GapTestSetting (GapLossFunction.RiskFactorTest(), lossWeightFunction); + } catch (Exception e) { e.printStackTrace(); } @@ -157,17 +154,11 @@ public static final GapTestSetting RiskFactorLossTest ( */ public static final GapTestSetting ConservativePortfolioLossTest ( - final org.drip.validation.distance.GapLossWeightFunction lossWeightFunction) + final GapLossWeightFunction lossWeightFunction) { - try - { - return new GapTestSetting ( - org.drip.validation.distance.GapLossFunction.ConservativePortfolioTest(), - lossWeightFunction - ); - } - catch (java.lang.Exception e) - { + try { + return new GapTestSetting (GapLossFunction.ConservativePortfolioTest(), lossWeightFunction); + } catch (Exception e) { e.printStackTrace(); } @@ -180,18 +171,16 @@ public static final GapTestSetting ConservativePortfolioLossTest ( * @param lossFunction Gap Loss Function * @param lossWeightFunction Gap Loss Weight Function * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public GapTestSetting ( - final org.drip.validation.distance.GapLossFunction lossFunction, - final org.drip.validation.distance.GapLossWeightFunction lossWeightFunction) - throws java.lang.Exception + final GapLossFunction lossFunction, + final GapLossWeightFunction lossWeightFunction) + throws Exception { - if (null == (_lossFunction = lossFunction) || - null == (_lossWeightFunction = lossWeightFunction)) - { - throw new java.lang.Exception ("GapTestSetting Constructor => Invalid Inputs"); + if (null == (_lossFunction = lossFunction) || null == (_lossWeightFunction = lossWeightFunction)) { + throw new Exception ("GapTestSetting Constructor => Invalid Inputs"); } } @@ -201,7 +190,7 @@ public GapTestSetting ( * @return The Gap Loss Function */ - public org.drip.validation.distance.GapLossFunction lossFunction() + public GapLossFunction lossFunction() { return _lossFunction; } @@ -212,7 +201,7 @@ public org.drip.validation.distance.GapLossFunction lossFunction() * @return The Gap Loss Weight Function */ - public org.drip.validation.distance.GapLossWeightFunction lossWeightFunction() + public GapLossWeightFunction lossWeightFunction() { return _lossWeightFunction; } diff --git a/src/main/java/org/drip/validation/distance/HypothesisOutcome.java b/src/main/java/org/drip/validation/distance/HypothesisOutcome.java index a94b66693a05..c6a2ec8a5300 100644 --- a/src/main/java/org/drip/validation/distance/HypothesisOutcome.java +++ b/src/main/java/org/drip/validation/distance/HypothesisOutcome.java @@ -6,6 +6,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -117,8 +120,8 @@ public class HypothesisOutcome { - private java.lang.String _hypothesisID = ""; - private org.drip.validation.distance.GapTestOutcome _gapTestOutcome = null; + private String _hypothesisID = ""; + private GapTestOutcome _gapTestOutcome = null; /** * HypothesisOutcome Constructor @@ -126,18 +129,17 @@ public class HypothesisOutcome * @param hypothesisID The Hypothesis ID * @param gapTestOutcome The Gap Test Outcome * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public HypothesisOutcome ( - final java.lang.String hypothesisID, - final org.drip.validation.distance.GapTestOutcome gapTestOutcome) - throws java.lang.Exception + final String hypothesisID, + final GapTestOutcome gapTestOutcome) + throws Exception { if (null == (_hypothesisID = hypothesisID) || _hypothesisID.isEmpty() || - null == (_gapTestOutcome = gapTestOutcome)) - { - throw new java.lang.Exception ("HypothesisOutcome Constructor => Invalid Inputs"); + null == (_gapTestOutcome = gapTestOutcome)) { + throw new Exception ("HypothesisOutcome Constructor => Invalid Inputs"); } } @@ -147,7 +149,7 @@ public HypothesisOutcome ( * @return The Hypothesis ID */ - public java.lang.String hypothesisID() + public String hypothesisID() { return _hypothesisID; } @@ -158,7 +160,7 @@ public java.lang.String hypothesisID() * @return The Gap Test Outcome */ - public org.drip.validation.distance.GapTestOutcome gapTestOutcome() + public GapTestOutcome gapTestOutcome() { return _gapTestOutcome; } diff --git a/src/main/java/org/drip/validation/distance/HypothesisOutcomeSuite.java b/src/main/java/org/drip/validation/distance/HypothesisOutcomeSuite.java index 6f5da4f20558..67bf19b4ca63 100644 --- a/src/main/java/org/drip/validation/distance/HypothesisOutcomeSuite.java +++ b/src/main/java/org/drip/validation/distance/HypothesisOutcomeSuite.java @@ -1,11 +1,19 @@ package org.drip.validation.distance; +import java.util.Map; +import java.util.TreeMap; + +import org.drip.analytics.support.CaseInsensitiveHashMap; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -118,11 +126,9 @@ public class HypothesisOutcomeSuite { - private java.util.Map _outcomeMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + private TreeMap _distanceHypothesisMap = new TreeMap(); - private java.util.TreeMap _distanceHypothesisMap = new - java.util.TreeMap(); + private Map _outcomeMap = new CaseInsensitiveHashMap(); /** * Empty HypothesisOutcomeSuite Constructor @@ -138,7 +144,7 @@ public HypothesisOutcomeSuite() * @return The Outcome Map */ - public java.util.Map outcomeMap() + public Map outcomeMap() { return _outcomeMap; } @@ -149,7 +155,7 @@ public java.util.Map distanceHypothesisMap() + public TreeMap distanceHypothesisMap() { return _distanceHypothesisMap; } @@ -164,24 +170,16 @@ public java.util.TreeMap distanceHypothesisM */ public boolean add ( - final java.lang.String hypothesisID, - final org.drip.validation.distance.GapTestOutcome gapTestOutcome) + final String hypothesisID, + final GapTestOutcome gapTestOutcome) { - if (null == hypothesisID || hypothesisID.isEmpty() || - null == gapTestOutcome) - { + if (null == hypothesisID || hypothesisID.isEmpty() || null == gapTestOutcome) { return false; } - _outcomeMap.put ( - hypothesisID, - gapTestOutcome - ); + _outcomeMap.put (hypothesisID, gapTestOutcome); - _distanceHypothesisMap.put ( - gapTestOutcome.distance(), - hypothesisID - ); + _distanceHypothesisMap.put (gapTestOutcome.distance(), hypothesisID); return true; } @@ -192,24 +190,17 @@ public boolean add ( * @return The Leading/Best Fit Hypothesis and its Test Outcome */ - public org.drip.validation.distance.HypothesisOutcome leadingHypothesis() + public HypothesisOutcome leadingHypothesis() { - if (0 == _distanceHypothesisMap.size()) - { + if (0 == _distanceHypothesisMap.size()) { return null; } - java.lang.String leadingHypothesisID = _distanceHypothesisMap.firstEntry().getValue(); + String leadingHypothesisID = _distanceHypothesisMap.firstEntry().getValue(); - try - { - return new org.drip.validation.distance.HypothesisOutcome ( - leadingHypothesisID, - _outcomeMap.get (leadingHypothesisID) - ); - } - catch (java.lang.Exception e) - { + try { + return new HypothesisOutcome (leadingHypothesisID, _outcomeMap.get (leadingHypothesisID)); + } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/org/drip/validation/distance/HypothesisSuite.java b/src/main/java/org/drip/validation/distance/HypothesisSuite.java index acd8c6cb0c3b..e225e451c931 100644 --- a/src/main/java/org/drip/validation/distance/HypothesisSuite.java +++ b/src/main/java/org/drip/validation/distance/HypothesisSuite.java @@ -1,11 +1,19 @@ package org.drip.validation.distance; +import java.util.Map; + +import org.drip.analytics.support.CaseInsensitiveHashMap; +import org.drip.validation.evidence.Ensemble; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -117,8 +125,7 @@ public class HypothesisSuite { - private java.util.Map _hypothesisMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + private Map _hypothesisMap = new CaseInsensitiveHashMap(); /** * Empty HypothesisSuite Constructor @@ -134,7 +141,7 @@ public HypothesisSuite() * @return The Hypothesis Map */ - public java.util.Map hypothesisMap() + public Map hypothesisMap() { return _hypothesisMap; } @@ -149,19 +156,14 @@ public java.util.Map hy */ public boolean add ( - final java.lang.String hypothesisID, - final org.drip.validation.evidence.Ensemble hypothesis) + final String hypothesisID, + final Ensemble hypothesis) { - if (null == hypothesisID || hypothesisID.isEmpty() || - null == hypothesis) - { + if (null == hypothesisID || hypothesisID.isEmpty() || null == hypothesis) { return false; } - _hypothesisMap.put ( - hypothesisID, - hypothesis - ); + _hypothesisMap.put (hypothesisID, hypothesis); return true; } @@ -175,9 +177,9 @@ public boolean add ( */ public boolean containsHypothesis ( - final java.lang.String hypothesisID) + final String hypothesisID) { - return null != hypothesisID && !hypothesisID.isEmpty() && _hypothesisMap.containsKey (hypothesisID); + return null != hypothesisID && _hypothesisMap.containsKey (hypothesisID); } /** @@ -188,8 +190,8 @@ public boolean containsHypothesis ( * @return The Hypothesis Specified by the ID */ - public org.drip.validation.evidence.Ensemble hypothesis ( - final java.lang.String hypothesisID) + public Ensemble hypothesis ( + final String hypothesisID) { return containsHypothesis (hypothesisID) ? _hypothesisMap.get (hypothesisID) : null; } diff --git a/src/main/java/org/drip/validation/distance/ImportanceWeight.java b/src/main/java/org/drip/validation/distance/ImportanceWeight.java index edd69cfc3e22..576fa19a6149 100644 --- a/src/main/java/org/drip/validation/distance/ImportanceWeight.java +++ b/src/main/java/org/drip/validation/distance/ImportanceWeight.java @@ -1,11 +1,19 @@ package org.drip.validation.distance; +import org.drip.function.e2erf.ErrorFunctionInverse; +import org.drip.measure.continuous.R1Univariate; +import org.drip.measure.gaussian.R1UnivariateNormal; +import org.drip.numerical.common.NumberUtil; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -117,8 +125,8 @@ public class ImportanceWeight { - private double _positiveExpectation = java.lang.Double.NaN; - private org.drip.measure.continuous.R1Univariate _r1Univariate = null; + private R1Univariate _r1Univariate = null; + private double _positiveExpectation = Double.NaN; /** * Construct the Importance Weight Version based on Normal Distribution @@ -129,10 +137,9 @@ public class ImportanceWeight */ public static final ImportanceWeight Normal ( - final org.drip.measure.gaussian.R1UnivariateNormal r1UnivariateNormal) + final R1UnivariateNormal r1UnivariateNormal) { - if (null == r1UnivariateNormal) - { + if (null == r1UnivariateNormal) { return null; } @@ -140,38 +147,30 @@ public static final ImportanceWeight Normal ( final double sigma = r1UnivariateNormal.sigma(); - org.drip.measure.gaussian.R1UnivariateNormal r1UnivariateNormalStandard = - org.drip.measure.gaussian.R1UnivariateNormal.Standard(); + R1UnivariateNormal r1UnivariateNormalStandard = R1UnivariateNormal.Standard(); double meanOverSigma = mean / sigma; - try - { - final double positiveExpectation = java.lang.Math.max ( + try { + final double positiveExpectation = Math.max ( mean * r1UnivariateNormalStandard.cumulative (meanOverSigma) + sigma * r1UnivariateNormalStandard.density (meanOverSigma), 0. ); - return new ImportanceWeight ( - r1UnivariateNormal, - positiveExpectation - ) - { + return new ImportanceWeight (r1UnivariateNormal, positiveExpectation) { @Override public double quantileLoading ( final double q) - throws java.lang.Exception + throws Exception { - return 0. == positiveExpectation ? 0. : java.lang.Math.max ( - org.drip.function.e2erf.ErrorFunctionInverse.Winitzki2008b().evaluate - (2. * q - 1.) * sigma * java.lang.Math.sqrt (2.) + mean, + return 0. == positiveExpectation ? 0. : Math.max ( + ErrorFunctionInverse.Winitzki2008b().evaluate (2. * q - 1.) * sigma * Math.sqrt (2.) + + mean, 0 ) / positiveExpectation; } }; - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); } @@ -184,19 +183,17 @@ public static final ImportanceWeight Normal ( * @param r1Univariate The Underlying R1 Distribution * @param positiveExpectation The Positive Expectation * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public ImportanceWeight ( - final org.drip.measure.continuous.R1Univariate r1Univariate, + final R1Univariate r1Univariate, final double positiveExpectation) - throws java.lang.Exception + throws Exception { if (null == (_r1Univariate = r1Univariate) || - !org.drip.numerical.common.NumberUtil.IsValid (_positiveExpectation = positiveExpectation) || - 0. > _positiveExpectation) - { - throw new java.lang.Exception ("ImportanceWeight Constructor => Invalid Inputs"); + !NumberUtil.IsValid (_positiveExpectation = positiveExpectation) || 0. > _positiveExpectation) { + throw new Exception ("ImportanceWeight Constructor => Invalid Inputs"); } } @@ -217,7 +214,7 @@ public double positiveExpectation() * @return The Underlying R1 Distribution */ - public org.drip.measure.continuous.R1Univariate r1Univariate() + public R1Univariate r1Univariate() { return _r1Univariate; } @@ -229,16 +226,14 @@ public org.drip.measure.continuous.R1Univariate r1Univariate() * * @return The Importance Weight Loading * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public double quantileLoading ( final double q) throws java.lang.Exception { - return 0. == _positiveExpectation ? 0. : java.lang.Math.max ( - _r1Univariate.invCumulative (q), - 0 - ) / _positiveExpectation; + return 0. == _positiveExpectation ? 0. : + Math.max (_r1Univariate.invCumulative (q), 0) / _positiveExpectation; } } diff --git a/src/main/java/org/drip/validation/distance/README.md b/src/main/java/org/drip/validation/distance/README.md index 0f0e065e750a..a5d9998b87e8 100644 --- a/src/main/java/org/drip/validation/distance/README.md +++ b/src/main/java/org/drip/validation/distance/README.md @@ -16,7 +16,7 @@ DROP XVA Validation Distance implements the Hypothesis Target Distance Test Buil * [***GapTestOutcome***](https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/validation/distance/GapTestOutcome.java) GapTestOutcome holds the Outcomes of a Distance Test of a Sample from the Hypothesis. - * [***GapTestOutcome***](https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/validation/distance/GapTestOutcome.java) + * [***GapTestSetting***](https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/validation/distance/GapTestSetting.java) GapTestSetting holds the Settings required to Control a Gap Test Run. * [***HypothesisOutcome***](https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/validation/distance/HypothesisOutcome.java) @@ -28,9 +28,6 @@ DROP XVA Validation Distance implements the Hypothesis Target Distance Test Buil * [***HypothesisSuite***](https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/validation/distance/HypothesisSuite.java) HypothesisSuite holds the Map of Hypotheses to be subjected to Discriminatory Power Analysis. - * [***HypothesisSuite***](https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/validation/distance/HypothesisSuite.java) - HypothesisSuite holds the Map of Hypotheses to be subjected to Discriminatory Power Analysis. - * [***ImportanceWeight***](https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/validation/distance/ImportanceWeight.java) ImportanceWeight weighs the Importance of each Empirical Hypothesis Outcome. diff --git a/src/main/java/org/drip/validation/evidence/Ensemble.java b/src/main/java/org/drip/validation/evidence/Ensemble.java index 0369fca0d9bc..f88b1b5e8b4c 100644 --- a/src/main/java/org/drip/validation/evidence/Ensemble.java +++ b/src/main/java/org/drip/validation/evidence/Ensemble.java @@ -1,11 +1,22 @@ package org.drip.validation.evidence; +import org.drip.measure.statistics.UnivariateMoments; +import org.drip.numerical.common.NumberUtil; +import org.drip.validation.hypothesis.ProbabilityIntegralTransform; +import org.drip.validation.hypothesis.ProbabilityIntegralTransformTest; +import org.drip.validation.hypothesis.SignificanceTestSetting; +import org.drip.validation.hypothesis.StatisticalTestOutcome; +import org.drip.validation.hypothesis.TTestOutcome; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -116,14 +127,12 @@ * @author Lakshmi Krishnamurthy */ -public class Ensemble implements org.drip.validation.evidence.NativePITGenerator +public class Ensemble implements NativePITGenerator { + private Sample[] _sampleArray = null; private double[][] _evaluatedSampleTestStatistic = null; - private org.drip.validation.evidence.Sample[] _sampleArray = null; - private org.drip.validation.evidence.TestStatisticEvaluator[] _testStatisticEvaluatorArray = - null; - private org.drip.validation.hypothesis.ProbabilityIntegralTransform[] _probabilityIntegralTransformArray - = null; + private TestStatisticEvaluator[] _testStatisticEvaluatorArray = null; + private ProbabilityIntegralTransform[] _probabilityIntegralTransformArray = null; /** * Ensemble Constructor @@ -131,66 +140,55 @@ public class Ensemble implements org.drip.validation.evidence.NativePITGenerator * @param sampleArray Array of the Statistical Hypothesis Samples * @param testStatisticEvaluatorArray Array of the Test Statistic Evaluators * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public Ensemble ( - final org.drip.validation.evidence.Sample[] sampleArray, - final org.drip.validation.evidence.TestStatisticEvaluator[] testStatisticEvaluatorArray) - throws java.lang.Exception + final Sample[] sampleArray, + final TestStatisticEvaluator[] testStatisticEvaluatorArray) + throws Exception { if (null == (_sampleArray = sampleArray) || - null == (_testStatisticEvaluatorArray = testStatisticEvaluatorArray)) - { - throw new java.lang.Exception ("Ensemble Constructor => Invalid Inputs"); + null == (_testStatisticEvaluatorArray = testStatisticEvaluatorArray)) { + throw new Exception ("Ensemble Constructor => Invalid Inputs"); } int sampleCount = _sampleArray.length; int testStatisticEvaluatorCount = _testStatisticEvaluatorArray.length; _evaluatedSampleTestStatistic = new double[testStatisticEvaluatorCount][sampleCount]; - _probabilityIntegralTransformArray = new - org.drip.validation.hypothesis.ProbabilityIntegralTransform[testStatisticEvaluatorCount]; + _probabilityIntegralTransformArray = new ProbabilityIntegralTransform[testStatisticEvaluatorCount]; - if (0 == sampleCount || 0 == testStatisticEvaluatorCount) - { - throw new java.lang.Exception ("Ensemble Constructor => Invalid Inputs"); + if (0 == sampleCount || 0 == testStatisticEvaluatorCount) { + throw new Exception ("Ensemble Constructor => Invalid Inputs"); } - for (int sampleIndex = 0; sampleIndex < sampleCount; ++sampleIndex) - { - if (null == _sampleArray[sampleIndex]) - { - throw new java.lang.Exception ("Ensemble Constructor => Invalid Inputs"); + for (int sampleIndex = 0; sampleIndex < sampleCount; ++sampleIndex) { + if (null == _sampleArray[sampleIndex]) { + throw new Exception ("Ensemble Constructor => Invalid Inputs"); } } for (int testStatisticEvaluatorIndex = 0; testStatisticEvaluatorIndex < testStatisticEvaluatorCount; - ++testStatisticEvaluatorIndex) - { - if (null == _testStatisticEvaluatorArray[testStatisticEvaluatorIndex]) - { - throw new java.lang.Exception ("Ensemble Constructor => Invalid Inputs"); + ++testStatisticEvaluatorIndex) { + if (null == _testStatisticEvaluatorArray[testStatisticEvaluatorIndex]) { + throw new Exception ("Ensemble Constructor => Invalid Inputs"); } - org.drip.validation.evidence.TestStatisticAccumulator testStatisticAccumulator = new - org.drip.validation.evidence.TestStatisticAccumulator(); + TestStatisticAccumulator testStatisticAccumulator = new TestStatisticAccumulator(); - for (int sampleIndex = 0; sampleIndex < sampleCount; ++sampleIndex) - { + for (int sampleIndex = 0; sampleIndex < sampleCount; ++sampleIndex) { if (!testStatisticAccumulator.addTestStatistic (_evaluatedSampleTestStatistic[testStatisticEvaluatorIndex][sampleIndex] = _sampleArray[sampleIndex].applyTestStatistic - (_testStatisticEvaluatorArray[testStatisticEvaluatorIndex]))) - { - throw new java.lang.Exception ("Ensemble Constructor => Invalid Inputs"); + (_testStatisticEvaluatorArray[testStatisticEvaluatorIndex]))) { + throw new Exception ("Ensemble Constructor => Invalid Inputs"); } } if (null == (_probabilityIntegralTransformArray[testStatisticEvaluatorIndex] = - testStatisticAccumulator.probabilityIntegralTransform())) - { - throw new java.lang.Exception ("Ensemble Constructor => Invalid Inputs"); + testStatisticAccumulator.probabilityIntegralTransform())) { + throw new Exception ("Ensemble Constructor => Invalid Inputs"); } } } @@ -212,7 +210,7 @@ public double[][] evaluatedSampleTestStatistic() * @return The Array of the Statistical Hypothesis Samples */ - public org.drip.validation.evidence.Sample[] sampleArray() + public Sample[] sampleArray() { return _sampleArray; } @@ -223,7 +221,7 @@ public org.drip.validation.evidence.Sample[] sampleArray() * @return The Array of the Test Statistic Evaluators */ - public org.drip.validation.evidence.TestStatisticEvaluator[] testStatisticEvaluatorArray() + public TestStatisticEvaluator[] testStatisticEvaluatorArray() { return _testStatisticEvaluatorArray; } @@ -234,7 +232,7 @@ public org.drip.validation.evidence.TestStatisticEvaluator[] testStatisticEvalua * @return The Array of Probability Integral Transforms */ - public org.drip.validation.hypothesis.ProbabilityIntegralTransform[] probabilityIntegralTransformArray() + public ProbabilityIntegralTransform[] probabilityIntegralTransformArray() { return _probabilityIntegralTransformArray; } @@ -245,25 +243,20 @@ public org.drip.validation.hypothesis.ProbabilityIntegralTransform[] probability * @return The Test Statistic Based Significance Test Hypothesis Array */ - public org.drip.validation.hypothesis.ProbabilityIntegralTransformTest[] significanceTest() + public ProbabilityIntegralTransformTest[] significanceTest() { int probabilityIntegralTransformCount = _testStatisticEvaluatorArray.length; - org.drip.validation.hypothesis.ProbabilityIntegralTransformTest[] - probabilityIntegralTransformTestArray = new - org.drip.validation.hypothesis.ProbabilityIntegralTransformTest[probabilityIntegralTransformCount]; + ProbabilityIntegralTransformTest[] probabilityIntegralTransformTestArray = + new ProbabilityIntegralTransformTest[probabilityIntegralTransformCount]; for (int probabilityIntegralTransformIndex = 0; probabilityIntegralTransformIndex < probabilityIntegralTransformCount; - ++probabilityIntegralTransformIndex) - { - try - { + ++probabilityIntegralTransformIndex) { + try { probabilityIntegralTransformTestArray[probabilityIntegralTransformIndex] = new org.drip.validation.hypothesis.ProbabilityIntegralTransformTest (_probabilityIntegralTransformArray[probabilityIntegralTransformIndex]); - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); return null; @@ -281,33 +274,28 @@ public org.drip.validation.hypothesis.ProbabilityIntegralTransformTest[] signifi * @return The Array of t-Test Results */ - public org.drip.validation.hypothesis.TTestOutcome[] tTest ( + public TTestOutcome[] tTest ( final double testStatistic) { int sampleCount = _sampleArray.length; int testStatisticEvaluatorCount = _testStatisticEvaluatorArray.length; - org.drip.validation.hypothesis.TTestOutcome[] tTestArray = new - org.drip.validation.hypothesis.TTestOutcome[testStatisticEvaluatorCount]; + TTestOutcome[] tTestOutcomeArray = new TTestOutcome[testStatisticEvaluatorCount]; for (int testStatisticEvaluatorIndex = 0; testStatisticEvaluatorIndex < testStatisticEvaluatorCount; - ++testStatisticEvaluatorIndex) - { - org.drip.measure.statistics.UnivariateMoments ensembleUnivariateMoments = - org.drip.measure.statistics.UnivariateMoments.Standard ( - "UnivariateMoments", - _evaluatedSampleTestStatistic[testStatisticEvaluatorIndex], - null - ); - - if (null == ensembleUnivariateMoments) - { + ++testStatisticEvaluatorIndex) { + UnivariateMoments ensembleUnivariateMoments = UnivariateMoments.Standard ( + "UnivariateMoments", + _evaluatedSampleTestStatistic[testStatisticEvaluatorIndex], + null + ); + + if (null == ensembleUnivariateMoments) { return null; } - try - { - tTestArray[testStatisticEvaluatorIndex] = new org.drip.validation.hypothesis.TTestOutcome ( + try { + tTestOutcomeArray[testStatisticEvaluatorIndex] = new TTestOutcome ( testStatistic, sampleCount, ensembleUnivariateMoments.mean(), @@ -319,16 +307,14 @@ public org.drip.validation.hypothesis.TTestOutcome[] tTest ( ensembleUnivariateMoments.tStatistic (testStatistic), ensembleUnivariateMoments.standardErrorOffset (testStatistic) ); - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); return null; } } - return tTestArray; + return tTestOutcomeArray; } /** @@ -340,63 +326,54 @@ public org.drip.validation.hypothesis.TTestOutcome[] tTest ( * @return The Array of Statistical Test Outcomes */ - public org.drip.validation.hypothesis.StatisticalTestOutcome[] statisticalTest ( + public StatisticalTestOutcome[] statisticalTest ( final double testStatistic, - final org.drip.validation.hypothesis.SignificanceTestSetting pTestSetting) + final SignificanceTestSetting pTestSetting) { - if (!org.drip.numerical.common.NumberUtil.IsValid (testStatistic) || null == pTestSetting) - { + if (!NumberUtil.IsValid (testStatistic) || null == pTestSetting) { return null; } int sampleCount = _sampleArray.length; int testStatisticEvaluatorCount = _testStatisticEvaluatorArray.length; - org.drip.validation.hypothesis.StatisticalTestOutcome[] statisticalTestOutcomeArray = new - org.drip.validation.hypothesis.StatisticalTestOutcome[testStatisticEvaluatorCount]; + StatisticalTestOutcome[] statisticalTestOutcomeArray = + new StatisticalTestOutcome[testStatisticEvaluatorCount]; - org.drip.validation.hypothesis.ProbabilityIntegralTransformTest[] - probabilityIntegralTransformTestArray = significanceTest(); + ProbabilityIntegralTransformTest[] probabilityIntegralTransformTestArray = significanceTest(); for (int testStatisticEvaluatorIndex = 0; testStatisticEvaluatorIndex < testStatisticEvaluatorCount; - ++testStatisticEvaluatorIndex) - { - org.drip.measure.statistics.UnivariateMoments ensembleUnivariateMoments = - org.drip.measure.statistics.UnivariateMoments.Standard ( - "UnivariateMoments", - _evaluatedSampleTestStatistic[testStatisticEvaluatorIndex], - null - ); - - if (null == ensembleUnivariateMoments) - { + ++testStatisticEvaluatorIndex) { + UnivariateMoments ensembleUnivariateMoments = UnivariateMoments.Standard ( + "UnivariateMoments", + _evaluatedSampleTestStatistic[testStatisticEvaluatorIndex], + null + ); + + if (null == ensembleUnivariateMoments) { return null; } - try - { - statisticalTestOutcomeArray[testStatisticEvaluatorIndex] = new - org.drip.validation.hypothesis.StatisticalTestOutcome ( - probabilityIntegralTransformTestArray[testStatisticEvaluatorIndex].significanceTest ( - testStatistic, - pTestSetting - ), - new org.drip.validation.hypothesis.TTestOutcome ( - testStatistic, - sampleCount, - ensembleUnivariateMoments.mean(), - ensembleUnivariateMoments.variance(), - ensembleUnivariateMoments.stdDev(), - ensembleUnivariateMoments.stdError(), - ensembleUnivariateMoments.degreesOfFreedom(), - ensembleUnivariateMoments.predictiveConfidenceLevel(), - ensembleUnivariateMoments.tStatistic (testStatistic), - ensembleUnivariateMoments.standardErrorOffset (testStatistic) - ) - ); - } - catch (java.lang.Exception e) - { + try { + statisticalTestOutcomeArray[testStatisticEvaluatorIndex] = new StatisticalTestOutcome ( + probabilityIntegralTransformTestArray[testStatisticEvaluatorIndex].significanceTest ( + testStatistic, + pTestSetting + ), + new TTestOutcome ( + testStatistic, + sampleCount, + ensembleUnivariateMoments.mean(), + ensembleUnivariateMoments.variance(), + ensembleUnivariateMoments.stdDev(), + ensembleUnivariateMoments.stdError(), + ensembleUnivariateMoments.degreesOfFreedom(), + ensembleUnivariateMoments.predictiveConfidenceLevel(), + ensembleUnivariateMoments.tStatistic (testStatistic), + ensembleUnivariateMoments.standardErrorOffset (testStatistic) + ) + ); + } catch (Exception e) { e.printStackTrace(); return null; @@ -406,20 +383,15 @@ public org.drip.validation.hypothesis.StatisticalTestOutcome[] statisticalTest ( return statisticalTestOutcomeArray; } - @Override public org.drip.validation.hypothesis.ProbabilityIntegralTransform - nativeProbabilityIntegralTransform() + @Override public ProbabilityIntegralTransform nativeProbabilityIntegralTransform() { - org.drip.validation.evidence.TestStatisticAccumulator testStatisticAccumulator = new - org.drip.validation.evidence.TestStatisticAccumulator(); + TestStatisticAccumulator testStatisticAccumulator = new TestStatisticAccumulator(); int sampleCount = _sampleArray.length; - for (int sampleIndex = 0; sampleIndex < sampleCount; ++sampleIndex) - { - for (double realization : _sampleArray[sampleIndex].realizationArray()) - { - if (!testStatisticAccumulator.addTestStatistic (realization)) - { + for (int sampleIndex = 0; sampleIndex < sampleCount; ++sampleIndex) { + for (double realization : _sampleArray[sampleIndex].realizationArray()) { + if (!testStatisticAccumulator.addTestStatistic (realization)) { return null; } } diff --git a/src/main/java/org/drip/validation/evidence/NativePITGenerator.java b/src/main/java/org/drip/validation/evidence/NativePITGenerator.java index 7bd71f8c8a4f..293824bfc1d6 100644 --- a/src/main/java/org/drip/validation/evidence/NativePITGenerator.java +++ b/src/main/java/org/drip/validation/evidence/NativePITGenerator.java @@ -1,11 +1,16 @@ package org.drip.validation.evidence; +import org.drip.validation.hypothesis.ProbabilityIntegralTransform; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -125,6 +130,5 @@ public interface NativePITGenerator * @return PIT over the Sample Instance Realizations */ - public abstract org.drip.validation.hypothesis.ProbabilityIntegralTransform - nativeProbabilityIntegralTransform(); + public abstract ProbabilityIntegralTransform nativeProbabilityIntegralTransform(); } diff --git a/src/main/java/org/drip/validation/evidence/Sample.java b/src/main/java/org/drip/validation/evidence/Sample.java index 66c5dd5dd272..648e4cdcfb6f 100644 --- a/src/main/java/org/drip/validation/evidence/Sample.java +++ b/src/main/java/org/drip/validation/evidence/Sample.java @@ -1,11 +1,17 @@ package org.drip.validation.evidence; +import org.drip.numerical.common.NumberUtil; +import org.drip.validation.hypothesis.ProbabilityIntegralTransform; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -115,7 +121,7 @@ * @author Lakshmi Krishnamurthy */ -public class Sample implements org.drip.validation.evidence.NativePITGenerator +public class Sample implements NativePITGenerator { private double[] _realizationArray = null; @@ -129,13 +135,11 @@ public class Sample implements org.drip.validation.evidence.NativePITGenerator public Sample ( final double[] realizationArray) - throws java.lang.Exception + throws Exception { - if (null == (_realizationArray = realizationArray) || - 0 == _realizationArray.length || - !org.drip.numerical.common.NumberUtil.IsValid (_realizationArray)) - { - throw new java.lang.Exception ("Sample Constructor => Invalid Inputs"); + if (null == (_realizationArray = realizationArray) || 0 == _realizationArray.length || + !NumberUtil.IsValid (_realizationArray)) { + throw new Exception ("Sample Constructor => Invalid Inputs"); } } @@ -157,31 +161,26 @@ public double[] realizationArray() * * @return The Sample Test Statistic * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public double applyTestStatistic ( - final org.drip.validation.evidence.TestStatisticEvaluator testStatisticEvaluator) - throws java.lang.Exception + final TestStatisticEvaluator testStatisticEvaluator) + throws Exception { - if (null == testStatisticEvaluator) - { - throw new java.lang.Exception ("Sample::applyTestStatistic => Invalid Inputs"); + if (null == testStatisticEvaluator) { + throw new Exception ("Sample::applyTestStatistic => Invalid Inputs"); } return testStatisticEvaluator.evaluate (_realizationArray); } - @Override public org.drip.validation.hypothesis.ProbabilityIntegralTransform - nativeProbabilityIntegralTransform() + @Override public ProbabilityIntegralTransform nativeProbabilityIntegralTransform() { - org.drip.validation.evidence.TestStatisticAccumulator testStatisticAccumulator = new - org.drip.validation.evidence.TestStatisticAccumulator(); + TestStatisticAccumulator testStatisticAccumulator = new TestStatisticAccumulator(); - for (double realization : _realizationArray) - { - if (!testStatisticAccumulator.addTestStatistic (realization)) - { + for (double realization : _realizationArray) { + if (!testStatisticAccumulator.addTestStatistic (realization)) { return null; } } diff --git a/src/main/java/org/drip/validation/evidence/TestStatisticAccumulator.java b/src/main/java/org/drip/validation/evidence/TestStatisticAccumulator.java index d716723924f0..05101f31a193 100644 --- a/src/main/java/org/drip/validation/evidence/TestStatisticAccumulator.java +++ b/src/main/java/org/drip/validation/evidence/TestStatisticAccumulator.java @@ -1,11 +1,20 @@ package org.drip.validation.evidence; +import java.util.Map; +import java.util.TreeMap; + +import org.drip.numerical.common.NumberUtil; +import org.drip.validation.hypothesis.ProbabilityIntegralTransform; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -118,7 +127,7 @@ public class TestStatisticAccumulator { private int _totalInstanceCount = 0; - private java.util.TreeMap _instanceCountMap = null; + private TreeMap _instanceCountMap = null; /** * Empty TestStatisticAccumulator Constructor @@ -134,7 +143,7 @@ public TestStatisticAccumulator() * @return The Instance Counter Map */ - public java.util.Map instanceCountMap() + public Map instanceCountMap() { return _instanceCountMap; } @@ -161,14 +170,12 @@ public int totalInstanceCount() public boolean addTestStatistic ( final double testStatistic) { - if (!org.drip.numerical.common.NumberUtil.IsValid (testStatistic)) - { + if (!NumberUtil.IsValid (testStatistic)) { return false; } - if (null == _instanceCountMap) - { - _instanceCountMap = new java.util.TreeMap(); + if (null == _instanceCountMap) { + _instanceCountMap = new TreeMap(); } _instanceCountMap.put ( @@ -187,25 +194,22 @@ public boolean addTestStatistic ( * * @return The Empirical Cumulative Test Statistic Probability from the Smallest Response Value * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public double cumulativeProbabilityFromLeft ( final double testStatistic) - throws java.lang.Exception + throws Exception { - if (!org.drip.numerical.common.NumberUtil.IsValid (testStatistic) || 0 == _totalInstanceCount) - { - throw new java.lang.Exception + if (!NumberUtil.IsValid (testStatistic) || 0 == _totalInstanceCount) { + throw new Exception ("TestStatisticAccumulator::cumulativeProbabilityFromLeft => Invalid Inputs"); } - double cumulativeProbabilityFromLeft = 0; + double cumulativeProbabilityFromLeft = 0.; - for (double testStatisticKey : _instanceCountMap.keySet()) - { - if (testStatisticKey > testStatistic) - { + for (double testStatisticKey : _instanceCountMap.keySet()) { + if (testStatisticKey > testStatistic) { break; } @@ -222,25 +226,22 @@ public double cumulativeProbabilityFromLeft ( * * @return The Empirical Cumulative Test Statistic Probability from the Largest Response Value * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public double cumulativeProbabilityFromRight ( final double testStatistic) - throws java.lang.Exception + throws Exception { - if (!org.drip.numerical.common.NumberUtil.IsValid (testStatistic) || 0 == _totalInstanceCount) - { - throw new java.lang.Exception + if (!NumberUtil.IsValid (testStatistic) || 0 == _totalInstanceCount) { + throw new Exception ("TestStatisticAccumulator::cumulativeProbabilityFromRight => Invalid Inputs"); } - double cumulativeProbabilityFromRight = 0; + double cumulativeProbabilityFromRight = 0.; - for (double testStatisticKey : _instanceCountMap.descendingKeySet()) - { - if (testStatisticKey < testStatistic) - { + for (double testStatisticKey : _instanceCountMap.descendingKeySet()) { + if (testStatisticKey < testStatistic) { break; } @@ -256,30 +257,22 @@ public double cumulativeProbabilityFromRight ( * @return The Test Statistic CDF Distribution */ - public org.drip.validation.hypothesis.ProbabilityIntegralTransform probabilityIntegralTransform() + public ProbabilityIntegralTransform probabilityIntegralTransform() { int instanceCount = 0; double totalInstanceCountReciprocal = 1. / _totalInstanceCount; - java.util.Map testStatisticPValueMap = new - java.util.TreeMap(); + Map testStatisticPValueMap = new TreeMap(); - for (double testStatisticKey : _instanceCountMap.keySet()) - { + for (double testStatisticKey : _instanceCountMap.keySet()) { instanceCount += _instanceCountMap.get (testStatisticKey); - testStatisticPValueMap.put ( - testStatisticKey, - totalInstanceCountReciprocal * instanceCount - ); + testStatisticPValueMap.put (testStatisticKey, totalInstanceCountReciprocal * instanceCount); } - try - { - return new org.drip.validation.hypothesis.ProbabilityIntegralTransform (testStatisticPValueMap); - } - catch (java.lang.Exception e) - { + try { + return new ProbabilityIntegralTransform (testStatisticPValueMap); + } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/org/drip/validation/evidence/TestStatisticEvaluator.java b/src/main/java/org/drip/validation/evidence/TestStatisticEvaluator.java index 9db5529cfb89..a3d3ce7af8c7 100644 --- a/src/main/java/org/drip/validation/evidence/TestStatisticEvaluator.java +++ b/src/main/java/org/drip/validation/evidence/TestStatisticEvaluator.java @@ -6,6 +6,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -126,10 +129,10 @@ public interface TestStatisticEvaluator * * @return The Test Statistic * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public abstract double evaluate ( final double[] sampleArray) - throws java.lang.Exception; + throws Exception; } diff --git a/src/main/java/org/drip/validation/hypothesis/SignificanceTestOutcome.java b/src/main/java/org/drip/validation/hypothesis/SignificanceTestOutcome.java index 29e3e964e24c..34bef8fe66c8 100644 --- a/src/main/java/org/drip/validation/hypothesis/SignificanceTestOutcome.java +++ b/src/main/java/org/drip/validation/hypothesis/SignificanceTestOutcome.java @@ -1,11 +1,16 @@ package org.drip.validation.hypothesis; +import org.drip.numerical.common.NumberUtil; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -118,9 +123,9 @@ public class SignificanceTestOutcome { private boolean _pass = false; - private double _testStatistic = java.lang.Double.NaN; - private double _leftTailPValue = java.lang.Double.NaN; - private double _rightTailPValue = java.lang.Double.NaN; + private double _testStatistic = Double.NaN; + private double _leftTailPValue = Double.NaN; + private double _rightTailPValue = Double.NaN; /** * SignificanceTestOutcome Constructor @@ -130,7 +135,7 @@ public class SignificanceTestOutcome * @param rightTailPValue Right Tail p-value * @param pass TRUE - Test successfully Passed * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public SignificanceTestOutcome ( @@ -138,13 +143,12 @@ public SignificanceTestOutcome ( final double leftTailPValue, final double rightTailPValue, final boolean pass) - throws java.lang.Exception + throws Exception { - if (!org.drip.numerical.common.NumberUtil.IsValid (_testStatistic = testStatistic) || - !org.drip.numerical.common.NumberUtil.IsValid (_leftTailPValue = leftTailPValue) || - !org.drip.numerical.common.NumberUtil.IsValid (_rightTailPValue = rightTailPValue)) - { - throw new java.lang.Exception ("SignificanceTestOutcome Constructor => Invalid Inputs"); + if (!NumberUtil.IsValid (_testStatistic = testStatistic) || + !NumberUtil.IsValid (_leftTailPValue = leftTailPValue) || + !NumberUtil.IsValid (_rightTailPValue = rightTailPValue)) { + throw new Exception ("SignificanceTestOutcome Constructor => Invalid Inputs"); } _pass = pass; diff --git a/src/main/java/org/drip/validation/hypothesis/SignificanceTestSetting.java b/src/main/java/org/drip/validation/hypothesis/SignificanceTestSetting.java index 5ba5a81e3029..e4eb4a72aad3 100644 --- a/src/main/java/org/drip/validation/hypothesis/SignificanceTestSetting.java +++ b/src/main/java/org/drip/validation/hypothesis/SignificanceTestSetting.java @@ -1,11 +1,16 @@ package org.drip.validation.hypothesis; +import org.drip.numerical.common.NumberUtil; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -149,8 +154,8 @@ public class SignificanceTestSetting public static final double ANFUSO_KARYAMPAS_NAWROTH_2017_P_TEST_THRESHOLD = 0.01; + private double _threshold = Double.NaN; private int _tailCheck = RIGHT_TAIL_CHECK; - private double _threshold = java.lang.Double.NaN; /** * Construct Right Tail Check Significance Test Setting using the Fisher Threshold @@ -160,15 +165,9 @@ public class SignificanceTestSetting public static final SignificanceTestSetting FisherRightTail() { - try - { - return new SignificanceTestSetting ( - FISHER_1925_P_TEST_THRESHOLD, - RIGHT_TAIL_CHECK - ); - } - catch (java.lang.Exception e) - { + try { + return new SignificanceTestSetting (FISHER_1925_P_TEST_THRESHOLD, RIGHT_TAIL_CHECK); + } catch (Exception e) { e.printStackTrace(); } @@ -183,15 +182,9 @@ public static final SignificanceTestSetting FisherRightTail() public static final SignificanceTestSetting FisherLeftTail() { - try - { - return new SignificanceTestSetting ( - FISHER_1925_P_TEST_THRESHOLD, - LEFT_TAIL_CHECK - ); - } - catch (java.lang.Exception e) - { + try { + return new SignificanceTestSetting (FISHER_1925_P_TEST_THRESHOLD, LEFT_TAIL_CHECK); + } catch (Exception e) { e.printStackTrace(); } @@ -206,15 +199,9 @@ public static final SignificanceTestSetting FisherLeftTail() public static final SignificanceTestSetting FisherDoubleTail() { - try - { - return new SignificanceTestSetting ( - 2. * FISHER_1925_P_TEST_THRESHOLD, - DOUBLE_TAIL_CHECK - ); - } - catch (java.lang.Exception e) - { + try { + return new SignificanceTestSetting (2. * FISHER_1925_P_TEST_THRESHOLD, DOUBLE_TAIL_CHECK); + } catch (Exception e) { e.printStackTrace(); } @@ -227,17 +214,16 @@ public static final SignificanceTestSetting FisherDoubleTail() * @param threshold The Test Threshold * @param tailCheck Test Tail Check Flag * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public SignificanceTestSetting ( final double threshold, final int tailCheck) - throws java.lang.Exception + throws Exception { - if (!org.drip.numerical.common.NumberUtil.IsValid (_threshold = threshold)) - { - throw new java.lang.Exception ("SignificanceTestSetting Constructor => Invalid Inputs"); + if (!NumberUtil.IsValid (_threshold = threshold)) { + throw new Exception ("SignificanceTestSetting Constructor => Invalid Inputs"); } _tailCheck = tailCheck; diff --git a/src/main/java/org/drip/validation/hypothesis/TTestOutcome.java b/src/main/java/org/drip/validation/hypothesis/TTestOutcome.java index f8b9361d7675..a2a01849df4d 100644 --- a/src/main/java/org/drip/validation/hypothesis/TTestOutcome.java +++ b/src/main/java/org/drip/validation/hypothesis/TTestOutcome.java @@ -1,11 +1,16 @@ package org.drip.validation.hypothesis; +import org.drip.numerical.common.NumberUtil; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -115,16 +120,16 @@ public class TTestOutcome { - private double _ensembleMean = java.lang.Double.NaN; - private double _testStatistic = java.lang.Double.NaN; - private int _sampleCount = java.lang.Integer.MIN_VALUE; - private double _ensembleVariance = java.lang.Double.NaN; - private double _ensembleTStatistics = java.lang.Double.NaN; - private double _ensembleStandardError = java.lang.Double.NaN; - private double _ensembleStandardDeviation = java.lang.Double.NaN; - private double _ensembleStandardErrorOffset = java.lang.Double.NaN; - private int _ensembleDegreesOfFreedom = java.lang.Integer.MIN_VALUE; - private double _ensemblePredictiveConfidenceInterval = java.lang.Double.NaN; + private double _ensembleMean = Double.NaN; + private double _testStatistic = Double.NaN; + private int _sampleCount = Integer.MIN_VALUE; + private double _ensembleVariance = Double.NaN; + private double _ensembleTStatistics = Double.NaN; + private double _ensembleStandardError = Double.NaN; + private double _ensembleStandardDeviation = Double.NaN; + private double _ensembleStandardErrorOffset = Double.NaN; + private int _ensembleDegreesOfFreedom = Integer.MIN_VALUE; + private double _ensemblePredictiveConfidenceInterval = Double.NaN; /** * TTestOutcome Constructor @@ -140,7 +145,7 @@ public class TTestOutcome * @param ensembleTStatistics Ensemble t-Statistics * @param ensembleStandardErrorOffset Ensemble Standard Error Offset * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public TTestOutcome ( @@ -156,21 +161,17 @@ public TTestOutcome ( final double ensembleStandardErrorOffset) throws java.lang.Exception { - if (!org.drip.numerical.common.NumberUtil.IsValid (_testStatistic = testStatistic) || - 0 >= (_sampleCount = sampleCount) || - !org.drip.numerical.common.NumberUtil.IsValid (_ensembleMean = ensembleMean) || - !org.drip.numerical.common.NumberUtil.IsValid (_ensembleVariance = ensembleVariance) || - !org.drip.numerical.common.NumberUtil.IsValid (_ensembleStandardDeviation = - ensembleStandardDeviation) || - !org.drip.numerical.common.NumberUtil.IsValid (_ensembleStandardError = ensembleStandardError) || - 0 > (_ensembleDegreesOfFreedom = ensembleDegreesOfFreedom) || - !org.drip.numerical.common.NumberUtil.IsValid (_ensemblePredictiveConfidenceInterval = + if (!NumberUtil.IsValid (_testStatistic = testStatistic) || 0 >= (_sampleCount = sampleCount) || + !NumberUtil.IsValid (_ensembleMean = ensembleMean) || + !NumberUtil.IsValid (_ensembleVariance = ensembleVariance) || + !NumberUtil.IsValid (_ensembleStandardDeviation = ensembleStandardDeviation) || + !NumberUtil.IsValid (_ensembleStandardError = ensembleStandardError) || + 0 > (_ensembleDegreesOfFreedom = ensembleDegreesOfFreedom) || + !NumberUtil.IsValid (_ensemblePredictiveConfidenceInterval = ensemblePredictiveConfidenceInterval) || - !org.drip.numerical.common.NumberUtil.IsValid (_ensembleTStatistics = ensembleTStatistics) || - !org.drip.numerical.common.NumberUtil.IsValid (_ensembleStandardErrorOffset = - ensembleStandardErrorOffset)) - { - throw new java.lang.Exception ("TTestOutcome Constructor => Invalid Inputs"); + !NumberUtil.IsValid (_ensembleTStatistics = ensembleTStatistics) || + !NumberUtil.IsValid (_ensembleStandardErrorOffset = ensembleStandardErrorOffset)) { + throw new Exception ("TTestOutcome Constructor => Invalid Inputs"); } } diff --git a/src/main/java/org/drip/xva/topology/Adiabat.java b/src/main/java/org/drip/xva/topology/Adiabat.java index 1bab4f916952..fdd8bcd87ff8 100644 --- a/src/main/java/org/drip/xva/topology/Adiabat.java +++ b/src/main/java/org/drip/xva/topology/Adiabat.java @@ -1,11 +1,24 @@ package org.drip.xva.topology; +import java.util.Map; + +import org.drip.analytics.support.CaseInsensitiveHashMap; +import org.drip.state.identifier.CSALabel; +import org.drip.state.identifier.EntityFundingLabel; +import org.drip.state.identifier.EntityHazardLabel; +import org.drip.state.identifier.EntityRecoveryLabel; +import org.drip.state.identifier.OvernightLabel; +import org.drip.xva.proto.ObjectSpecification; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -117,9 +130,9 @@ * @author Lakshmi Krishnamurthy */ -public class Adiabat extends org.drip.xva.proto.ObjectSpecification +public class Adiabat extends ObjectSpecification { - private java.util.Map _fundingGroupMap = null; + private Map _fundingGroupMap = null; /** * Adiabat Constructor @@ -127,21 +140,17 @@ public class Adiabat extends org.drip.xva.proto.ObjectSpecification * @param id BookGraph ID * @param name BookGraph Name * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public Adiabat ( - final java.lang.String id, - final java.lang.String name) - throws java.lang.Exception + final String id, + final String name) + throws Exception { - super ( - id, - name - ); + super (id, name); - _fundingGroupMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + _fundingGroupMap = new CaseInsensitiveHashMap(); } /** @@ -150,7 +159,7 @@ public Adiabat ( * @return The Funding Group Map */ - public java.util.Map fundingGroupMap() + public Map fundingGroupMap() { return _fundingGroupMap; } @@ -164,17 +173,13 @@ public java.util.Map fundi */ public boolean addFundingGroup ( - final org.drip.xva.topology.FundingGroup fundingGroup) + final FundingGroup fundingGroup) { - if (null == fundingGroup) - { + if (null == fundingGroup) { return false; } - _fundingGroupMap.put ( - fundingGroup.id(), - fundingGroup - ); + _fundingGroupMap.put (fundingGroup.id(), fundingGroup); return true; } @@ -188,10 +193,9 @@ public boolean addFundingGroup ( */ public boolean containsFundingGroup ( - final java.lang.String fundingGroupID) + final String fundingGroupID) { - return null == fundingGroupID || fundingGroupID.isEmpty() ? false : _fundingGroupMap.containsKey - (fundingGroupID); + return null != fundingGroupID && _fundingGroupMap.containsKey (fundingGroupID); } /** @@ -202,8 +206,8 @@ public boolean containsFundingGroup ( * @return TRUE - The Funding Group */ - public org.drip.xva.topology.FundingGroup fundingGroup ( - final java.lang.String fundingGroupID) + public FundingGroup fundingGroup ( + final String fundingGroupID) { return containsFundingGroup (fundingGroupID) ? _fundingGroupMap.get (fundingGroupID) : null; } @@ -214,37 +218,26 @@ public org.drip.xva.topology.FundingGroup fundingGroup ( * @return The Overnight Label Map */ - public java.util.Map overnightLabelMap() + public Map overnightLabelMap() { - java.util.Map overnightLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map overnightLabelMap = new CaseInsensitiveHashMap(); - for (java.util.Map.Entry fundingGroupEntry : - _fundingGroupMap.entrySet()) - { - java.util.Map creditDebtGroupMap = + for (Map.Entry fundingGroupEntry : _fundingGroupMap.entrySet()) { + Map creditDebtGroupMap = fundingGroupEntry.getValue().creditDebtGroupMap(); - for (java.util.Map.Entry - creditDebtGroupEntry : creditDebtGroupMap.entrySet()) - { - java.util.Map collateralGroupMap = + for (Map.Entry creditDebtGroupEntry : creditDebtGroupMap.entrySet()) { + Map collateralGroupMap = creditDebtGroupEntry.getValue().collateralGroupMap(); - for (java.util.Map.Entry - collateralGroupMapEntry : collateralGroupMap.entrySet()) - { - org.drip.state.identifier.OvernightLabel overnightLabel = - collateralGroupMapEntry.getValue().overnightLabel(); + for (Map.Entry collateralGroupMapEntry : + collateralGroupMap.entrySet()) { + OvernightLabel overnightLabel = collateralGroupMapEntry.getValue().overnightLabel(); - java.lang.String overnightLabelFQN = overnightLabel.fullyQualifiedName(); + String overnightLabelFQN = overnightLabel.fullyQualifiedName(); - if (!overnightLabelMap.containsKey (overnightLabelFQN)) - { - overnightLabelMap.put ( - overnightLabelFQN, - overnightLabel - ); + if (!overnightLabelMap.containsKey (overnightLabelFQN)) { + overnightLabelMap.put (overnightLabelFQN, overnightLabel); } } } @@ -259,37 +252,26 @@ public java.util.Map * @return The CSA Label Map */ - public java.util.Map csaLabelMap() + public Map csaLabelMap() { - java.util.Map csaLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map csaLabelMap = new CaseInsensitiveHashMap(); - for (java.util.Map.Entry fundingGroupEntry : - _fundingGroupMap.entrySet()) - { - java.util.Map creditDebtGroupMap = + for (Map.Entry fundingGroupEntry : _fundingGroupMap.entrySet()) { + Map creditDebtGroupMap = fundingGroupEntry.getValue().creditDebtGroupMap(); - for (java.util.Map.Entry - creditDebtGroupEntry : creditDebtGroupMap.entrySet()) - { - java.util.Map collateralGroupMap = + for (Map.Entry creditDebtGroupEntry : creditDebtGroupMap.entrySet()) { + Map collateralGroupMap = creditDebtGroupEntry.getValue().collateralGroupMap(); - for (java.util.Map.Entry - collateralGroupMapEntry : collateralGroupMap.entrySet()) - { - org.drip.state.identifier.CSALabel csaLabel = - collateralGroupMapEntry.getValue().csaLabel(); + for (Map.Entry collateralGroupMapEntry : + collateralGroupMap.entrySet()) { + CSALabel csaLabel = collateralGroupMapEntry.getValue().csaLabel(); - java.lang.String csaLabelFQN = csaLabel.fullyQualifiedName(); + String csaLabelFQN = csaLabel.fullyQualifiedName(); - if (!csaLabelMap.containsKey (csaLabelFQN)) - { - csaLabelMap.put ( - csaLabelFQN, - csaLabel - ); + if (!csaLabelMap.containsKey (csaLabelFQN)) { + csaLabelMap.put (csaLabelFQN, csaLabel); } } } @@ -304,33 +286,23 @@ public java.util.Map csaLa * @return The Dealer Hazard Label Map */ - public java.util.Map - dealerHazardLabelMap() + public Map dealerHazardLabelMap() { - java.util.Map dealerHazardLabelMap = - new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.util.Map.Entry fundingGroupEntry : - _fundingGroupMap.entrySet()) - { - java.util.Map creditDebtGroupMap = + Map dealerHazardLabelMap = + new CaseInsensitiveHashMap(); + + for (Map.Entry fundingGroupEntry : _fundingGroupMap.entrySet()) { + Map creditDebtGroupMap = fundingGroupEntry.getValue().creditDebtGroupMap(); - for (java.util.Map.Entry - creditDebtGroupMapEntry : creditDebtGroupMap.entrySet()) + for (Map.Entry creditDebtGroupMapEntry : creditDebtGroupMap.entrySet()) { - org.drip.state.identifier.EntityHazardLabel dealerHazardLabel = - creditDebtGroupMapEntry.getValue().dealerHazardLabel(); + EntityHazardLabel dealerHazardLabel = creditDebtGroupMapEntry.getValue().dealerHazardLabel(); - java.lang.String dealerHazardLabelFQN = dealerHazardLabel.fullyQualifiedName(); + String dealerHazardLabelFQN = dealerHazardLabel.fullyQualifiedName(); - if (!dealerHazardLabelMap.containsKey (dealerHazardLabelFQN)) - { - dealerHazardLabelMap.put ( - dealerHazardLabelFQN, - dealerHazardLabel - ); + if (!dealerHazardLabelMap.containsKey (dealerHazardLabelFQN)) { + dealerHazardLabelMap.put (dealerHazardLabelFQN, dealerHazardLabel); } } } @@ -344,33 +316,24 @@ public java.util.Map csaLa * @return The Client Hazard Label Map */ - public java.util.Map - clientHazardLabelMap() + public Map clientHazardLabelMap() { - java.util.Map clientHazardLabelMap = - new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.util.Map.Entry fundingGroupEntry : - _fundingGroupMap.entrySet()) - { - java.util.Map creditDebtGroupMap = + Map clientHazardLabelMap = + new CaseInsensitiveHashMap(); + + for (Map.Entry fundingGroupEntry : _fundingGroupMap.entrySet()) { + Map creditDebtGroupMap = fundingGroupEntry.getValue().creditDebtGroupMap(); - for (java.util.Map.Entry - creditDebtGroupMapEntry : creditDebtGroupMap.entrySet()) + for (Map.Entry creditDebtGroupMapEntry : creditDebtGroupMap.entrySet()) { - org.drip.state.identifier.EntityHazardLabel clientHazardLabel = + EntityHazardLabel clientHazardLabel = creditDebtGroupMapEntry.getValue().clientPartyHazardLabel(); - java.lang.String clientHazardLabelFQN = clientHazardLabel.fullyQualifiedName(); + String clientHazardLabelFQN = clientHazardLabel.fullyQualifiedName(); - if (!clientHazardLabelMap.containsKey (clientHazardLabelFQN)) - { - clientHazardLabelMap.put ( - clientHazardLabelFQN, - clientHazardLabel - ); + if (!clientHazardLabelMap.containsKey (clientHazardLabelFQN)) { + clientHazardLabelMap.put (clientHazardLabelFQN, clientHazardLabel); } } } @@ -384,30 +347,23 @@ public java.util.Map csaLa * @return The Dealer Senior Recovery Label Map */ - public java.util.Map - dealerSeniorRecoveryLabelMap() + public Map dealerSeniorRecoveryLabelMap() { - java.util.Map - dealerSeniorRecoveryLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.util.Map.Entry fundingGroupEntry : - _fundingGroupMap.entrySet()) - { - java.util.Map creditDebtGroupMap = + Map dealerSeniorRecoveryLabelMap = + new CaseInsensitiveHashMap(); + + for (Map.Entry fundingGroupEntry : _fundingGroupMap.entrySet()) { + Map creditDebtGroupMap = fundingGroupEntry.getValue().creditDebtGroupMap(); - for (java.util.Map.Entry - creditDebtGroupMapEntry : creditDebtGroupMap.entrySet()) + for (Map.Entry creditDebtGroupMapEntry : creditDebtGroupMap.entrySet()) { - org.drip.state.identifier.EntityRecoveryLabel dealerSeniorRecoveryLabel = + EntityRecoveryLabel dealerSeniorRecoveryLabel = creditDebtGroupMapEntry.getValue().dealerSeniorRecoveryLabel(); - java.lang.String dealerSeniorRecoveryLabelFQN = - dealerSeniorRecoveryLabel.fullyQualifiedName(); + String dealerSeniorRecoveryLabelFQN = dealerSeniorRecoveryLabel.fullyQualifiedName(); - if (!dealerSeniorRecoveryLabelMap.containsKey (dealerSeniorRecoveryLabelFQN)) - { + if (!dealerSeniorRecoveryLabelMap.containsKey (dealerSeniorRecoveryLabelFQN)) { dealerSeniorRecoveryLabelMap.put ( dealerSeniorRecoveryLabelFQN, dealerSeniorRecoveryLabel @@ -425,33 +381,24 @@ public java.util.Map csaLa * @return The Client Recovery Label Map */ - public java.util.Map - clientRecoveryLabelMap() + public Map clientRecoveryLabelMap() { - java.util.Map clientRecoveryLabelMap - = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.util.Map.Entry fundingGroupEntry : - _fundingGroupMap.entrySet()) - { - java.util.Map creditDebtGroupMap = + Map clientRecoveryLabelMap = + new CaseInsensitiveHashMap(); + + for (Map.Entry fundingGroupEntry : _fundingGroupMap.entrySet()) { + Map creditDebtGroupMap = fundingGroupEntry.getValue().creditDebtGroupMap(); - for (java.util.Map.Entry - creditDebtGroupMapEntry : creditDebtGroupMap.entrySet()) + for (Map.Entry creditDebtGroupMapEntry : creditDebtGroupMap.entrySet()) { - org.drip.state.identifier.EntityRecoveryLabel clientRecoveryLabel = + EntityRecoveryLabel clientRecoveryLabel = creditDebtGroupMapEntry.getValue().clientRecoveryLabel(); - java.lang.String clientRecoveryLabelFQN = clientRecoveryLabel.fullyQualifiedName(); + String clientRecoveryLabelFQN = clientRecoveryLabel.fullyQualifiedName(); - if (!clientRecoveryLabelMap.containsKey (clientRecoveryLabelFQN)) - { - clientRecoveryLabelMap.put ( - clientRecoveryLabelFQN, - clientRecoveryLabel - ); + if (!clientRecoveryLabelMap.containsKey (clientRecoveryLabelFQN)) { + clientRecoveryLabelMap.put (clientRecoveryLabelFQN, clientRecoveryLabel); } } } @@ -465,30 +412,24 @@ public java.util.Map csaLa * @return The Dealer Subordinate Recovery Label Map */ - public java.util.Map - dealerSubordinateRecoveryLabelMap() + public Map dealerSubordinateRecoveryLabelMap() { - java.util.Map - dealerSubordinateRecoveryLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.util.Map.Entry fundingGroupEntry : - _fundingGroupMap.entrySet()) - { - java.util.Map creditDebtGroupMap = + Map dealerSubordinateRecoveryLabelMap = + new CaseInsensitiveHashMap(); + + for (Map.Entry fundingGroupEntry : _fundingGroupMap.entrySet()) { + Map creditDebtGroupMap = fundingGroupEntry.getValue().creditDebtGroupMap(); - for (java.util.Map.Entry - creditDebtGroupMapEntry : creditDebtGroupMap.entrySet()) + for (Map.Entry creditDebtGroupMapEntry : creditDebtGroupMap.entrySet()) { - org.drip.state.identifier.EntityRecoveryLabel dealerSubordinateRecoveryLabel = + EntityRecoveryLabel dealerSubordinateRecoveryLabel = creditDebtGroupMapEntry.getValue().dealerSubordinateRecoveryLabel(); - java.lang.String dealerSubordinateRecoveryLabelFQN = + String dealerSubordinateRecoveryLabelFQN = dealerSubordinateRecoveryLabel.fullyQualifiedName(); - if (!dealerSubordinateRecoveryLabelMap.containsKey (dealerSubordinateRecoveryLabelFQN)) - { + if (!dealerSubordinateRecoveryLabelMap.containsKey (dealerSubordinateRecoveryLabelFQN)) { dealerSubordinateRecoveryLabelMap.put ( dealerSubordinateRecoveryLabelFQN, dealerSubordinateRecoveryLabel @@ -506,27 +447,19 @@ public java.util.Map csaLa * @return The Dealer Senior Funding Label Map */ - public java.util.Map - dealerSeniorFundingLabelMap() + public Map dealerSeniorFundingLabelMap() { - java.util.Map - dealerSeniorFundingLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.util.Map.Entry fundingGroupMapEntry : - _fundingGroupMap.entrySet()) - { - org.drip.state.identifier.EntityFundingLabel dealerSeniorFundingLabel = + Map dealerSeniorFundingLabelMap = + new CaseInsensitiveHashMap(); + + for (Map.Entry fundingGroupMapEntry : _fundingGroupMap.entrySet()) { + EntityFundingLabel dealerSeniorFundingLabel = fundingGroupMapEntry.getValue().dealerSeniorFundingLabel(); - java.lang.String dealerSeniorFundingLabelFQN = dealerSeniorFundingLabel.fullyQualifiedName(); + String dealerSeniorFundingLabelFQN = dealerSeniorFundingLabel.fullyQualifiedName(); - if (!dealerSeniorFundingLabelMap.containsKey (dealerSeniorFundingLabelFQN)) - { - dealerSeniorFundingLabelMap.put ( - dealerSeniorFundingLabelFQN, - dealerSeniorFundingLabel - ); + if (!dealerSeniorFundingLabelMap.containsKey (dealerSeniorFundingLabelFQN)) { + dealerSeniorFundingLabelMap.put (dealerSeniorFundingLabelFQN, dealerSeniorFundingLabel); } } @@ -539,27 +472,18 @@ public java.util.Map csaLa * @return The Client Funding Label Map */ - public java.util.Map - clientFundingLabelMap() + public Map clientFundingLabelMap() { - java.util.Map clientFundingLabelMap = - new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map clientFundingLabelMap = + new CaseInsensitiveHashMap(); - for (java.util.Map.Entry fundingGroupMapEntry : - _fundingGroupMap.entrySet()) - { - org.drip.state.identifier.EntityFundingLabel clientFundingLabel = - fundingGroupMapEntry.getValue().clientFundingLabel(); + for (Map.Entry fundingGroupMapEntry : _fundingGroupMap.entrySet()) { + EntityFundingLabel clientFundingLabel = fundingGroupMapEntry.getValue().clientFundingLabel(); - java.lang.String clientFundingLabelFQN = clientFundingLabel.fullyQualifiedName(); + String clientFundingLabelFQN = clientFundingLabel.fullyQualifiedName(); - if (!clientFundingLabelMap.containsKey (clientFundingLabelFQN)) - { - clientFundingLabelMap.put ( - clientFundingLabelFQN, - clientFundingLabel - ); + if (!clientFundingLabelMap.containsKey (clientFundingLabelFQN)) { + clientFundingLabelMap.put (clientFundingLabelFQN, clientFundingLabel); } } @@ -572,26 +496,19 @@ public java.util.Map csaLa * @return The Dealer Subordinate Funding Label Map */ - public java.util.Map - dealerSubordinateFundingLabelMap() + public Map dealerSubordinateFundingLabelMap() { - java.util.Map - dealerSubordinateFundingLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.util.Map.Entry fundingGroupMapEntry : - _fundingGroupMap.entrySet()) - { - org.drip.state.identifier.EntityFundingLabel dealerSubordinateFundingLabel = + Map dealerSubordinateFundingLabelMap = + new CaseInsensitiveHashMap(); + + for (Map.Entry fundingGroupMapEntry : _fundingGroupMap.entrySet()) { + EntityFundingLabel dealerSubordinateFundingLabel = fundingGroupMapEntry.getValue().dealerSubordinateFundingLabel(); - if (null != dealerSubordinateFundingLabel) - { - java.lang.String dealerSubordinateFundingLabelFQN = - dealerSubordinateFundingLabel.fullyQualifiedName(); + if (null != dealerSubordinateFundingLabel) { + String dealerSubordinateFundingLabelFQN = dealerSubordinateFundingLabel.fullyQualifiedName(); - if (!dealerSubordinateFundingLabelMap.containsKey (dealerSubordinateFundingLabelFQN)) - { + if (!dealerSubordinateFundingLabelMap.containsKey (dealerSubordinateFundingLabelFQN)) { dealerSubordinateFundingLabelMap.put ( dealerSubordinateFundingLabelFQN, dealerSubordinateFundingLabel @@ -609,85 +526,61 @@ public java.util.Map csaLa * @return The Adiabat Dependent Market Parameters */ - public org.drip.xva.topology.AdiabatMarketParams marketParams() + public AdiabatMarketParams marketParams() { - java.util.Map csaLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map csaLabelMap = new CaseInsensitiveHashMap(); - java.util.Map overnightLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map overnightLabelMap = new CaseInsensitiveHashMap(); - java.util.Map dealerHazardLabelMap = - new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map clientHazardLabelMap = + new CaseInsensitiveHashMap(); - java.util.Map clientHazardLabelMap = - new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map dealerHazardLabelMap = + new CaseInsensitiveHashMap(); - java.util.Map - dealerSeniorRecoveryLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map clientRecoveryLabelMap = + new CaseInsensitiveHashMap(); - java.util.Map clientRecoveryLabelMap - = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map dealerSeniorRecoveryLabelMap = + new CaseInsensitiveHashMap(); - java.util.Map - dealerSubordinateRecoveryLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map dealerSubordinateRecoveryLabelMap = + new CaseInsensitiveHashMap(); - java.util.Map - dealerSeniorFundingLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map dealerSeniorFundingLabelMap = + new CaseInsensitiveHashMap(); - java.util.Map clientFundingLabelMap = - new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map clientFundingLabelMap = + new CaseInsensitiveHashMap(); - java.util.Map - dealerSubordinateFundingLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map dealerSubordinateFundingLabelMap = + new CaseInsensitiveHashMap(); - for (java.util.Map.Entry fundingGroupEntry : - _fundingGroupMap.entrySet()) - { - org.drip.state.identifier.EntityFundingLabel dealerSeniorFundingLabel = + for (Map.Entry fundingGroupEntry : _fundingGroupMap.entrySet()) { + EntityFundingLabel dealerSeniorFundingLabel = fundingGroupEntry.getValue().dealerSeniorFundingLabel(); - java.lang.String dealerSeniorFundingLabelFQN = dealerSeniorFundingLabel.fullyQualifiedName(); + String dealerSeniorFundingLabelFQN = dealerSeniorFundingLabel.fullyQualifiedName(); - if (!dealerSeniorFundingLabelMap.containsKey (dealerSeniorFundingLabelFQN)) - { - dealerSeniorFundingLabelMap.put ( - dealerSeniorFundingLabelFQN, - dealerSeniorFundingLabel - ); + if (!dealerSeniorFundingLabelMap.containsKey (dealerSeniorFundingLabelFQN)) { + dealerSeniorFundingLabelMap.put (dealerSeniorFundingLabelFQN, dealerSeniorFundingLabel); } - org.drip.state.identifier.EntityFundingLabel clientFundingLabel = - fundingGroupEntry.getValue().clientFundingLabel(); + EntityFundingLabel clientFundingLabel = fundingGroupEntry.getValue().clientFundingLabel(); - java.lang.String clientFundingLabelFQN = clientFundingLabel.fullyQualifiedName(); + String clientFundingLabelFQN = clientFundingLabel.fullyQualifiedName(); - if (!clientFundingLabelMap.containsKey (clientFundingLabelFQN)) - { - clientFundingLabelMap.put ( - clientFundingLabelFQN, - clientFundingLabel - ); + if (!clientFundingLabelMap.containsKey (clientFundingLabelFQN)) { + clientFundingLabelMap.put (clientFundingLabelFQN, clientFundingLabel); } - org.drip.state.identifier.EntityFundingLabel dealerSubordinateFundingLabel = + EntityFundingLabel dealerSubordinateFundingLabel = fundingGroupEntry.getValue().dealerSubordinateFundingLabel(); - if (null != dealerSubordinateFundingLabel) - { - java.lang.String dealerSubordinateFundingLabelFQN = - dealerSubordinateFundingLabel.fullyQualifiedName(); + if (null != dealerSubordinateFundingLabel) { + String dealerSubordinateFundingLabelFQN = dealerSubordinateFundingLabel.fullyQualifiedName(); - if (!dealerSubordinateFundingLabelMap.containsKey (dealerSubordinateFundingLabelFQN)) - { + if (!dealerSubordinateFundingLabelMap.containsKey (dealerSubordinateFundingLabelFQN)) { dealerSubordinateFundingLabelMap.put ( dealerSubordinateFundingLabelFQN, dealerSubordinateFundingLabel @@ -695,78 +588,60 @@ public org.drip.xva.topology.AdiabatMarketParams marketParams() } } - java.util.Map creditDebtGroupMap = + Map creditDebtGroupMap = fundingGroupEntry.getValue().creditDebtGroupMap(); - for (java.util.Map.Entry - creditDebtGroupEntry : creditDebtGroupMap.entrySet()) - { - java.util.Map collateralGroupMap = + for (Map.Entry creditDebtGroupEntry : creditDebtGroupMap.entrySet()) { + Map collateralGroupMap = creditDebtGroupEntry.getValue().collateralGroupMap(); - org.drip.state.identifier.EntityHazardLabel dealerHazardLabel = - creditDebtGroupEntry.getValue().dealerHazardLabel(); + EntityHazardLabel dealerHazardLabel = creditDebtGroupEntry.getValue().dealerHazardLabel(); - java.lang.String dealerHazardLabelFQN = dealerHazardLabel.fullyQualifiedName(); + String dealerHazardLabelFQN = dealerHazardLabel.fullyQualifiedName(); - if (!dealerHazardLabelMap.containsKey (dealerHazardLabelFQN)) - { - dealerHazardLabelMap.put ( - dealerHazardLabelFQN, - dealerHazardLabel - ); + if (!dealerHazardLabelMap.containsKey (dealerHazardLabelFQN)) { + dealerHazardLabelMap.put (dealerHazardLabelFQN, dealerHazardLabel); } - org.drip.state.identifier.EntityHazardLabel clientHazardLabel = + EntityHazardLabel clientHazardLabel = creditDebtGroupEntry.getValue().clientPartyHazardLabel(); - java.lang.String clientHazardLabelFQN = clientHazardLabel.fullyQualifiedName(); + String clientHazardLabelFQN = clientHazardLabel.fullyQualifiedName(); - if (!clientHazardLabelMap.containsKey (clientHazardLabelFQN)) - { - clientHazardLabelMap.put ( - clientHazardLabelFQN, - clientHazardLabel - ); + if (!clientHazardLabelMap.containsKey (clientHazardLabelFQN)) { + clientHazardLabelMap.put (clientHazardLabelFQN, clientHazardLabel); } - org.drip.state.identifier.EntityRecoveryLabel dealerSeniorRecoveryLabel = + EntityRecoveryLabel dealerSeniorRecoveryLabel = creditDebtGroupEntry.getValue().dealerSeniorRecoveryLabel(); - java.lang.String dealerSeniorRecoveryLabelFQN = + String dealerSeniorRecoveryLabelFQN = dealerSeniorRecoveryLabel.fullyQualifiedName(); - if (!dealerSeniorRecoveryLabelMap.containsKey (dealerSeniorRecoveryLabelFQN)) - { + if (!dealerSeniorRecoveryLabelMap.containsKey (dealerSeniorRecoveryLabelFQN)) { dealerSeniorRecoveryLabelMap.put ( dealerSeniorRecoveryLabelFQN, dealerSeniorRecoveryLabel ); } - org.drip.state.identifier.EntityRecoveryLabel clientRecoveryLabel = + EntityRecoveryLabel clientRecoveryLabel = creditDebtGroupEntry.getValue().clientRecoveryLabel(); - java.lang.String clientRecoveryLabelFQN = clientRecoveryLabel.fullyQualifiedName(); + String clientRecoveryLabelFQN = clientRecoveryLabel.fullyQualifiedName(); - if (!clientRecoveryLabelMap.containsKey (clientRecoveryLabelFQN)) - { - clientRecoveryLabelMap.put ( - clientRecoveryLabelFQN, - clientRecoveryLabel - ); + if (!clientRecoveryLabelMap.containsKey (clientRecoveryLabelFQN)) { + clientRecoveryLabelMap.put (clientRecoveryLabelFQN, clientRecoveryLabel); } - org.drip.state.identifier.EntityRecoveryLabel dealerSubordinateRecoveryLabel = + EntityRecoveryLabel dealerSubordinateRecoveryLabel = creditDebtGroupEntry.getValue().dealerSubordinateRecoveryLabel(); - if (null != dealerSubordinateRecoveryLabel) - { - java.lang.String dealerSubordinateRecoveryLabelFQN = + if (null != dealerSubordinateRecoveryLabel) { + String dealerSubordinateRecoveryLabelFQN = dealerSubordinateRecoveryLabel.fullyQualifiedName(); - if (!dealerSubordinateRecoveryLabelMap.containsKey (dealerSubordinateRecoveryLabelFQN)) - { + if (!dealerSubordinateRecoveryLabelMap.containsKey (dealerSubordinateRecoveryLabelFQN)) { dealerSubordinateRecoveryLabelMap.put ( dealerSubordinateRecoveryLabelFQN, dealerSubordinateRecoveryLabel @@ -774,39 +649,29 @@ public org.drip.xva.topology.AdiabatMarketParams marketParams() } } - for (java.util.Map.Entry - collateralGroupMapEntry : collateralGroupMap.entrySet()) - { - org.drip.state.identifier.OvernightLabel overnightLabel = - collateralGroupMapEntry.getValue().overnightLabel(); + for (Map.Entry collateralGroupMapEntry : + collateralGroupMap.entrySet()) { + OvernightLabel overnightLabel = collateralGroupMapEntry.getValue().overnightLabel(); - java.lang.String overnightLabelFQN = overnightLabel.fullyQualifiedName(); + String overnightLabelFQN = overnightLabel.fullyQualifiedName(); - if (!overnightLabelMap.containsKey (overnightLabelFQN)) - { - overnightLabelMap.put ( - overnightLabelFQN, - overnightLabel - ); + if (!overnightLabelMap.containsKey (overnightLabelFQN)) { + overnightLabelMap.put (overnightLabelFQN, overnightLabel); } - org.drip.state.identifier.CSALabel csaLabel = - collateralGroupMapEntry.getValue().csaLabel(); - java.lang.String csaLabelFQN = csaLabel.fullyQualifiedName(); + CSALabel csaLabel = collateralGroupMapEntry.getValue().csaLabel(); - if (!csaLabelMap.containsKey (csaLabelFQN)) - { - csaLabelMap.put ( - csaLabelFQN, - csaLabel - ); + String csaLabelFQN = csaLabel.fullyQualifiedName(); + + if (!csaLabelMap.containsKey (csaLabelFQN)) { + csaLabelMap.put (csaLabelFQN, csaLabel); } } } } try { - return new org.drip.xva.topology.AdiabatMarketParams ( + return new AdiabatMarketParams ( overnightLabelMap, csaLabelMap, dealerHazardLabelMap, @@ -818,9 +683,7 @@ public org.drip.xva.topology.AdiabatMarketParams marketParams() clientFundingLabelMap, dealerSubordinateFundingLabelMap ); - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/org/drip/xva/topology/AdiabatMarketParams.java b/src/main/java/org/drip/xva/topology/AdiabatMarketParams.java index e1d679adf024..b412022b17c5 100644 --- a/src/main/java/org/drip/xva/topology/AdiabatMarketParams.java +++ b/src/main/java/org/drip/xva/topology/AdiabatMarketParams.java @@ -1,11 +1,22 @@ package org.drip.xva.topology; +import java.util.Map; + +import org.drip.state.identifier.CSALabel; +import org.drip.state.identifier.EntityFundingLabel; +import org.drip.state.identifier.EntityHazardLabel; +import org.drip.state.identifier.EntityRecoveryLabel; +import org.drip.state.identifier.OvernightLabel; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -119,25 +130,16 @@ public class AdiabatMarketParams { - private java.util.Map _csaLabelMap = null; - private java.util.Map _overnightLabelMap = - null; - private java.util.Map - _clientHazardLabelMap = null; - private java.util.Map - _dealerHazardLabelMap = null; - private java.util.Map - _clientRecoveryLabelMap = null; - private java.util.Map - _dealerSeniorRecoveryLabelMap = null; - private java.util.Map - _clientFundingLabelMap = null; - private java.util.Map - _dealerSubordinateRecoveryLabelMap = null; - private java.util.Map - _dealerSeniorFundingLabelMap = null; - private java.util.Map - _dealerSubordinateFundingLabelMap = null; + private Map _csaLabelMap = null; + private Map _overnightLabelMap = null; + private Map _clientHazardLabelMap = null; + private Map _dealerHazardLabelMap = null; + private Map _clientFundingLabelMap = null; + private Map _clientRecoveryLabelMap = null; + private Map _dealerSeniorFundingLabelMap = null; + private Map _dealerSeniorRecoveryLabelMap = null; + private Map _dealerSubordinateFundingLabelMap = null; + private Map _dealerSubordinateRecoveryLabelMap = null; /** * AdiabatMarketParams Constructor @@ -153,43 +155,34 @@ public class AdiabatMarketParams * @param clientFundingLabelMap Map of Client Funding Labels * @param dealerSubordinateFundingLabelMap Map of Dealer Subordinate Funding Labels * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public AdiabatMarketParams ( - final java.util.Map overnightLabelMap, - final java.util.Map csaLabelMap, - final java.util.Map - dealerHazardLabelMap, - final java.util.Map - clientHazardLabelMap, - final java.util.Map - dealerSeniorRecoveryLabelMap, - final java.util.Map - clientRecoveryLabelMap, - final java.util.Map - dealerSubordinateRecoveryLabelMap, - final java.util.Map - dealerSeniorFundingLabelMap, - final java.util.Map - clientFundingLabelMap, - final java.util.Map - dealerSubordinateFundingLabelMap) - throws java.lang.Exception + final Map overnightLabelMap, + final Map csaLabelMap, + final Map dealerHazardLabelMap, + final Map clientHazardLabelMap, + final Map dealerSeniorRecoveryLabelMap, + final Map clientRecoveryLabelMap, + final Map dealerSubordinateRecoveryLabelMap, + final Map dealerSeniorFundingLabelMap, + final Map clientFundingLabelMap, + final Map dealerSubordinateFundingLabelMap) + throws Exception { if (null == (_overnightLabelMap = overnightLabelMap) || 0 == _overnightLabelMap.size() || null == (_csaLabelMap = csaLabelMap) || 0 == _csaLabelMap.size() || null == (_dealerHazardLabelMap = dealerHazardLabelMap) || 0 == _dealerHazardLabelMap.size() || null == (_clientHazardLabelMap = clientHazardLabelMap) || 0 == _clientHazardLabelMap.size() || - null == (_dealerSeniorRecoveryLabelMap = dealerSeniorRecoveryLabelMap) || 0 == - _dealerSeniorRecoveryLabelMap.size() || - null == (_clientRecoveryLabelMap = clientRecoveryLabelMap) || 0 == _clientRecoveryLabelMap.size() - || - null == (_dealerSeniorFundingLabelMap = dealerSeniorFundingLabelMap) || 0 == - _dealerSeniorFundingLabelMap.size() || - null == (_clientFundingLabelMap = clientFundingLabelMap) || 0 == _clientFundingLabelMap.size()) - { - throw new java.lang.Exception ("AdiabatMarketParams Constructor => Invalid Inputs"); + null == (_dealerSeniorRecoveryLabelMap = dealerSeniorRecoveryLabelMap) || + 0 == _dealerSeniorRecoveryLabelMap.size() || + null == (_clientRecoveryLabelMap = clientRecoveryLabelMap) || + 0 == _clientRecoveryLabelMap.size() || + null == (_dealerSeniorFundingLabelMap = dealerSeniorFundingLabelMap) || + 0 == _dealerSeniorFundingLabelMap.size() || + null == (_clientFundingLabelMap = clientFundingLabelMap) || 0 == _clientFundingLabelMap.size()) { + throw new Exception ("AdiabatMarketParams Constructor => Invalid Inputs"); } _dealerSubordinateFundingLabelMap = dealerSubordinateFundingLabelMap; @@ -202,7 +195,7 @@ public AdiabatMarketParams ( * @return The Map of Overnight Labels */ - public java.util.Map overnightLabelMap() + public Map overnightLabelMap() { return _overnightLabelMap; } @@ -213,7 +206,7 @@ public java.util.Map * @return The Map of CSA Labels */ - public java.util.Map csaLabelMap() + public Map csaLabelMap() { return _csaLabelMap; } @@ -224,8 +217,7 @@ public java.util.Map csaLa * @return The Map of Dealer Hazard Labels */ - public java.util.Map - dealerHazardLabelMap() + public Map dealerHazardLabelMap() { return _dealerHazardLabelMap; } @@ -236,8 +228,7 @@ public java.util.Map csaLa * @return The Map of Client Hazard Labels */ - public java.util.Map - clientHazardLabelMap() + public Map clientHazardLabelMap() { return _clientHazardLabelMap; } @@ -248,8 +239,7 @@ public java.util.Map csaLa * @return The Map of Dealer Senior Recovery Labels */ - public java.util.Map - dealerSeniorRecoveryLabelMap() + public Map dealerSeniorRecoveryLabelMap() { return _dealerSeniorRecoveryLabelMap; } @@ -260,8 +250,7 @@ public java.util.Map csaLa * @return The Map of Client Recovery Labels */ - public java.util.Map - clientRecoveryLabelMap() + public Map clientRecoveryLabelMap() { return _clientRecoveryLabelMap; } @@ -272,8 +261,7 @@ public java.util.Map csaLa * @return The Map of Dealer Subordinate Recovery Labels */ - public java.util.Map - dealerSubordinateRecoveryLabelMap() + public Map dealerSubordinateRecoveryLabelMap() { return _dealerSubordinateRecoveryLabelMap; } @@ -284,8 +272,7 @@ public java.util.Map csaLa * @return The Map of Dealer Senior Funding Labels */ - public java.util.Map - dealerSeniorFundingLabelMap() + public Map dealerSeniorFundingLabelMap() { return _dealerSeniorFundingLabelMap; } @@ -296,8 +283,7 @@ public java.util.Map csaLa * @return The Map of Client Funding Labels */ - public java.util.Map - clientFundingLabelMap() + public Map clientFundingLabelMap() { return _clientFundingLabelMap; } @@ -308,8 +294,7 @@ public java.util.Map csaLa * @return The Map of Dealer Subordinate Funding Labels */ - public java.util.Map - dealerSubordinateFundingLabelMap() + public Map dealerSubordinateFundingLabelMap() { return _dealerSubordinateFundingLabelMap; } diff --git a/src/main/java/org/drip/xva/topology/CollateralGroup.java b/src/main/java/org/drip/xva/topology/CollateralGroup.java index dfff0fc68c3b..c61a3fc9549f 100644 --- a/src/main/java/org/drip/xva/topology/CollateralGroup.java +++ b/src/main/java/org/drip/xva/topology/CollateralGroup.java @@ -1,11 +1,22 @@ package org.drip.xva.topology; +import java.util.Map; + +import org.drip.analytics.support.CaseInsensitiveHashMap; +import org.drip.state.identifier.CSALabel; +import org.drip.state.identifier.OvernightLabel; +import org.drip.xva.proto.CollateralGroupSpecification; +import org.drip.xva.proto.ObjectSpecification; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -117,10 +128,10 @@ * @author Lakshmi Krishnamurthy */ -public class CollateralGroup extends org.drip.xva.proto.ObjectSpecification +public class CollateralGroup extends ObjectSpecification { - private org.drip.xva.proto.CollateralGroupSpecification _collateralGroupSpecification = null; - private java.util.Map _positionGroupMap = null; + private Map _positionGroupMap = null; + private CollateralGroupSpecification _collateralGroupSpecification = null; /** * CollateralGroup Constructor @@ -129,27 +140,22 @@ public class CollateralGroup extends org.drip.xva.proto.ObjectSpecification * @param name The Collateral Group Name * @param collateralGroupSpecification The Collateral Group Specification * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public CollateralGroup ( - final java.lang.String id, - final java.lang.String name, - final org.drip.xva.proto.CollateralGroupSpecification collateralGroupSpecification) - throws java.lang.Exception + final String id, + final String name, + final CollateralGroupSpecification collateralGroupSpecification) + throws Exception { - super ( - id, - name - ); - - if (null == (_collateralGroupSpecification = collateralGroupSpecification)) - { - throw new java.lang.Exception ("CollateralGroup Contructor => Invalid Inputs"); + super (id, name); + + if (null == (_collateralGroupSpecification = collateralGroupSpecification)) { + throw new Exception ("CollateralGroup Contructor => Invalid Inputs"); } - _positionGroupMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + _positionGroupMap = new CaseInsensitiveHashMap(); } /** @@ -158,7 +164,7 @@ public CollateralGroup ( * @return The Collateral Group Specification */ - public org.drip.xva.proto.CollateralGroupSpecification collateralGroupSpecification() + public CollateralGroupSpecification collateralGroupSpecification() { return _collateralGroupSpecification; } @@ -169,7 +175,7 @@ public org.drip.xva.proto.CollateralGroupSpecification collateralGroupSpecificat * @return The Position Group Map */ - public java.util.Map positionGroupMap() + public Map positionGroupMap() { return _positionGroupMap; } @@ -183,17 +189,13 @@ public java.util.Map posi */ public boolean addPositionGroup ( - final org.drip.xva.topology.PositionGroup positionGroup) + final PositionGroup positionGroup) { - if (null == positionGroup) - { + if (null == positionGroup) { return false; } - _positionGroupMap.put ( - positionGroup.id(), - positionGroup - ); + _positionGroupMap.put (positionGroup.id(), positionGroup); return true; } @@ -207,10 +209,9 @@ public boolean addPositionGroup ( */ public boolean containsPositionGroup ( - final java.lang.String positionGroupID) + final String positionGroupID) { - return null == positionGroupID || positionGroupID.isEmpty() ? false : _positionGroupMap.containsKey - (positionGroupID); + return null != positionGroupID && _positionGroupMap.containsKey (positionGroupID); } /** @@ -221,8 +222,8 @@ public boolean containsPositionGroup ( * @return The Position Group */ - public org.drip.xva.topology.PositionGroup positionGroup ( - final java.lang.String positionGroupID) + public PositionGroup positionGroup ( + final String positionGroupID) { return containsPositionGroup (positionGroupID) ? _positionGroupMap.get (positionGroupID) : null; } @@ -233,7 +234,7 @@ public org.drip.xva.topology.PositionGroup positionGroup ( * @return The Overnight Label */ - public org.drip.state.identifier.OvernightLabel overnightLabel() + public OvernightLabel overnightLabel() { return _collateralGroupSpecification.overnightLabel(); } @@ -244,7 +245,7 @@ public org.drip.state.identifier.OvernightLabel overnightLabel() * @return The CSA Label */ - public org.drip.state.identifier.CSALabel csaLabel() + public CSALabel csaLabel() { return _collateralGroupSpecification.csaLabel(); } diff --git a/src/main/java/org/drip/xva/topology/CreditDebtGroup.java b/src/main/java/org/drip/xva/topology/CreditDebtGroup.java index 6742ce7c25a6..9ec67f8d744c 100644 --- a/src/main/java/org/drip/xva/topology/CreditDebtGroup.java +++ b/src/main/java/org/drip/xva/topology/CreditDebtGroup.java @@ -1,11 +1,24 @@ package org.drip.xva.topology; +import java.util.Map; + +import org.drip.analytics.support.CaseInsensitiveHashMap; +import org.drip.state.identifier.CSALabel; +import org.drip.state.identifier.EntityHazardLabel; +import org.drip.state.identifier.EntityRecoveryLabel; +import org.drip.state.identifier.OvernightLabel; +import org.drip.xva.proto.CreditDebtGroupSpecification; +import org.drip.xva.proto.ObjectSpecification; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -117,11 +130,10 @@ * @author Lakshmi Krishnamurthy */ -public class CreditDebtGroup extends org.drip.xva.proto.ObjectSpecification +public class CreditDebtGroup extends ObjectSpecification { - private org.drip.xva.proto.CreditDebtGroupSpecification _creditDebtGroupSpecification = null; - private java.util.Map _collateralGroupMap = - null; + private Map _collateralGroupMap = null; + private CreditDebtGroupSpecification _creditDebtGroupSpecification = null; /** * CreditDebtGroup Constructor @@ -130,27 +142,22 @@ public class CreditDebtGroup extends org.drip.xva.proto.ObjectSpecification * @param name CreditDebtGroup Name * @param creditDebtGroupSpecification The CreditDebtGroup Specification * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public CreditDebtGroup ( - final java.lang.String id, - final java.lang.String name, - final org.drip.xva.proto.CreditDebtGroupSpecification creditDebtGroupSpecification) - throws java.lang.Exception + final String id, + final String name, + final CreditDebtGroupSpecification creditDebtGroupSpecification) + throws Exception { - super ( - id, - name - ); - - if (null == (_creditDebtGroupSpecification = creditDebtGroupSpecification)) - { - throw new java.lang.Exception ("CreditDebtGroup Constructor => Invalid Inputs"); + super (id, name); + + if (null == (_creditDebtGroupSpecification = creditDebtGroupSpecification)) { + throw new Exception ("CreditDebtGroup Constructor => Invalid Inputs"); } - _collateralGroupMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + _collateralGroupMap = new CaseInsensitiveHashMap(); } /** @@ -159,7 +166,7 @@ public CreditDebtGroup ( * @return The Credit Debt Group Specification */ - public org.drip.xva.proto.CreditDebtGroupSpecification creditDebtGroupSpecification() + public CreditDebtGroupSpecification creditDebtGroupSpecification() { return _creditDebtGroupSpecification; } @@ -170,7 +177,7 @@ public org.drip.xva.proto.CreditDebtGroupSpecification creditDebtGroupSpecificat * @return The Collateral Group Map */ - public java.util.Map collateralGroupMap() + public Map collateralGroupMap() { return _collateralGroupMap; } @@ -184,17 +191,13 @@ public java.util.Map co */ public boolean addCollateralGroup ( - final org.drip.xva.topology.CollateralGroup collateralGroup) + final CollateralGroup collateralGroup) { - if (null == collateralGroup) - { + if (null == collateralGroup) { return false; } - _collateralGroupMap.put ( - collateralGroup.id(), - collateralGroup - ); + _collateralGroupMap.put (collateralGroup.id(), collateralGroup); return true; } @@ -208,10 +211,9 @@ public boolean addCollateralGroup ( */ public boolean containsCollateralGroup ( - final java.lang.String collateralGroupID) + final String collateralGroupID) { - return null == collateralGroupID || collateralGroupID.isEmpty() ? false : - _collateralGroupMap.containsKey (collateralGroupID); + return null != collateralGroupID && _collateralGroupMap.containsKey (collateralGroupID); } /** @@ -222,11 +224,11 @@ public boolean containsCollateralGroup ( * @return The Collateral Group */ - public org.drip.xva.topology.CollateralGroup collateralGroup ( - final java.lang.String collateralGroupID) + public CollateralGroup collateralGroup ( + final String collateralGroupID) { - return containsCollateralGroup (collateralGroupID) ? _collateralGroupMap.get (collateralGroupID) : - null; + return containsCollateralGroup (collateralGroupID) ? + _collateralGroupMap.get (collateralGroupID) : null; } /** @@ -235,7 +237,7 @@ public org.drip.xva.topology.CollateralGroup collateralGroup ( * @return The Dealer Hazard Label */ - public org.drip.state.identifier.EntityHazardLabel dealerHazardLabel() + public EntityHazardLabel dealerHazardLabel() { return _creditDebtGroupSpecification.dealerHazardLabel(); } @@ -246,7 +248,7 @@ public org.drip.state.identifier.EntityHazardLabel dealerHazardLabel() * @return The Client Hazard Label */ - public org.drip.state.identifier.EntityHazardLabel clientPartyHazardLabel() + public EntityHazardLabel clientPartyHazardLabel() { return _creditDebtGroupSpecification.clientHazardLabel(); } @@ -257,7 +259,7 @@ public org.drip.state.identifier.EntityHazardLabel clientPartyHazardLabel() * @return The Dealer Senior Recovery Label */ - public org.drip.state.identifier.EntityRecoveryLabel dealerSeniorRecoveryLabel() + public EntityRecoveryLabel dealerSeniorRecoveryLabel() { return _creditDebtGroupSpecification.dealerSeniorRecoveryLabel(); } @@ -268,7 +270,7 @@ public org.drip.state.identifier.EntityRecoveryLabel dealerSeniorRecoveryLabel() * @return The Dealer Subordinate Recovery Label */ - public org.drip.state.identifier.EntityRecoveryLabel dealerSubordinateRecoveryLabel() + public EntityRecoveryLabel dealerSubordinateRecoveryLabel() { return _creditDebtGroupSpecification.dealerSubordinateRecoveryLabel(); } @@ -279,7 +281,7 @@ public org.drip.state.identifier.EntityRecoveryLabel dealerSubordinateRecoveryLa * @return The Client Senior Recovery Label */ - public org.drip.state.identifier.EntityRecoveryLabel clientRecoveryLabel() + public EntityRecoveryLabel clientRecoveryLabel() { return _creditDebtGroupSpecification.clientRecoveryLabel(); } @@ -290,25 +292,17 @@ public org.drip.state.identifier.EntityRecoveryLabel clientRecoveryLabel() * @return The Overnight Label Map */ - public java.util.Map overnightLabelMap() + public Map overnightLabelMap() { - java.util.Map overnightLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.util.Map.Entry - collateralGroupMapEntry : _collateralGroupMap.entrySet()) - { - org.drip.state.identifier.OvernightLabel overnightLabel = - collateralGroupMapEntry.getValue().overnightLabel(); - - java.lang.String overnightLabelFQN = overnightLabel.fullyQualifiedName(); - - if (!overnightLabelMap.containsKey (overnightLabelFQN)) - { - overnightLabelMap.put ( - overnightLabelFQN, - overnightLabel - ); + Map overnightLabelMap = new CaseInsensitiveHashMap(); + + for (Map.Entry collateralGroupMapEntry : _collateralGroupMap.entrySet()) { + OvernightLabel overnightLabel = collateralGroupMapEntry.getValue().overnightLabel(); + + String overnightLabelFQN = overnightLabel.fullyQualifiedName(); + + if (!overnightLabelMap.containsKey (overnightLabelFQN)) { + overnightLabelMap.put (overnightLabelFQN, overnightLabel); } } @@ -321,24 +315,17 @@ public java.util.Map * @return The CSA Label Map */ - public java.util.Map csaLabelMap() + public Map csaLabelMap() { - java.util.Map csaLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map csaLabelMap = new CaseInsensitiveHashMap(); - for (java.util.Map.Entry - collateralGroupMapEntry : _collateralGroupMap.entrySet()) - { + for (Map.Entry collateralGroupMapEntry : _collateralGroupMap.entrySet()) { org.drip.state.identifier.CSALabel csaLabel = collateralGroupMapEntry.getValue().csaLabel(); - java.lang.String csaLabelFQN = csaLabel.fullyQualifiedName(); + String csaLabelFQN = csaLabel.fullyQualifiedName(); - if (!csaLabelMap.containsKey (csaLabelFQN)) - { - csaLabelMap.put ( - csaLabelFQN, - csaLabel - ); + if (!csaLabelMap.containsKey (csaLabelFQN)) { + csaLabelMap.put (csaLabelFQN, csaLabel); } } diff --git a/src/main/java/org/drip/xva/topology/FundingGroup.java b/src/main/java/org/drip/xva/topology/FundingGroup.java index ac0916bb22d8..1675b3707b52 100644 --- a/src/main/java/org/drip/xva/topology/FundingGroup.java +++ b/src/main/java/org/drip/xva/topology/FundingGroup.java @@ -1,11 +1,25 @@ package org.drip.xva.topology; +import java.util.Map; + +import org.drip.analytics.support.CaseInsensitiveHashMap; +import org.drip.state.identifier.CSALabel; +import org.drip.state.identifier.EntityFundingLabel; +import org.drip.state.identifier.EntityHazardLabel; +import org.drip.state.identifier.EntityRecoveryLabel; +import org.drip.state.identifier.OvernightLabel; +import org.drip.xva.proto.FundingGroupSpecification; +import org.drip.xva.proto.ObjectSpecification; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -117,11 +131,10 @@ * @author Lakshmi Krishnamurthy */ -public class FundingGroup extends org.drip.xva.proto.ObjectSpecification +public class FundingGroup extends ObjectSpecification { - private org.drip.xva.proto.FundingGroupSpecification _fundingGroupSpecification = null; - private java.util.Map _creditDebtGroupMap = - null; + private Map _creditDebtGroupMap = null; + private FundingGroupSpecification _fundingGroupSpecification = null; /** * FundingGroup Constructor @@ -130,27 +143,22 @@ public class FundingGroup extends org.drip.xva.proto.ObjectSpecification * @param name FundingGroup Name * @param fundingGroupSpecification Funding Group Specification * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public FundingGroup ( - final java.lang.String id, - final java.lang.String name, - final org.drip.xva.proto.FundingGroupSpecification fundingGroupSpecification) - throws java.lang.Exception + final String id, + final String name, + final FundingGroupSpecification fundingGroupSpecification) + throws Exception { - super ( - id, - name - ); - - if (null == (_fundingGroupSpecification = fundingGroupSpecification)) - { - throw new java.lang.Exception ("FundingGroup Constructor => Invalid Inputs"); + super (id, name); + + if (null == (_fundingGroupSpecification = fundingGroupSpecification)) { + throw new Exception ("FundingGroup Constructor => Invalid Inputs"); } - _creditDebtGroupMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + _creditDebtGroupMap = new CaseInsensitiveHashMap(); } /** @@ -159,7 +167,7 @@ public FundingGroup ( * @return The Funding Group Specification */ - public org.drip.xva.proto.FundingGroupSpecification fundingGroupSpecification() + public FundingGroupSpecification fundingGroupSpecification() { return _fundingGroupSpecification; } @@ -170,7 +178,7 @@ public org.drip.xva.proto.FundingGroupSpecification fundingGroupSpecification() * @return The Credit Debt Group Map */ - public java.util.Map creditDebtGroupMap() + public Map creditDebtGroupMap() { return _creditDebtGroupMap; } @@ -184,17 +192,13 @@ public java.util.Map cr */ public boolean addCreditDebtGroup ( - final org.drip.xva.topology.CreditDebtGroup creditDebtGroup) + final CreditDebtGroup creditDebtGroup) { - if (null == creditDebtGroup) - { + if (null == creditDebtGroup) { return false; } - _creditDebtGroupMap.put ( - creditDebtGroup.id(), - creditDebtGroup - ); + _creditDebtGroupMap.put (creditDebtGroup.id(), creditDebtGroup); return true; } @@ -208,10 +212,9 @@ public boolean addCreditDebtGroup ( */ public boolean containsCreditDebtGroup ( - final java.lang.String creditDebtGroupID) + final String creditDebtGroupID) { - return null == creditDebtGroupID || creditDebtGroupID.isEmpty() ? false : - _creditDebtGroupMap.containsKey (creditDebtGroupID); + return null != creditDebtGroupID && _creditDebtGroupMap.containsKey (creditDebtGroupID); } /** @@ -222,8 +225,8 @@ public boolean containsCreditDebtGroup ( * @return The CreditDebtGroup Instance */ - public org.drip.xva.topology.CreditDebtGroup creditDebtGroup ( - final java.lang.String creditDebtGroupID) + public CreditDebtGroup creditDebtGroup ( + final String creditDebtGroupID) { return containsCreditDebtGroup (creditDebtGroupID) ? _creditDebtGroupMap.get (creditDebtGroupID) : null; @@ -235,7 +238,7 @@ public org.drip.xva.topology.CreditDebtGroup creditDebtGroup ( * @return The Dealer Senior Funding Label */ - public org.drip.state.identifier.EntityFundingLabel dealerSeniorFundingLabel() + public EntityFundingLabel dealerSeniorFundingLabel() { return _fundingGroupSpecification.dealerSeniorFundingLabel(); } @@ -246,7 +249,7 @@ public org.drip.state.identifier.EntityFundingLabel dealerSeniorFundingLabel() * @return The Client Funding Label */ - public org.drip.state.identifier.EntityFundingLabel clientFundingLabel() + public EntityFundingLabel clientFundingLabel() { return _fundingGroupSpecification.clientFundingLabel(); } @@ -257,7 +260,7 @@ public org.drip.state.identifier.EntityFundingLabel clientFundingLabel() * @return The Dealer Subordinate Funding Label */ - public org.drip.state.identifier.EntityFundingLabel dealerSubordinateFundingLabel() + public EntityFundingLabel dealerSubordinateFundingLabel() { return _fundingGroupSpecification.dealerSubordinateFundingLabel(); } @@ -268,31 +271,22 @@ public org.drip.state.identifier.EntityFundingLabel dealerSubordinateFundingLabe * @return The Overnight Label Map */ - public java.util.Map overnightLabelMap() + public Map overnightLabelMap() { - java.util.Map overnightLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map overnightLabelMap = new CaseInsensitiveHashMap(); - for (java.util.Map.Entry - creditDebtGroupEntry : _creditDebtGroupMap.entrySet()) - { - java.util.Map collateralGroupMap = + for (Map.Entry creditDebtGroupEntry : _creditDebtGroupMap.entrySet()) { + Map collateralGroupMap = creditDebtGroupEntry.getValue().collateralGroupMap(); - for (java.util.Map.Entry - collateralGroupMapEntry : collateralGroupMap.entrySet()) + for (Map.Entry collateralGroupMapEntry : collateralGroupMap.entrySet()) { - org.drip.state.identifier.OvernightLabel overnightLabel = - collateralGroupMapEntry.getValue().overnightLabel(); + OvernightLabel overnightLabel = collateralGroupMapEntry.getValue().overnightLabel(); - java.lang.String overnightLabelFQN = overnightLabel.fullyQualifiedName(); + String overnightLabelFQN = overnightLabel.fullyQualifiedName(); - if (!overnightLabelMap.containsKey (overnightLabelFQN)) - { - overnightLabelMap.put ( - overnightLabelFQN, - overnightLabel - ); + if (!overnightLabelMap.containsKey (overnightLabelFQN)) { + overnightLabelMap.put (overnightLabelFQN, overnightLabel); } } } @@ -306,30 +300,22 @@ public java.util.Map * @return The CSA Label Map */ - public java.util.Map csaLabelMap() + public Map csaLabelMap() { - java.util.Map csaLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map csaLabelMap = new CaseInsensitiveHashMap(); - for (java.util.Map.Entry - creditDebtGroupEntry : _creditDebtGroupMap.entrySet()) - { - java.util.Map collateralGroupMap = + for (Map.Entry creditDebtGroupEntry : _creditDebtGroupMap.entrySet()) { + Map collateralGroupMap = creditDebtGroupEntry.getValue().collateralGroupMap(); - for (java.util.Map.Entry - collateralGroupMapEntry : collateralGroupMap.entrySet()) + for (Map.Entry collateralGroupMapEntry : collateralGroupMap.entrySet()) { - org.drip.state.identifier.CSALabel csaLabel = collateralGroupMapEntry.getValue().csaLabel(); + CSALabel csaLabel = collateralGroupMapEntry.getValue().csaLabel(); - java.lang.String csaLabelFQN = csaLabel.fullyQualifiedName(); + String csaLabelFQN = csaLabel.fullyQualifiedName(); - if (!csaLabelMap.containsKey (csaLabelFQN)) - { - csaLabelMap.put ( - csaLabelFQN, - csaLabel - ); + if (!csaLabelMap.containsKey (csaLabelFQN)) { + csaLabelMap.put (csaLabelFQN, csaLabel); } } } @@ -343,26 +329,18 @@ public java.util.Map csaLa * @return The Dealer Hazard Label Map */ - public java.util.Map - dealerHazardLabelMap() + public Map dealerHazardLabelMap() { - java.util.Map dealerHazardLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); + Map dealerHazardLabelMap = + new CaseInsensitiveHashMap(); - for (java.util.Map.Entry - creditDebtGroupMapEntry : _creditDebtGroupMap.entrySet()) - { - org.drip.state.identifier.EntityHazardLabel dealerHazardLabel = - creditDebtGroupMapEntry.getValue().dealerHazardLabel(); + for (Map.Entry creditDebtGroupMapEntry : _creditDebtGroupMap.entrySet()) { + EntityHazardLabel dealerHazardLabel = creditDebtGroupMapEntry.getValue().dealerHazardLabel(); - java.lang.String dealerHazardLabelFQN = dealerHazardLabel.fullyQualifiedName(); + String dealerHazardLabelFQN = dealerHazardLabel.fullyQualifiedName(); - if (!dealerHazardLabelMap.containsKey (dealerHazardLabelFQN)) - { - dealerHazardLabelMap.put ( - dealerHazardLabelFQN, - dealerHazardLabel - ); + if (!dealerHazardLabelMap.containsKey (dealerHazardLabelFQN)) { + dealerHazardLabelMap.put (dealerHazardLabelFQN, dealerHazardLabel); } } @@ -375,26 +353,19 @@ public java.util.Map csaLa * @return The Client Hazard Label Map */ - public java.util.Map - clientHazardLabelMap() + public Map clientHazardLabelMap() { - java.util.Map clientHazardLabelMap = - new org.drip.analytics.support.CaseInsensitiveHashMap(); + Map clientHazardLabelMap = + new CaseInsensitiveHashMap(); - for (java.util.Map.Entry - creditDebtGroupMapEntry : _creditDebtGroupMap.entrySet()) - { - org.drip.state.identifier.EntityHazardLabel clientHazardLabel = + for (Map.Entry creditDebtGroupMapEntry : _creditDebtGroupMap.entrySet()) { + EntityHazardLabel clientHazardLabel = creditDebtGroupMapEntry.getValue().clientPartyHazardLabel(); - java.lang.String clientHazardLabelFQN = clientHazardLabel.fullyQualifiedName(); + String clientHazardLabelFQN = clientHazardLabel.fullyQualifiedName(); - if (!clientHazardLabelMap.containsKey (clientHazardLabelFQN)) - { - clientHazardLabelMap.put ( - clientHazardLabelFQN, - clientHazardLabel - ); + if (!clientHazardLabelMap.containsKey (clientHazardLabelFQN)) { + clientHazardLabelMap.put (clientHazardLabelFQN, clientHazardLabel); } } @@ -407,27 +378,19 @@ public java.util.Map csaLa * @return The Dealer Senior Recovery Label Map */ - public java.util.Map - dealerSeniorRecoveryLabelMap() + public Map dealerSeniorRecoveryLabelMap() { - java.util.Map - dealerSeniorRecoveryLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.util.Map.Entry - creditDebtGroupMapEntry : _creditDebtGroupMap.entrySet()) - { - org.drip.state.identifier.EntityRecoveryLabel dealerSeniorRecoveryLabel = + Map dealerSeniorRecoveryLabelMap = + new CaseInsensitiveHashMap(); + + for (Map.Entry creditDebtGroupMapEntry : _creditDebtGroupMap.entrySet()) { + EntityRecoveryLabel dealerSeniorRecoveryLabel = creditDebtGroupMapEntry.getValue().dealerSeniorRecoveryLabel(); - java.lang.String dealerSeniorRecoveryLabelFQN = dealerSeniorRecoveryLabel.fullyQualifiedName(); + String dealerSeniorRecoveryLabelFQN = dealerSeniorRecoveryLabel.fullyQualifiedName(); - if (!dealerSeniorRecoveryLabelMap.containsKey (dealerSeniorRecoveryLabelFQN)) - { - dealerSeniorRecoveryLabelMap.put ( - dealerSeniorRecoveryLabelFQN, - dealerSeniorRecoveryLabel - ); + if (!dealerSeniorRecoveryLabelMap.containsKey (dealerSeniorRecoveryLabelFQN)) { + dealerSeniorRecoveryLabelMap.put (dealerSeniorRecoveryLabelFQN, dealerSeniorRecoveryLabel); } } @@ -440,27 +403,19 @@ public java.util.Map csaLa * @return The Client Recovery Label Map */ - public java.util.Map - clientRecoveryLabelMap() + public Map clientRecoveryLabelMap() { - java.util.Map clientRecoveryLabelMap - = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.util.Map.Entry - creditDebtGroupMapEntry : _creditDebtGroupMap.entrySet()) - { - org.drip.state.identifier.EntityRecoveryLabel clientRecoveryLabel = + Map clientRecoveryLabelMap = + new CaseInsensitiveHashMap(); + + for (Map.Entry creditDebtGroupMapEntry : _creditDebtGroupMap.entrySet()) { + EntityRecoveryLabel clientRecoveryLabel = creditDebtGroupMapEntry.getValue().clientRecoveryLabel(); - java.lang.String clientRecoveryLabelFQN = clientRecoveryLabel.fullyQualifiedName(); + String clientRecoveryLabelFQN = clientRecoveryLabel.fullyQualifiedName(); - if (!clientRecoveryLabelMap.containsKey (clientRecoveryLabelFQN)) - { - clientRecoveryLabelMap.put ( - clientRecoveryLabelFQN, - clientRecoveryLabel - ); + if (!clientRecoveryLabelMap.containsKey (clientRecoveryLabelFQN)) { + clientRecoveryLabelMap.put (clientRecoveryLabelFQN, clientRecoveryLabel); } } @@ -473,26 +428,20 @@ public java.util.Map csaLa * @return The Dealer Subordinate Recovery Label Map */ - public java.util.Map - dealerSubordinateRecoveryLabelMap() + public Map dealerSubordinateRecoveryLabelMap() { - java.util.Map - dealerSubordinateRecoveryLabelMap = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.util.Map.Entry - creditDebtGroupMapEntry : _creditDebtGroupMap.entrySet()) - { - org.drip.state.identifier.EntityRecoveryLabel dealerSubordinateRecoveryLabel = + Map dealerSubordinateRecoveryLabelMap = + new CaseInsensitiveHashMap(); + + for (Map.Entry creditDebtGroupMapEntry : _creditDebtGroupMap.entrySet()) { + EntityRecoveryLabel dealerSubordinateRecoveryLabel = creditDebtGroupMapEntry.getValue().dealerSubordinateRecoveryLabel(); - if (null != dealerSubordinateRecoveryLabel) - { - java.lang.String dealerSubordinateRecoveryLabelFQN = + if (null != dealerSubordinateRecoveryLabel) { + String dealerSubordinateRecoveryLabelFQN = dealerSubordinateRecoveryLabel.fullyQualifiedName(); - if (!dealerSubordinateRecoveryLabelMap.containsKey (dealerSubordinateRecoveryLabelFQN)) - { + if (!dealerSubordinateRecoveryLabelMap.containsKey (dealerSubordinateRecoveryLabelFQN)) { dealerSubordinateRecoveryLabelMap.put ( dealerSubordinateRecoveryLabelFQN, dealerSubordinateRecoveryLabel diff --git a/src/main/java/org/drip/xva/vertex/AlbaneseAndersen.java b/src/main/java/org/drip/xva/vertex/AlbaneseAndersen.java index 27b1afc282fe..1e4357054e4e 100644 --- a/src/main/java/org/drip/xva/vertex/AlbaneseAndersen.java +++ b/src/main/java/org/drip/xva/vertex/AlbaneseAndersen.java @@ -1,11 +1,17 @@ package org.drip.xva.vertex; +import org.drip.analytics.date.JulianDate; +import org.drip.xva.hypothecation.CollateralGroupVertex; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -118,7 +124,7 @@ * @author Lakshmi Krishnamurthy */ -public class AlbaneseAndersen extends org.drip.xva.hypothecation.CollateralGroupVertex +public class AlbaneseAndersen extends CollateralGroupVertex { /** @@ -129,22 +135,17 @@ public class AlbaneseAndersen extends org.drip.xva.hypothecation.CollateralGroup * @param tradePayment The Trade Payment at the Path Vertex Time Node * @param variationMarginPosting The Variation Margin Posting at the Path Vertex Time Node * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public AlbaneseAndersen ( - final org.drip.analytics.date.JulianDate vertexDate, + final JulianDate vertexDate, final double variationMarginEstimate, final double tradePayment, final double variationMarginPosting) - throws java.lang.Exception + throws Exception { - super ( - vertexDate, - variationMarginEstimate, - tradePayment, - variationMarginPosting - ); + super (vertexDate, variationMarginEstimate, tradePayment, variationMarginPosting); } @Override public double credit() diff --git a/src/main/java/org/drip/xva/vertex/BurgardKjaer.java b/src/main/java/org/drip/xva/vertex/BurgardKjaer.java index 1b9554233931..55399974c931 100644 --- a/src/main/java/org/drip/xva/vertex/BurgardKjaer.java +++ b/src/main/java/org/drip/xva/vertex/BurgardKjaer.java @@ -1,11 +1,19 @@ package org.drip.xva.vertex; +import org.drip.analytics.date.JulianDate; +import org.drip.xva.derivative.ReplicationPortfolioVertexDealer; +import org.drip.xva.hypothecation.CollateralGroupVertex; +import org.drip.xva.hypothecation.CollateralGroupVertexCloseOut; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -118,11 +126,11 @@ * @author Lakshmi Krishnamurthy */ -public class BurgardKjaer extends org.drip.xva.hypothecation.CollateralGroupVertex +public class BurgardKjaer extends CollateralGroupVertex { - private org.drip.xva.vertex.BurgardKjaerExposure _burgardKjaerVertexExposure = null; - private org.drip.xva.hypothecation.CollateralGroupVertexCloseOut _collateralGroupCloseOut = null; - private org.drip.xva.derivative.ReplicationPortfolioVertexDealer _dealerReplicationPortfolioVertex = null; + private BurgardKjaerExposure _burgardKjaerVertexExposure = null; + private CollateralGroupVertexCloseOut _collateralGroupCloseOut = null; + private ReplicationPortfolioVertexDealer _dealerReplicationPortfolioVertex = null; /** * BurgardKjaer Constructor @@ -134,30 +142,24 @@ public class BurgardKjaer extends org.drip.xva.hypothecation.CollateralGroupVert * @param collateralGroupCloseOut The Collateral Group Vertex Close Out Instance * @param dealerReplicationPortfolioVertex The Dealer Replication Portfolio Vertex Instance * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public BurgardKjaer ( - final org.drip.analytics.date.JulianDate anchorDate, + final JulianDate anchorDate, final double forward, final double accrued, - final org.drip.xva.vertex.BurgardKjaerExposure burgardKjaerVertexExposure, - final org.drip.xva.hypothecation.CollateralGroupVertexCloseOut collateralGroupCloseOut, - final org.drip.xva.derivative.ReplicationPortfolioVertexDealer dealerReplicationPortfolioVertex) - throws java.lang.Exception + final BurgardKjaerExposure burgardKjaerVertexExposure, + final CollateralGroupVertexCloseOut collateralGroupCloseOut, + final ReplicationPortfolioVertexDealer dealerReplicationPortfolioVertex) + throws Exception { - super ( - anchorDate, - forward, - accrued, - burgardKjaerVertexExposure.variationMarginPosting() - ); + super (anchorDate, forward, accrued, burgardKjaerVertexExposure.variationMarginPosting()); if (null == (_burgardKjaerVertexExposure = burgardKjaerVertexExposure) || null == (_collateralGroupCloseOut = collateralGroupCloseOut) || - null == (_dealerReplicationPortfolioVertex = dealerReplicationPortfolioVertex)) - { - throw new java.lang.Exception ("BurgardKjaer Constructor => Invalid Inputs"); + null == (_dealerReplicationPortfolioVertex = dealerReplicationPortfolioVertex)) { + throw new Exception ("BurgardKjaer Constructor => Invalid Inputs"); } } @@ -215,7 +217,7 @@ public double hedgeError() * @return The Dealer Replication Potrfolio Instance */ - public org.drip.xva.derivative.ReplicationPortfolioVertexDealer dealerReplicationPortfolio() + public ReplicationPortfolioVertexDealer dealerReplicationPortfolio() { return _dealerReplicationPortfolioVertex; } diff --git a/src/main/java/org/drip/xva/vertex/BurgardKjaerBuilder.java b/src/main/java/org/drip/xva/vertex/BurgardKjaerBuilder.java index 5e104ddf57d6..4c68fd68208c 100644 --- a/src/main/java/org/drip/xva/vertex/BurgardKjaerBuilder.java +++ b/src/main/java/org/drip/xva/vertex/BurgardKjaerBuilder.java @@ -1,11 +1,24 @@ package org.drip.xva.vertex; +import org.drip.analytics.date.JulianDate; +import org.drip.exposure.universe.MarketEdge; +import org.drip.exposure.universe.MarketVertex; +import org.drip.exposure.universe.MarketVertexEntity; +import org.drip.numerical.common.NumberUtil; +import org.drip.xva.definition.CloseOut; +import org.drip.xva.derivative.ReplicationPortfolioVertexDealer; +import org.drip.xva.hypothecation.CollateralGroupVertexCloseOut; +import org.drip.xva.hypothecation.CollateralGroupVertexExposure; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -132,32 +145,23 @@ public class BurgardKjaerBuilder * @return The Burgard Kjaer Dealer Portfolio Vertex */ - public static final org.drip.xva.vertex.BurgardKjaer Initial ( - final org.drip.analytics.date.JulianDate anchorDate, + public static final BurgardKjaer Initial ( + final JulianDate anchorDate, final double forward, - final org.drip.exposure.universe.MarketVertex marketVertex, - final org.drip.xva.definition.CloseOut closeOutScheme) + final MarketVertex marketVertex, + final CloseOut closeOutScheme) { - if (null == marketVertex) - { + if (null == marketVertex) { return null; } - org.drip.xva.hypothecation.CollateralGroupVertexCloseOut collateralGroupVertexCloseOut = - org.drip.xva.hypothecation.CollateralGroupVertexCloseOut.Standard ( - closeOutScheme, - forward, - 0. - ); + CollateralGroupVertexCloseOut collateralGroupVertexCloseOut = + CollateralGroupVertexCloseOut.Standard (closeOutScheme, forward, 0.); - org.drip.xva.vertex.BurgardKjaerExposure burgardKjaerVertexExposure = - org.drip.xva.vertex.BurgardKjaerExposure.Initial ( - forward, - collateralGroupVertexCloseOut - ); + BurgardKjaerExposure burgardKjaerVertexExposure = + BurgardKjaerExposure.Initial (forward, collateralGroupVertexCloseOut); - if (null == burgardKjaerVertexExposure) - { + if (null == burgardKjaerVertexExposure) { return null; } @@ -165,7 +169,7 @@ public static final org.drip.xva.vertex.BurgardKjaer Initial ( double dealerDefaultCloseOut = collateralGroupVertexCloseOut.dealer(); - org.drip.exposure.universe.MarketVertexEntity dealerMarketVertex = marketVertex.dealer(); + MarketVertexEntity dealerMarketVertex = marketVertex.dealer(); double dealerSubordinateFundingMarketVertex = dealerMarketVertex.subordinateFundingReplicator(); @@ -186,24 +190,21 @@ public static final org.drip.xva.vertex.BurgardKjaer Initial ( dealerSurvival * clientSurvival * marketVertex.csaSpread() * burgardKjaerVertexExposure.variationMarginPosting(); - try - { - return new org.drip.xva.vertex.BurgardKjaer ( + try { + return new BurgardKjaer ( anchorDate, forward, 0., burgardKjaerVertexExposure, collateralGroupVertexCloseOut, - new org.drip.xva.derivative.ReplicationPortfolioVertexDealer ( + new ReplicationPortfolioVertexDealer ( (fundingExposure + dealerSubordinateRecoveryRate * adjustedExposure - dealerDefaultCloseOut) / (dealerSeniorRecoveryRate - dealerSubordinateRecoveryRate) / dealerMarketVertex.seniorFundingReplicator(), (fundingExposure + dealerSeniorRecoveryRate * adjustedExposure - dealerDefaultCloseOut) / (dealerSubordinateRecoveryRate - dealerSeniorRecoveryRate) / dealerSubordinateFundingMarketVertex ) ); - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); } @@ -222,18 +223,15 @@ public static final org.drip.xva.vertex.BurgardKjaer Initial ( * @return The Burgard Kjaer Dealer Portfolio Vertex */ - public static final org.drip.xva.vertex.BurgardKjaer DealerPortfolioBuilder ( - final org.drip.analytics.date.JulianDate anchorDate, - final org.drip.xva.hypothecation.CollateralGroupVertexExposure collateralGroupVertexExposure, - final org.drip.exposure.universe.MarketEdge marketEdge, - final org.drip.xva.hypothecation.CollateralGroupVertexCloseOut collateralGroupVertexCloseOut, - final org.drip.xva.vertex.BurgardKjaerExposure burgardKjaerVertexExposure) + public static final BurgardKjaer DealerPortfolioBuilder ( + final JulianDate anchorDate, + final CollateralGroupVertexExposure collateralGroupVertexExposure, + final MarketEdge marketEdge, + final CollateralGroupVertexCloseOut collateralGroupVertexCloseOut, + final BurgardKjaerExposure burgardKjaerVertexExposure) { - if (null == collateralGroupVertexExposure || - null == marketEdge || - null == collateralGroupVertexCloseOut || - null == burgardKjaerVertexExposure) - { + if (null == collateralGroupVertexExposure || null == marketEdge || + null == collateralGroupVertexCloseOut || null == burgardKjaerVertexExposure) { return null; } @@ -241,13 +239,14 @@ public static final org.drip.xva.vertex.BurgardKjaer DealerPortfolioBuilder ( double dealerDefaultCloseOut = collateralGroupVertexCloseOut.dealer(); - org.drip.exposure.universe.MarketVertex marketVertexStart = marketEdge.start(); + MarketVertex marketVertexStart = marketEdge.start(); - org.drip.exposure.universe.MarketVertex marketVertexFinish = marketEdge.finish(); + MarketVertex marketVertexFinish = marketEdge.finish(); - org.drip.exposure.universe.MarketVertexEntity dealerMarketVertexFinish = marketVertexFinish.dealer(); + MarketVertexEntity dealerMarketVertexFinish = marketVertexFinish.dealer(); - double dealerSubordinateFundingMarketVertexFinish = dealerMarketVertexFinish.subordinateFundingReplicator(); + double dealerSubordinateFundingMarketVertexFinish = + dealerMarketVertexFinish.subordinateFundingReplicator(); double dealerSurvivalFinish = dealerMarketVertexFinish.survivalProbability(); @@ -257,29 +256,28 @@ public static final org.drip.xva.vertex.BurgardKjaer DealerPortfolioBuilder ( double clientSurvivalFinish = marketVertexFinish.client().survivalProbability(); - double incrementalDealerSurvival = dealerSurvivalFinish - - (null == marketVertexStart ? 1. : marketVertexStart.dealer().survivalProbability()); + double incrementalDealerSurvival = dealerSurvivalFinish - ( + null == marketVertexStart ? 1. : marketVertexStart.dealer().survivalProbability() + ); - double adjustedExposure = - collateralGroupVertexExposure.uncollateralized() + - dealerSurvivalFinish * - (clientSurvivalFinish - - (null == marketVertexStart ? 1. : marketVertexStart.client().survivalProbability())) * - burgardKjaerVertexExposure.credit() + + double adjustedExposure = collateralGroupVertexExposure.uncollateralized() + dealerSurvivalFinish * ( + clientSurvivalFinish - ( + null == marketVertexStart ? 1. : marketVertexStart.client().survivalProbability() + ) + ) * burgardKjaerVertexExposure.credit() + clientSurvivalFinish * incrementalDealerSurvival * burgardKjaerVertexExposure.debt() + clientSurvivalFinish * incrementalDealerSurvival * fundingExposure - dealerSurvivalFinish * clientSurvivalFinish * marketVertexFinish.csaSpread() * burgardKjaerVertexExposure.variationMarginPosting(); - try - { - return new org.drip.xva.vertex.BurgardKjaer ( + try { + return new BurgardKjaer ( anchorDate, collateralGroupVertexExposure.variationMarginEstimate(), collateralGroupVertexExposure.tradePayment(), burgardKjaerVertexExposure, collateralGroupVertexCloseOut, - new org.drip.xva.derivative.ReplicationPortfolioVertexDealer ( + new ReplicationPortfolioVertexDealer ( (fundingExposure + dealerSubordinateRecoveryRateFinish * adjustedExposure - dealerDefaultCloseOut) / (dealerSeniorRecoveryRateFinish - dealerSubordinateRecoveryRateFinish) / @@ -289,9 +287,7 @@ public static final org.drip.xva.vertex.BurgardKjaer DealerPortfolioBuilder ( dealerSubordinateFundingMarketVertexFinish ) ); - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); } @@ -314,58 +310,47 @@ public static final org.drip.xva.vertex.BurgardKjaer DealerPortfolioBuilder ( * Bonds */ - public static final org.drip.xva.vertex.BurgardKjaer HedgeErrorDualBond ( - final org.drip.analytics.date.JulianDate anchorDate, + public static final BurgardKjaer HedgeErrorDualBond ( + final JulianDate anchorDate, final double exposure, final double realizedCashFlow, final double collateralBalance, final double hedgeError, - final org.drip.exposure.universe.MarketEdge marketEdge, - final org.drip.xva.definition.CloseOut closeOutScheme) + final MarketEdge marketEdge, + final CloseOut closeOutScheme) { - if (!org.drip.numerical.common.NumberUtil.IsValid (exposure) || - !org.drip.numerical.common.NumberUtil.IsValid (realizedCashFlow) || - !org.drip.numerical.common.NumberUtil.IsValid (collateralBalance) || - !org.drip.numerical.common.NumberUtil.IsValid (hedgeError)) - { + if (!NumberUtil.IsValid (exposure) || !NumberUtil.IsValid (realizedCashFlow) || + !NumberUtil.IsValid (collateralBalance) || !NumberUtil.IsValid (hedgeError)) { return null; } double uncollateralizedExposure = exposure + realizedCashFlow; double collateralizedExposure = uncollateralizedExposure - collateralBalance; - org.drip.xva.hypothecation.CollateralGroupVertexCloseOut collateralGroupVertexCloseOut = - org.drip.xva.hypothecation.CollateralGroupVertexCloseOut.Standard ( - closeOutScheme, + CollateralGroupVertexCloseOut collateralGroupVertexCloseOut = + CollateralGroupVertexCloseOut.Standard (closeOutScheme, uncollateralizedExposure, collateralBalance ); - if (null == collateralGroupVertexCloseOut) - { + if (null == collateralGroupVertexCloseOut) { return null; } - try - { + try { return DealerPortfolioBuilder ( anchorDate, - new org.drip.xva.hypothecation.CollateralGroupVertexExposure ( - exposure, - realizedCashFlow - ), + new CollateralGroupVertexExposure (exposure, realizedCashFlow), marketEdge, collateralGroupVertexCloseOut, - new org.drip.xva.vertex.BurgardKjaerExposure ( + new BurgardKjaerExposure ( collateralizedExposure - collateralGroupVertexCloseOut.client(), collateralizedExposure - collateralGroupVertexCloseOut.dealer(), hedgeError, collateralBalance ) ); - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); } @@ -387,34 +372,28 @@ public static final org.drip.xva.vertex.BurgardKjaer HedgeErrorDualBond ( * Default using Two Bonds */ - public static final org.drip.xva.vertex.BurgardKjaer SemiReplicationDualBond ( + public static final BurgardKjaer SemiReplicationDualBond ( final org.drip.analytics.date.JulianDate anchorDate, final double exposure, final double realizedCashFlow, final double collateralBalance, - final org.drip.exposure.universe.MarketEdge marketEdge, - final org.drip.xva.definition.CloseOut closeOutScheme) + final MarketEdge marketEdge, + final CloseOut closeOutScheme) { - if (!org.drip.numerical.common.NumberUtil.IsValid (exposure) || - !org.drip.numerical.common.NumberUtil.IsValid (realizedCashFlow) || - !org.drip.numerical.common.NumberUtil.IsValid (collateralBalance)) - { + if (!NumberUtil.IsValid (exposure) || !NumberUtil.IsValid (realizedCashFlow) || + !NumberUtil.IsValid (collateralBalance)) { return null; } double uncollateralizedExposure = exposure + realizedCashFlow; double collateralizedExposure = uncollateralizedExposure - collateralBalance; - try - { + try { return DealerPortfolioBuilder ( anchorDate, - new org.drip.xva.hypothecation.CollateralGroupVertexExposure ( - exposure, - realizedCashFlow - ), + new CollateralGroupVertexExposure (exposure, realizedCashFlow), marketEdge, - org.drip.xva.hypothecation.CollateralGroupVertexCloseOut.Standard ( + CollateralGroupVertexCloseOut.Standard ( closeOutScheme, uncollateralizedExposure, collateralBalance @@ -426,9 +405,7 @@ public static final org.drip.xva.vertex.BurgardKjaer SemiReplicationDualBond ( collateralBalance ) ); - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); } @@ -448,45 +425,32 @@ public static final org.drip.xva.vertex.BurgardKjaer SemiReplicationDualBond ( * @return The Standard Instance of BurgardKjaerVertex using using a Fully Collateralized Strategy */ - public static final org.drip.xva.vertex.BurgardKjaer GoldPlatedTwoWayCSA ( + public static final BurgardKjaer GoldPlatedTwoWayCSA ( final org.drip.analytics.date.JulianDate anchorDate, final double exposure, final double realizedCashFlow, - final org.drip.exposure.universe.MarketEdge marketEdge, - final org.drip.xva.definition.CloseOut closeOutScheme) + final MarketEdge marketEdge, + final CloseOut closeOutScheme) { - if (!org.drip.numerical.common.NumberUtil.IsValid (exposure) || - !org.drip.numerical.common.NumberUtil.IsValid (realizedCashFlow)) - { + if (!NumberUtil.IsValid (exposure) || !NumberUtil.IsValid (realizedCashFlow)) { return null; } double uncollateralizedExposure = exposure + realizedCashFlow; - try - { + try { return DealerPortfolioBuilder ( anchorDate, - new org.drip.xva.hypothecation.CollateralGroupVertexExposure ( - exposure, - realizedCashFlow - ), + new CollateralGroupVertexExposure (exposure, realizedCashFlow), marketEdge, - org.drip.xva.hypothecation.CollateralGroupVertexCloseOut.Standard ( + CollateralGroupVertexCloseOut.Standard ( closeOutScheme, uncollateralizedExposure, uncollateralizedExposure ), - new org.drip.xva.vertex.BurgardKjaerExposure ( - 0., - 0., - 0., - uncollateralizedExposure - ) + new BurgardKjaerExposure (0., 0., 0., uncollateralizedExposure) ); - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); } @@ -505,46 +469,38 @@ public static final org.drip.xva.vertex.BurgardKjaer GoldPlatedTwoWayCSA ( * @return The Standard Instance of BurgardKjaerVertex using One Way CSA */ - public static final org.drip.xva.vertex.BurgardKjaer OneWayCSA ( - final org.drip.analytics.date.JulianDate anchorDate, + public static final BurgardKjaer OneWayCSA ( + final JulianDate anchorDate, final double exposure, final double realizedCashFlow, - final org.drip.exposure.universe.MarketEdge marketEdge, - final org.drip.xva.definition.CloseOut closeOutScheme) + final MarketEdge marketEdge, + final CloseOut closeOutScheme) { - if (!org.drip.numerical.common.NumberUtil.IsValid (exposure) || - !org.drip.numerical.common.NumberUtil.IsValid (realizedCashFlow)) - { + if (!NumberUtil.IsValid (exposure) || !NumberUtil.IsValid (realizedCashFlow)) { return null; } double uncollateralizedExposure = exposure + realizedCashFlow; double collateralBalance = 0. > uncollateralizedExposure ? uncollateralizedExposure : 0.; - try - { + try { return DealerPortfolioBuilder ( anchorDate, - new org.drip.xva.hypothecation.CollateralGroupVertexExposure ( - exposure, - realizedCashFlow - ), + new CollateralGroupVertexExposure (exposure, realizedCashFlow), marketEdge, - org.drip.xva.hypothecation.CollateralGroupVertexCloseOut.Standard ( + CollateralGroupVertexCloseOut.Standard ( closeOutScheme, uncollateralizedExposure, collateralBalance ), - new org.drip.xva.vertex.BurgardKjaerExposure ( + new BurgardKjaerExposure ( 0. < uncollateralizedExposure ? uncollateralizedExposure : 0., 0., 0. < uncollateralizedExposure ? uncollateralizedExposure : 0., collateralBalance ) ); - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); } @@ -563,21 +519,19 @@ public static final org.drip.xva.vertex.BurgardKjaer OneWayCSA ( * @return The Standard Instance of BurgardKjaerVertex using the "Set Off" Legal Agreement Scheme */ - public static final org.drip.xva.vertex.BurgardKjaer SetOff ( - final org.drip.analytics.date.JulianDate anchorDate, + public static final BurgardKjaer SetOff ( + final JulianDate anchorDate, final double exposure, final double realizedCashFlow, final double collateralBalance, - final org.drip.exposure.universe.MarketEdge marketEdge) + final MarketEdge marketEdge) { - if (!org.drip.numerical.common.NumberUtil.IsValid (exposure) || - !org.drip.numerical.common.NumberUtil.IsValid (realizedCashFlow) || - !org.drip.numerical.common.NumberUtil.IsValid (collateralBalance)) - { + if (!NumberUtil.IsValid (exposure) || !NumberUtil.IsValid (realizedCashFlow) || + !NumberUtil.IsValid (collateralBalance)) { return null; } - org.drip.exposure.universe.MarketVertex marketVertexFinish = marketEdge.finish(); + MarketVertex marketVertexFinish = marketEdge.finish(); double dealerSeniorRecoveryRateFinish = marketVertexFinish.dealer().seniorRecoveryRate(); @@ -585,29 +539,23 @@ public static final org.drip.xva.vertex.BurgardKjaer SetOff ( double collateralizedExposure = exposure + realizedCashFlow - collateralBalance; - try - { + try { return DealerPortfolioBuilder ( anchorDate, - new org.drip.xva.hypothecation.CollateralGroupVertexExposure ( - exposure, - realizedCashFlow - ), + new CollateralGroupVertexExposure (exposure, realizedCashFlow), marketEdge, - new org.drip.xva.hypothecation.CollateralGroupVertexCloseOut ( + new CollateralGroupVertexCloseOut ( collateralizedExposure * dealerSeniorRecoveryRateFinish, collateralizedExposure * clientRecoveryFinish ), - new org.drip.xva.vertex.BurgardKjaerExposure ( + new BurgardKjaerExposure ( collateralizedExposure * (1. - clientRecoveryFinish), collateralizedExposure * (1. - dealerSeniorRecoveryRateFinish), 0., collateralBalance ) ); - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/org/drip/xva/vertex/BurgardKjaerExposure.java b/src/main/java/org/drip/xva/vertex/BurgardKjaerExposure.java index bb1012b0a04f..9907c3d040c0 100644 --- a/src/main/java/org/drip/xva/vertex/BurgardKjaerExposure.java +++ b/src/main/java/org/drip/xva/vertex/BurgardKjaerExposure.java @@ -1,11 +1,18 @@ package org.drip.xva.vertex; +import org.drip.numerical.common.NumberUtil; +import org.drip.xva.hypothecation.CollateralGroupVertexCloseOut; +import org.drip.xva.hypothecation.CollateralGroupVertexExposureComponent; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -119,12 +126,12 @@ * @author Lakshmi Krishnamurthy */ -public class BurgardKjaerExposure implements org.drip.xva.hypothecation.CollateralGroupVertexExposureComponent +public class BurgardKjaerExposure implements CollateralGroupVertexExposureComponent { - private double _debt = java.lang.Double.NaN; - private double _credit = java.lang.Double.NaN; - private double _funding = java.lang.Double.NaN; - private double _collateralBalance = java.lang.Double.NaN; + private double _debt = Double.NaN; + private double _credit = Double.NaN; + private double _funding = Double.NaN; + private double _collateralBalance = Double.NaN; /** * Generate an Initial Instance of Burgard Kjaer Vertex Exposure @@ -137,11 +144,9 @@ public class BurgardKjaerExposure implements org.drip.xva.hypothecation.Collater public static final BurgardKjaerExposure Initial ( final double uncollateralizedExposure, - final org.drip.xva.hypothecation.CollateralGroupVertexCloseOut collateralGroupVertexCloseOut) + final CollateralGroupVertexCloseOut collateralGroupVertexCloseOut) { - if (!org.drip.numerical.common.NumberUtil.IsValid (uncollateralizedExposure) || - null == collateralGroupVertexCloseOut) - { + if (!NumberUtil.IsValid (uncollateralizedExposure) || null == collateralGroupVertexCloseOut) { return null; } @@ -153,9 +158,7 @@ public static final BurgardKjaerExposure Initial ( 0., 0. ); - } - catch (java.lang.Exception e) - { + } catch (Exception e) { e.printStackTrace(); } @@ -170,7 +173,7 @@ public static final BurgardKjaerExposure Initial ( * @param funding The Funding Exposure of the Collateral Group * @param collateralBalance The Collateral Balance of the Collateral Group * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public BurgardKjaerExposure ( @@ -178,14 +181,12 @@ public BurgardKjaerExposure ( final double debt, final double funding, final double collateralBalance) - throws java.lang.Exception + throws Exception { - if (!org.drip.numerical.common.NumberUtil.IsValid (_credit = credit) || - !org.drip.numerical.common.NumberUtil.IsValid (_debt = debt) || - !org.drip.numerical.common.NumberUtil.IsValid (_funding = funding) || - !org.drip.numerical.common.NumberUtil.IsValid (_collateralBalance = collateralBalance)) - { - throw new java.lang.Exception ("BurgardKjaerExposure Constructor => Invalid Inputs"); + if (!NumberUtil.IsValid (_credit = credit) || !NumberUtil.IsValid (_debt = debt) || + !NumberUtil.IsValid (_funding = funding) || + !NumberUtil.IsValid (_collateralBalance = collateralBalance)) { + throw new Exception ("BurgardKjaerExposure Constructor => Invalid Inputs"); } }