Exemple #1
0
        public ReferenceResultOutput ExecutePeriod(long conID, GraphType type, List <Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > > > ListOfguLossDict)
        {
            ExposureDataAdaptor expData = PDataAdaptor.GetExposureAdaptor(conID);
            string error;

            // Gu Loss can be for many contracts for need Dictionary of Mapper as input..
            Dictionary <long, IRITEindexMapper> indexMappers = GetMappers(expData);

            //Need to get mapper for current executing contract to build graph..
            IRITEindexMapper mapperForContract = indexMappers[conID];

            GraphInfo graphInfo = GetGraph(type, expData, mapperForContract);
            Graph     graph     = graphInfo.Graph;

            //Output object
            ReferenceResultOutput ResultOutput = new ReferenceResultOutput(0, 0);

            foreach (Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > >
                     guLossDict in ListOfguLossDict)
            {
                //Execute each event
                graph.EventReset();

                GULossAdaptor guLossAdaptor = new GULossAdaptor(indexMappers, guLossDict, graph.DeclarationsForAssociatedContracts, true);

                GraphExecuterAdaptor MainExecuter = new GraphExecuterAdaptor(graphInfo);

                ResultOutput += MainExecuter.RunExecution(guLossAdaptor);
            }

            return(ResultOutput);
        }
Exemple #2
0
        public ReferenceResultOutput RunExecution(GULossAdaptor guLossAdaptor)
        {
            GraphExecuter Executer;

            switch (graphInfo.Style)
            {
            case AutoGraphStyle.Matrix:
                Executer = new GraphOfMatrixExecuter(graph as GraphOfMatrix);
                break;

            case AutoGraphStyle.Node:
                if (graph is PrimaryGraph)
                {
                    Executer = new PrimaryGraphOfNodesExecuter(graph as PrimaryGraph);
                }
                else if (graph is TreatyGraph)
                {
                    Executer = new TreatyGraphOfNodesExecuter(graph as TreatyGraph);
                }
                else
                {
                    throw new NotSupportedException("Can only handle Node graphs of type Treaty and Primary type");
                }
                break;

            default:
                throw new NotSupportedException("Can only handle graph of style Matrix or Node");
            }

            return(Executer.Execute(guLossAdaptor));
        }