private List <AtomicLoss> GetAllocatedPayoutsFromARITEs(HashSet <AtomicRITE> rites) { List <AtomicLoss> AllocatedPayoutLosses = new List <AtomicLoss>(); foreach (AtomicRITE aRITE in rites) { aRITE.SetAllocState(aRITE.GetAllocState()); foreach (TimeLoss timeloss in aRITE.AllocatedLossSeries) { if (timeloss.Loss > 0) { AtomicLoss allocLoss = new AtomicLoss(); allocLoss.ExpType = aRITE.ExpType; allocLoss.Subperil = aRITE.SubPeril; allocLoss.Loss = timeloss.Loss; allocLoss.timestamp = timeloss.Time; AllocatedPayoutLosses.Add(allocLoss); //Remove when architecture for allcoation finalized !!!!!!!!! if (aRITE is CoverageAtomicRITE) { allocLoss.ExposureID = (aRITE as CoverageAtomicRITE).RITCharacterisiticID; } else { allocLoss.ExposureID = (aRITE as ContractAtomicRITE).contractGraph.Graph.ContractID; } //Remove above //////////////////////////////////////////////////// } } } return(AllocatedPayoutLosses); }
private List <AtomicLoss> GetSubjectLossesFromARITEs(HashSet <AtomicRITE> rites) { List <AtomicLoss> SubjectLosses = new List <AtomicLoss>(); foreach (AtomicRITE aRITE in rites) { foreach (TimeLoss timeloss in aRITE.SubjectLoss) { if (timeloss.Loss > 0) { AtomicLoss subjectLoss = new AtomicLoss(); subjectLoss.ExpType = aRITE.ExpType; subjectLoss.Subperil = aRITE.SubPeril; subjectLoss.Loss = timeloss.Loss; subjectLoss.timestamp = timeloss.Time; SubjectLosses.Add(subjectLoss); //Remove when architecture for allcoation finalized !!!!!!!!! if (aRITE is CoverageAtomicRITE) { subjectLoss.ExposureID = (aRITE as CoverageAtomicRITE).RITCharacterisiticID; } else { subjectLoss.ExposureID = (aRITE as ContractAtomicRITE).contractGraph.Graph.ContractID; } //Remove above //////////////////////////////////////////////////// } } } return(SubjectLosses); }
public List <AtomicLoss> GetAllocatedLossList(float[] AllocatedLossVector, int[] GULossIndicies, uint[] TimeStamps, Declarations contractDeclarations) { List <AtomicLoss> AllocatedLosses = new List <AtomicLoss>(); int NumOfArites = AllocatedLossVector.Length; for (int i = 0; i < NumOfArites; i++) { if (AllocatedLossVector[i] > 0) { AtomicLoss loss = new AtomicLoss(); loss.ExposureID = Mapper.GetRITEIDFromIndex(GULossIndicies[i]); loss.Subperil = Mapper.GetSubPerilFromIndex(GULossIndicies[i]); loss.Loss = AllocatedLossVector[i]; RITCharacteristic RitChar = Mapper.GetRITCharObject(loss.ExposureID); loss.RITE = RitChar.ParentRITE; loss.ExpType = RitChar.ExpType; //Get TimeStamp using Mapper: int ContractYear = contractDeclarations.Inception.Year; uint timestamp = TimeStamps[GULossIndicies[i]]; DateTime ActualTimeStamp = new DateTime(ContractYear, 1, 1); ActualTimeStamp = ActualTimeStamp.AddDays((double)timestamp - 1); loss.timestamp = ActualTimeStamp; AllocatedLosses.Add(loss); } } return(AllocatedLosses); }
public static QuerryableLossOutput operator +(QuerryableLossOutput exOutput1, QuerryableLossOutput exOutput2) { List <AtomicLoss> allocatedLosses = exOutput1.AtomicLosses; foreach (AtomicLoss allocLoss in exOutput2.AtomicLosses) { AtomicLoss sameLoss = allocatedLosses.Where(aLoss => aLoss.ExposureID == allocLoss.ExposureID) .FirstOrDefault(); if (sameLoss != null) { sameLoss.Loss += allocLoss.Loss; } else { allocatedLosses.Add(allocLoss); } } return(new QuerryableLossOutput(allocatedLosses)); }