Beispiel #1
0
        private AutoGraphStyle GetGraphStyle(ContractExtractor contract)
        {
            if (contract.IsTreaty)
            {
                return(AutoGraphStyle.Node);
            }
            else
            {
                PrimaryContractExtractor primaryContract = contract as PrimaryContractExtractor;

                List <PrimarySubject> primarysubjects = primaryContract.GetAllTermSubjects();

                foreach (PrimarySubject priSub in primarysubjects)
                {
                    DeductibleCollection dedCol;
                    if (primaryContract.GetDeductiblesForSubject(priSub, out dedCol))
                    {
                        foreach (Deductible ded in dedCol)
                        {
                            if (ded.DedInterType == DedInteractionType.SingleLargest)
                            {
                                return(AutoGraphStyle.Node);
                            }

                            if (ded.DedType == TermValueType.PercentAffected || ded.DedType == TermValueType.PercentLoss)
                            {
                                return(AutoGraphStyle.Node);
                            }
                        }
                    }
                }

                return(AutoGraphStyle.Matrix);
            }
        }
Beispiel #2
0
        private List <GraphNode> GetCoverNodes(ContractExtractor contract, List <Subject> graphSubs)
        {
            List <GraphNode> coverNodes = new List <GraphNode>();

            foreach (Subject sub in graphSubs)
            {
                HashSet <Cover> covers;
                if (contract.GetCoversForSubject(sub, out covers))
                {
                    foreach (Cover cover in covers)
                    {
                        CoverNode node = new CoverNode(sub, cover.CoverName);
                        node.Cover = cover;
                        coverNodes.Add(node);
                    }
                }
            }

            return(coverNodes);
        }
Beispiel #3
0
        public GraphInfo MakeGraph(GraphType type, ExposureDataAdaptor expData, IRITEindexMapper indexMapper)
        {
            GraphInfo graphInfo;

            if (graphCache.GetGraphInfo(expData.ContractID, out graphInfo))
            {
                return(graphInfo);
            }

            Graph graph;

            switch (type)
            {
            case GraphType.Auto:
                ContractExtractor contract = GetContract(expData, graphCache);
                contract.Extract();

                AutoGraphStyle style = GetGraphStyle(contract);
                //AutoGraphStyle style = AutoGraphStyle.Matrix;
                //AutoGraphStyle style = AutoGraphStyle.Node;

                AutoGraphBuilder builder;

                if (style == AutoGraphStyle.Node)
                {
                    builder = new AutoGraphOfNodesBuilder(contract);
                }
                else
                {
                    builder = new AutoGraphOfMatrixBuilder(contract, indexMapper);
                }

                graph     = builder.Build();
                graphInfo = new GraphInfo(style, graph);
                break;

            case GraphType.FixedGraph1:
                graph     = new FixedGraph1(expData);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;

            case GraphType.FixedGraph2:
                graph     = new FixedGraph2(expData);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;

            case GraphType.FixedGraphOverlap:
                graph     = new FixedGraphOverlap(expData);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;

            case GraphType.FixedGraphOverlapSubperil:
                graph     = new FixedGraphOverlapSubperil(expData);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;

            case GraphType.FixedGraphOverlapSubperil2:
                graph     = new FixedGraphOverlapSubperil2(expData);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;

            case GraphType.FixedTreaty1:
                graph     = new FixedTreaty1(expData, graphCache);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;
            //case GraphType.FixedMatrixGraphJPTY:
            //    graph  = new FixedMatrixGraphJPTY(expData);
            //    graphInfo = new GraphInfo(AutoGraphStyle.Matrix, graph);
            //    //graph.Initialize();
            //    break;

            default:
                throw new NotSupportedException("Cannot currently support this treaty type");
            }


            graph.Initialize();

            if (graph is FixedPrimaryGraph || graph is FixedTreaty1)   ///need to remove FixedTreaty1 condition
            {
                GetTermsForGraph(expData, graph as GraphOfNodes);
            }

            graph.PeriodReset();

            graphCache.Add(graph.ContractID, graphInfo);
            return(graphInfo);
        }