コード例 #1
0
        public ExecutionOutput(double _payout, HashSet <AtomicRITE> rites)
        {
            Payout = _payout;  //raintest

            AllocatedLosses = new List <AllocatedLoss>();
            foreach (AtomicRITE aRITE in rites)
            {
                aRITE.SetAllocState(aRITE.GetAllocState());
                foreach (TimeLoss timeloss in aRITE.AllocatedLossSeries)
                {
                    if (timeloss.Loss > 0)
                    {
                        AllocatedLoss allocLoss = new AllocatedLoss();
                        allocLoss.ExpType   = aRITE.ExpType;
                        allocLoss.Subperil  = aRITE.SubPeril;
                        allocLoss.Loss      = timeloss.Loss;
                        allocLoss.timestamp = timeloss.Time;
                        AllocatedLosses.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.ContractID;
                        }
                        //Remove above ////////////////////////////////////////////////////
                    }
                }
            }
        }
コード例 #2
0
        public static ExecutionOutput operator +(ExecutionOutput exOutput1, ExecutionOutput exOutput2)
        {
            double payout = exOutput1.Payout + exOutput2.Payout;

            List <AllocatedLoss> allocatedLosses = exOutput1.AllocatedLosses;

            foreach (AllocatedLoss allocLoss in exOutput2.AllocatedLosses)
            {
                AllocatedLoss sameLoss = allocatedLosses.Where(aLoss => aLoss.ExposureID == allocLoss.ExposureID)
                                         .FirstOrDefault();

                if (sameLoss != null)
                {
                    sameLoss.Loss += allocLoss.Loss;
                }
                else
                {
                    allocatedLosses.Add(allocLoss);
                }
            }

            return(new ExecutionOutput(payout, allocatedLosses));
        }