Exemplo n.º 1
0
        private HashSet <GraphInfo> BuildPosition(HashSet <long> conIDs)
        {
            HashSet <GraphInfo> position = new HashSet <GraphInfo>();

            foreach (long ID in conIDs)
            {
                GraphInfo contract;
                if (graphCache.GetGraphInfo(ID, out contract))
                {
                    position.Add(contract);
                }
                else
                {
                    GraphBuilder        builder = new GraphBuilder(graphCache);
                    ExposureDataAdaptor expData = graphCache.GetExposure(ID);
                    GraphType           type    = graphCache.GetSettings(ID).GraphType;
                    IRITEindexMapper    mapper  = GetMapper(expData);

                    contract = builder.MakeGraph(type, expData, mapper);
                    graphCache.Add(ID, contract);
                    position.Add(contract);
                }
            }

            return(position);
        }
Exemplo n.º 2
0
        private IRITEindexMapper GetMapperForContract(ExposureDataAdaptor expData)
        {
            IRITEindexMapper indexMapper;

            if (GraphCache.GetIndexMapper(expData.ContractID, out indexMapper))
            {
                return(indexMapper);
            }
            else
            {
                RAPSettings rapsettings = GraphCache.GetSettings(expData.ContractID).RAPsettings;
                indexMapper = new RITEmapper1(expData, rapsettings, new RMSSubPerilConfig());
                GraphCache.Add(expData.ContractID, indexMapper);
                return(indexMapper);
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        public Graph MakeGraph(GraphType type, ExposureDataAdaptor expData)
        {
            Graph graph;

            if (graphCache.GetContract(expData.ContractID, out graph))
            {
                return(graph);
            }

            switch (type)
            {
            case GraphType.Auto:
                AutoGraphBuilder builder = new AutoGraphBuilder(expData, graphCache);
                graph = builder.Build();
                break;

            case GraphType.FixedGraph1:
                graph = new FixedGraph1(expData);
                //graph.Initialize();
                break;

            case GraphType.FixedGraph2:
                graph = new FixedGraph2(expData);
                //graph.Initialize();
                break;

            case GraphType.FixedGraphOverlap:
                graph = new FixedGraphOverlap(expData);
                //graph.Initialize();
                break;

            case GraphType.FixedGraphOverlapSubperil:
                graph = new FixedGraphOverlapSubperil(expData);
                //graph.Initialize();
                break;

            case GraphType.FixedGraphOverlapSubperil2:
                graph = new FixedGraphOverlapSubperil2(expData);
                //graph.Initialize();
                break;

            case GraphType.FixedTreaty1:
                graph = new FixedTreaty1(expData, graphCache);
                //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);
            }

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