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); }
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); }