Example #1
0
        public override HashSet <AtomicRITE> GetAtomicRites()
        {
            if (!IsDerived)
            {
                HashSet <CoverageAtomicRITE> ARITEs = new HashSet <CoverageAtomicRITE>();

                foreach (ExposureType expType in ExposureTypes)
                {
                    var RITChars = Schedule.RITChars.Where(RitChar => RitChar.ExpType == expType || ExposureTypeCollection.GetMappedType(RitChar.ExpType) == expType);
                    foreach (RITCharacteristic RITChar in RITChars)
                    {
                        foreach (string subperil in CauseOfLossSet.GetSubperils())
                        {
                            ARITEs.Add(new CoverageAtomicRITE(subperil, ExposureTypeCollection.GetMappedType(RITChar.ExpType), RITChar.ParentRITE, RITChar.ID));
                            //IEnumerable<RITCharacteristic> RITChars;
                            //RITChars = rite.RiskCharacteristics.Where(RitChar => RitChar.ExpType == expType || ExposureTypeCollection.GetMappedType(RitChar.ExpType) == expType);
                            //foreach (RITCharacteristic RitChar in RITChars)
                            //{
                            //    ARITEs.Add(new CoverageAtomicRITE(subperil, ExposureTypeCollection.GetMappedType(RitChar.ExpType), rite, RitChar.ID));
                            //}
                        }
                    }
                }

                return(new HashSet <AtomicRITE>(ARITEs.Cast <AtomicRITE>()));
            }
            else
            {
                throw new InvalidOperationException("Cannot get Atomic Rites for derived subjects!");
            }
        }
Example #2
0
 public ReinsuranceSubject(ScheduleOfContracts _schedule, ExposureTypeCollection _exposureTypes, COLCollection _causeOfLossSet) : base()
 {
     schedule        = _schedule;
     exposureTypes   = _exposureTypes;
     causeOfLossSet  = _causeOfLossSet;
     SubjectFunction = FunctionType.Sum;
     TotalNumSubjects++;
     ID = TotalNumSubjects;
 }
Example #3
0
        //Comparison Methods

        public bool LargerOrEqualThan(ExposureTypeCollection other, bool IsLocCvg = false)
        {
            if (IsLocCvg)
            {
                return(this.collection.First() == other.collection.First());
            }

            return(other.All(expType => this.collection.Contains(expType) ||
                             this.collection.Contains(ExposureTypeCollection.GetMappedType(expType))));
        }
Example #4
0
        protected override Subject GetSubjectForTerm(Dictionary <string, object> termDict)
        {
            string                 termSchedule = termDict["Schedule"].ToString();
            COLCollection          termCOL      = GetCOLHashSet(termDict["CausesOfLoss"].ToString());
            ExposureTypeCollection termExp      = GetExpTypeHashSet(termDict["ExposureTypes"].ToString());
            ScheduleOfRITEs        schedule     = GetSchedule(termSchedule);

            PrimarySubject sub = new PrimarySubject(schedule, termExp, termCOL);

            return(sub);
        }
Example #5
0
        public bool LargerThan(ExposureTypeCollection other, bool IsLocCvg = false)
        {
            if (IsLocCvg)
            {
                return(false);
            }

            return(other.All(expType => this.collection.Contains(expType) ||
                             this.collection.Contains(ExposureTypeCollection.GetMappedType(expType))) &&
                   !this.Equals(other));
        }
Example #6
0
        protected override HashSet <Subject> GetSubjectForTerm(Dictionary <string, object> termDict)
        {
            string expTypes = termDict["ExposureTypes"].ToString();
            string COLTypes = termDict["CausesOfLoss"].ToString();

            ExposureTypeCollection termExp;
            COLCollection          termCOL;

            if (COLTypes == "")
            {
                termCOL = contractSubject.CauseOfLossSet;
            }
            else
            {
                termCOL = new COLCollection(COLTypes);
            }

            if (expTypes == "")
            {
                termExp = contractSubject.ExposureTypes;
            }
            else
            {
                termExp = ExposureTypeCollection.BuildFromString(expTypes);
            }

            string          termSchedule = termDict["Schedule"].ToString();
            ScheduleOfRITEs schedule     = ExpData.GetSchedule(termSchedule);

            bool isPerRisk = false;

            if (termDict.ContainsKey("PerRisk") & termDict["PerRisk"].ToString() == "True")
            {
                isPerRisk = true;
            }

            PrimarySubject sub = new PrimarySubject(schedule, termExp, termCOL, isPerRisk);

            //DO NOT Explode
            //if (termDict.ContainsKey("PerRisk")
            //    & termDict["PerRisk"].ToString() == "True")
            //    return new HashSet<Subject>(ExplodeSubjectForPerRisk(sub).Cast<Subject>());
            //else
            //    return new HashSet<Subject>(){sub};

            return(new HashSet <Subject>()
            {
                sub
            });
        }
Example #7
0
        public PrimarySubject(ScheduleOfRITEs _schedule, ExposureTypeCollection _exposureTypes, COLCollection _causeOfLossSet, bool _isPerRisk = false) : base()
        {
            schedule       = _schedule;
            exposureTypes  = _exposureTypes;
            causeOfLossSet = _causeOfLossSet;
            if (_schedule != null && _schedule.IsLocation && _exposureTypes.Count == 1)
            {
                isLocCvg = true;
            }
            else
            {
                isLocCvg = false;
            }

            IsPerRisk = _isPerRisk;
        }
Example #8
0
        //Override IEquatable

        public bool Equals(ExposureTypeCollection other)
        {
            if (other == null)
            {
                return(false);
            }

            if (this.collection.SetEquals(other.collection))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #9
0
        protected override HashSet <Subject> GetSubjectForTerm(Dictionary <string, object> termDict)
        {
            string expTypes = termDict["ExposureTypes"].ToString();
            string COLTypes = termDict["CausesOfLoss"].ToString();

            ExposureTypeCollection termExp;
            COLCollection          termCOL;

            if (COLTypes == "")
            {
                termCOL = contractSubject.CauseOfLossSet;
            }
            else
            {
                termCOL = new COLCollection(COLTypes);
            }

            if (expTypes == "")
            {
                termExp = contractSubject.ExposureTypes;
            }
            else
            {
                termExp = ExposureTypeCollection.BuildFromString(expTypes);
            }

            string termSchedule = termDict["Schedule"].ToString();
            ScheduleOfContracts grossSchedule;
            ScheduleOfContracts cededSchedule;

            if (termSchedule == "")
            {
                ReinsuranceSubject treatyConCub = contractSubject as ReinsuranceSubject;
                grossSchedule = treatyConCub.GrossSchedule;
                cededSchedule = treatyConCub.CededSchedule;
            }
            else
            {
                throw new NotSupportedException("Cannot support treaty terms with Schedule Of Contract subjects...");
            }

            return(new HashSet <Subject>()
            {
                new ReinsuranceSubject(grossSchedule, cededSchedule, termExp, termCOL)
            });
        }
Example #10
0
        public override bool Equals(Object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            ExposureTypeCollection expColObj = obj as ExposureTypeCollection;

            if (expColObj == null)
            {
                return(false);
            }
            else
            {
                return(Equals(expColObj));
            }
        }
Example #11
0
        protected override Subject GetSubjectForTerm(Dictionary <string, object> termDict)
        {
            string                 termSchedule = termDict["Schedule"].ToString();
            COLCollection          termCOL      = GetCOLHashSet(termDict["CausesOfLoss"].ToString());
            ExposureTypeCollection termExp      = GetExpTypeHashSet(termDict["ExposureTypes"].ToString());

            ScheduleOfContracts schedule;

            if (termSchedule == "")
            {
                ReinsuranceSubject treatyConCub = ContractSubject as ReinsuranceSubject;
                schedule = treatyConCub.GrossSchedule;
            }
            else
            {
                throw new NotSupportedException("Cannot support treaty terms with Schedule Of Contract subjects...");
            }

            return(new ReinsuranceSubject(schedule, termExp, termCOL));
        }
Example #12
0
        private bool SetDeclarations(Declarations graph_declarations, Dictionary <String, Object> cdl_declarations, out string message)
        {
            message = "";
            try
            {
                graph_declarations.Name = Convert.ToString(cdl_declarations["Name"]);

                if (cdl_declarations.ContainsKey("Currency"))
                {
                    graph_declarations.Currency = Convert.ToString(cdl_declarations["Currency"]);
                }
                if (cdl_declarations.ContainsKey("Inception"))
                {
                    graph_declarations.Inception = Convert.ToDateTime(cdl_declarations["Inception"]);
                }
                else
                {
                    graph_declarations.Inception = DateTime.Now;
                }
                if (cdl_declarations.ContainsKey("Expiration"))
                {
                    graph_declarations.Expiration = Convert.ToDateTime(cdl_declarations["Expiration"]);
                }
                else
                {
                    graph_declarations.Expiration = graph_declarations.Inception.AddYears(1);
                }

                if (cdl_declarations.ContainsKey("ContractType"))
                {
                    graph_declarations.ContractType = Convert.ToString(cdl_declarations["ContractType"]);
                }
                else
                {
                    throw new NotSupportedException("This prototype requies CDL to specify a recognized Contract Type");
                }

                if (cdl_declarations.ContainsKey("CausesOfLoss"))
                {
                    graph_declarations.CausesofLoss = new COLCollection(Convert.ToString(cdl_declarations["CausesOfLoss"]));
                }
                else
                {
                    graph_declarations.CausesofLoss = CauseOfLoss.GetDefaultCOLs();
                }

                if (cdl_declarations.ContainsKey("ExposureTypes"))
                {
                    graph_declarations.ExposureTypes = ExposureTypeCollection.BuildFromString(Convert.ToString(cdl_declarations["ExposureTypes"]));
                }
                else
                {
                    graph_declarations.ExposureTypes = ExposureTypeCollection.GetDefaultExposureTypes();
                }

                if (cdl_declarations.ContainsKey("Schedule"))
                {
                    try { graph_declarations.Schedule = expData.GetSchedule(Convert.ToString(cdl_declarations["Schedule"])); }
                    catch (Exception ex) { graph_declarations.Schedule = null; }
                }

                if (cdl_declarations.ContainsKey("GrossPosition"))
                {
                    graph_declarations.GrossPosition = Convert.ToString(cdl_declarations["GrossPosition"]).Split(',').ToList();
                }
                else
                {
                    graph_declarations.GrossPosition = new List <string>();
                }

                if (cdl_declarations.ContainsKey("CededPosition"))
                {
                    graph_declarations.CededPosition = Convert.ToString(cdl_declarations["CededPosition"]).Split(',').ToList();
                }
                else
                {
                    graph_declarations.CededPosition = new List <string>();
                }

                //Handle Claims Adjustment Options
                if (cdl_declarations.ContainsKey("Claims Adjustment Options"))
                {
                    Dictionary <String, Object> ClaimsAdjustmentOptions = cdl_declarations["Claims Adjustment Options"] as Dictionary <String, Object>;
                    if (ClaimsAdjustmentOptions.ContainsKey("Claims Adjustment Sublimits"))
                    {
                        string sublimitAdjustment = ClaimsAdjustmentOptions["Claims Adjustment Sublimits"].ToString();
                        if (sublimitAdjustment == "Net Of Deductible")
                        {
                            graph_declarations.GroundUpSublimits = false;
                        }
                        else if (sublimitAdjustment == "GroundUp")
                        {
                            graph_declarations.GroundUpSublimits = true;
                        }
                        else
                        {
                            throw new JSONParseException("Cannot support Claims Adjustment Option for Sublimits: " + sublimitAdjustment);
                        }
                    }

                    if (ClaimsAdjustmentOptions.ContainsKey("Claims Adjustment Deductibles"))
                    {
                        string dedAdjustment = ClaimsAdjustmentOptions["Claims Adjustment Deductibles"].ToString();
                        if (dedAdjustment == "Absorbable")
                        {
                            graph_declarations.MinimumAbsorbingDed = true;
                        }
                        else
                        {
                            throw new JSONParseException("Cannot support Claims Adjustment Option for Deductibles: " + dedAdjustment);
                        }
                    }
                }

                //Get Hours clause declarations
                graph_declarations.HoursClauses = new List <HoursClause>();
                Object[] hoursclauses;
                if (cdl_declarations.ContainsKey("Hours Clauses"))
                {
                    hoursclauses = cdl_declarations["Hours Clauses"] as object[];
                    List <Object> lst_hoursclauses = hoursclauses.OfType <Object>().ToList();

                    foreach (Dictionary <String, Object> hc in lst_hoursclauses)
                    {
                        HoursClause objHC = new HoursClause();
                        objHC.SetHoursClause(hc);
                        graph_declarations.HoursClauses.Add(objHC);
                    }

                    graph_declarations.IsHoursClause = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(true);
        }