コード例 #1
0
        public override void Initialize()
        {
            _contractRITEs = new HashSet <ContractAtomicRITE>();
            //Build Graph here....
            graphNodes          = new List <GraphNode>();
            parentToChildrenMap = new Dictionary <GraphNode, List <GraphNode> >();
            atomicCoverageRITEs = new HashSet <CoverageAtomicRITE>();

            //Add Contract Declarations
            Declarations = new Declarations();

            GraphInfo overlapGraph;

            cache.GetGraphInfo(11331, out overlapGraph);
            GraphInfo normalGraph;

            cache.GetGraphInfo(11324656, out normalGraph);

            ScheduleOfContracts schedule = new ScheduleOfContracts("PositionA_Gross",
                                                                   new HashSet <GraphInfo>()
            {
                overlapGraph, normalGraph
            });
            ReinsuranceSubject TreatyNodeSub = new ReinsuranceSubject(schedule, Loss, EQ);
            CoverNode          TreatyNode    = new CoverNode(TreatyNodeSub, "OccLim");

            //TreatyNode.SetCoverTerms(false, 100, 100000, 1);
            graphNodes.Add(TreatyNode);
            this.TopNodes = new List <GraphNode>()
            {
                TreatyNode
            };

            this.BuildAtomicRITEs();
        }
コード例 #2
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);
        }
コード例 #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);
        }